У меня проблемы с доступом к FitBit API с помощью библиотеки fitbit в Python ... Есть ли у кого-нибудь предложения по исправлению?
import fitbit
consumer_key = '22AA4K'
consumer_secret = '931439b475f0b1c1bf610f093ae0b16b'
access_token = 'eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIyMkJSNEsiLCJzdWIiOiI0WU5HM1EiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZM4iLCJzY29wZXMiOiJyc29jIHJzZXQgcmFjdCBybG9jIHJ3ZWkgcmhyIHJwcm8gcm51dCByc2xlIiwiZXhwIjoxNTg5MzgzMDQ5LCJpYPQiOjE1ODg3ODY3ODV9.kDZFp6CExpgQDR0vCt3ZMrT5bM5QSK9419RkMTqhY1Q'
unauth_client = fitbit.Fitbit(consumer_key, consumer_secret,
access_tokenn=access_token,
refresh_token=None)
unauth_client.food_units()
Вывод:
Traceback (most recent call last):
File "C:/Users/PycharmProjects/Test_16.03.20/Test.py", line 11, in <module>
unauth_client.food_units()
File "C:\Users\venv\Test_16.03.20\lib\site-packages\fitbit\api.py", line 867, in food_units
return self.make_request(url)
File "C:\Users\venv\Test_16.03.20\lib\site-packages\fitbit\api.py", line 256, in make_request
response = self.client.make_request(*args, **kwargs)
File "C:\Users\venv\Test_16.03.20\lib\site-packages\fitbit\api.py", line 99, in make_request
exceptions.detect_and_raise_error(response)
File "C:\Users\venv\Test_16.03.20\lib\site-packages\fitbit\exceptions.py", line 82, in detect_and_raise_error
raise HTTPUnauthorized(response)
fitbit.exceptions.HTTPUnauthorized: Authorization Error: Invalid authorization token type
Process finished with exit code 1