Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

"message":"Too Many Requests" when I haven't made any requests yet?

ANSWERED

I haven't made a single request in 8 hours yet still the only response I can get from the fitbit web api is
"errors":....blah blah..."Too Many Requests"...blah blah..."Success":false

I am VERY sure that I never exceeded the 150 request limit, but assuming I did.. is 8 hours a great enough amount of time to wait for that limit to be reset?

Code:

def get_fitbit(token, fit_id, stat=''):
try:
if stat == 'heart':
url = 'https://api.fitbit.com/1/user/' + fit_id + '/activities/heart/date/today/1d.json'
elif stat == 'weight':
url = 'https://api.fitbit.com/1/user/' + fit_id + '/body/log/weight/date/today.json'
elif stat == 'step':
url = 'https://api.fitbit.com/1/user/' + fit_id + '/activities/steps/date/today/1m.json'
elif stat == 'sleep':
url = 'https://api.fitbit.com/1.2/user/' + fit_id + '/sleep/date/today.json'
elif stat == 'device':
url = 'https://api.fitbit.com/1/user/' + fit_id + '/devices.json'
elif stat == 'calories':
url = 'https://api.fitbit.com/1/user/' + fit_id + '/activities/calories/date/today/1d.json'
elif stat == 'bmi':
url = 'https://api.fitbit.com/1/user/' + fit_id + '/body/bmi/date/today/1d.json'
else:
url = 'https://api.fitbit.com/1/user/' + fit_id + '/profile.json'
response = requests.get(url=url, headers={'Authorization': 'Bearer ' + token})
return response.content
except Exception as e:
print(e)
return False

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

UPDATE:

It just kinda fixed it's self over time, Still very confused as to why 8 hours wasn't enough time to reset the request limit.

View best answer in original post

Best Answer
0 Votes
1 REPLY 1

UPDATE:

It just kinda fixed it's self over time, Still very confused as to why 8 hours wasn't enough time to reset the request limit.

Best Answer
0 Votes