magsol / garmin

Some scripts I've thrown together to analyze my Garmin data.
MIT License
70 stars 34 forks source link

re.search() or page.get_data() not working #23

Open luca-martial opened 5 years ago

luca-martial commented 5 years ago

Seems like there is an issue, this is not running, but I don't have any other idea of what could be happening? See screenshot below:

Screen Shot 2019-10-17 at 12 48 59 PM
buckeye17 commented 4 years ago

I've run into the same issue. It appears that modifying line 49 of download.py as follows fixes the error (I appended decode("utf-8") to the method chain): script_url = re.search(pattern, page.get_data().decode("utf-8")).group()[1:-1]

With this correction, a new error results because it fails to open the corresponding URL. The webpage response is: HTTP Error 500: Internal Server Error

According to the discussion for Issue #22 script_url should be hard coded to "http://sso.garmin.com/sso/signin". After doing this, I found other TypeError instances that look identical luca's error. They were also resolved with the same decode("utf-8") trick. These changes were made on lines 94, 96 & 102.

Lastly, urllib.urlencode(data) on line 80 needs to be modified to urllib.parse.urlencode(data) because urllib has been changed accordingly.

After all of these changes, the script fails to download any data because of, "Wrong credentials for user..." On this error, I'm clueless what to do. I'm able to load the initurl URL manually in my browser without a problem, but the agent.open() fails to execute.