Comments (5)
Seems the solution is to use cloudscraper: tcgoetz/GarminDB#120
Replacing import requests
with import cloudscraper
and requests.Session()
with cloudscraper.CloudScraper()
solved it for me.
from garmin-workouts.
@gilshohet thanks!
That solved the authentication issue.
The API seems to have changed to closed model though, even list does not work:
(venv) laptop:~/garmin-workouts% python -m garminworkouts -u USER -p PASSWORD list
Connecting
INFO:garminworkouts.garmin.garminclient:User 'USER' already authenticated
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/jboucas/garmin-workouts/garminworkouts/__main__.py", line 112, in <module>
main()
File "/Users/jboucas/garmin-workouts/garminworkouts/__main__.py", line 108, in main
args.func(args)
File "/Users/jboucas/garmin-workouts/garminworkouts/__main__.py", line 53, in command_list
for workout in connection.list_workouts():
File "/Users/jboucas/garmin-workouts/garminworkouts/garmin/garminclient.py", line 45, in list_workouts
response.raise_for_status()
File "/Users/jboucas/garmin-workouts/venv/lib/python3.8/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 402 Client Error: Payment Required for url: https://connect.garmin.com/modern/proxy/workout-service/workouts?start=0&limit=100
from garmin-workouts.
@jorgeboucas oops, meant to open an issue for this a few weeks ago and forgot about it. Based on this commit from python-garminconnect the solution appears to be to change the base URL. I don't have the bandwidth to properly debug/test right now but this change worked for me:
# _WORKOUT_SERVICE_URL = "https://connect.garmin.com/modern/proxy/workout-service"
_WORKOUT_SERVICE_URL = "https://connect.garmin.com/proxy/workout-service"
from garmin-workouts.
it's working now. Thanks!
from garmin-workouts.
Nice tricks, thanks!
from garmin-workouts.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from garmin-workouts.