A
A
Anton2018-02-18 21:26:38
Python
Anton, 2018-02-18 21:26:38

How to correctly formulate a post request in http for gist github api?

I want to create a file in my Gist using the GitHub API. Now he is.

requests.post(
    'https://api.github.com/gists',
    params = {
        'description':'Неоригинальное описание',
        'public':True,
        'files': {
            'test.txt': {
                'content':'Содержимое test.txt'
            }
        },
        'access_token':'Мой токен'
    }).json()

It seems to be correct, but as a result, GitHub writes to me
{'message': "Invalid request.\n\nFor 'links/0/schema', nil is not an object.", 'documentation_url': 'https://developer.github.com/v3/gists/#create-a-gist'}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question