02-06-2018 04:39
02-06-2018 04:39
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
Answered! Go to the Best Answer.
02-07-2018 04:21
02-07-2018 04:21
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.
02-07-2018 04:21
02-07-2018 04:21
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.