I am trying to use the Github API and it works when I do curl from terminal but not when using the Python Request library:
WORKS:
curl -v --location --request GET 'https://api.github.com/search/repositories?q=stars:>=500+created:2017-01-01&order=asc&per_page=100' \
--header 'Authorization: Bearer MY_TOKEN'
DOESN'T WORK:
import requests
url = https://api.github.com/search/repositories?q=stars:>=500+created:2017-01-01&order=asc&per_page=100
r = requests.get(url, auth=(MY_GITHUB_USERNAME, MY_TOKEN))
I get the following response for python:
" b'{"message":"Bad credentials","documentation_url":"https://docs.github.com/rest"}' "
Would appreciate any help - thank you in advance!