headers = {'APIKEY':'----my API key here-----'}
response = requests.get('https://api.stackexchange.com/2.2/users?page=1&pagesize=5&order=desc&sort=reputation&site=stackoverflow',headers=headers)
"quota_max":300,"quota_remaining":299
This shows that max quota is 300 but I think I should get max quota of 10000 as mentioned on stackoverflow's API page. Please help me out if I am passing my API key the wrong way, while making the requests. What is the right way to do it?
Not sure where you got APIKEY
from but it should be access_token
, and it should be a url parameter. Pass access_token
as a url parameter in a dict instead. You can also include the other parameters in your url.
url = 'https://api.stackexchange.com/2.2/users'
params = {'access_token': my_token, 'page': 1, 'pagesize': 5,
'order': 'desc', 'sort': 'reputation', 'site': 'stackoverflow'}
response = requests.get(url, params=params)