userid not always str
jlapenna opened this issue · comments
repro:
rm .credentials
./scripts/build.sh
source ./venv/bin/activate
./scripts/integration_test.py --client-id='XXX' --consumer-secret='YYY' --callback-uri="http://localhost:8081/services/withings/redirect"
Attempting to get credentials...
Goto this URL in your browser and authorize: https://account.withings.com/oauth2_user/authorize2?response_type=code&client_id=XXX&redirect_uri=http%3A%2F%2Flocalhost%3A8081%2Fservices%2Fwithings%2Fredirect&scope=user.activity%2Cuser.metrics%2Cuser.info%2Cuser.sleepevents&state=ZZZ&mode=demo
Once you are redirected, copy and paste the whole url(including code) here.
Provide the entire redirect uri: http://localhost:8081/services/withings/redirect?code=CODECODECODE&state=ZZZ
Getting credentials with auth code CODECODECODE
Traceback (most recent call last):
File "./scripts/integration_test.py", line 119, in
main()
File "./scripts/integration_test.py", line 73, in main
credentials = auth.get_credentials(auth_code)
File "/home/jlapenna/code/python_withings_api/venv/lib/python3.6/site-packages/withings_api-2.1.2b1-py3.6.egg/withings_api/init.py", line 357, in get_credentials
File "/home/jlapenna/code/python_withings_api/venv/lib/python3.6/site-packages/withings_api-2.1.2b1-py3.6.egg/withings_api/common.py", line 451, in new_credentials
File "/home/jlapenna/code/python_withings_api/venv/lib/python3.6/site-packages/withings_api-2.1.2b1-py3.6.egg/withings_api/common.py", line 384, in str_or_raise
File "/home/jlapenna/code/python_withings_api/venv/lib/python3.6/site-packages/withings_api-2.1.2b1-py3.6.egg/withings_api/common.py", line 369, in enforce_type
withings_api.common.UnexpectedTypeException: Expected of "17633015" to be "<class 'str'>" but was "<class 'int'>."
(venv)
Response from the fetch_token call:
{'access_token': 'XXX', 'expires_in': 10800, 'token_type': 'Bearer', 'scope': ['user.activity,user.metrics,user.info,user.sleepevents'], 'refresh_token': 'YYY', 'userid': 17633015, 'expires_at': 1571600349.948566}