Skip to content

Instantly share code, notes, and snippets.

@zunjae
Last active February 7, 2020 09:26
Show Gist options
  • Save zunjae/15c2487a94b0def5ec1d2c09fadf6f09 to your computer and use it in GitHub Desktop.
Save zunjae/15c2487a94b0def5ec1d2c09fadf6f09 to your computer and use it in GitHub Desktop.
Solution "[GitHub API] Deprecation notice for authentication via URL query parameters"
Hi @zunjae,
On February 6th, 2020 at 22:00 (UTC) your personal access token (Gist) using python-requests/2.18.4 was used as part of a query parameter to access an endpoint through the GitHub API:
https://api.github.com/gists/LINK
Please use the Authorization HTTP header instead, as using the `access_token` query parameter is deprecated.
Depending on your API usage, we'll be sending you this email reminder once every 3 days for each token and User-Agent used in API calls made on your behalf.
Just one URL that was accessed with a token and User-Agent combination will be listed in the email reminder, not all.
Visit https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api/#authenticating-using-query-parameters for more information.
Thanks,
The GitHub Team
def post_to_github(gist_id: str, json_content: dict, filename: str) -> requests.Response:
headers = {
"Authorization": "token {}".format(keys.access_token)
}
url = 'https://api.github.com/gists/{}'.format(gist_id)
issue = {'files': {filename: {'content': json_content}}}
return requests.patch(url, json.dumps(issue), headers=headers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment