braiden / python-ant-downloader

Python Ant Downloader - tools for download from garmin wireless (ANT) devices
BSD 2-Clause "Simplified" License
141 stars 44 forks source link

Error posting to Garmin Connect #29

Closed geekruneat closed 12 years ago

geekruneat commented 12 years ago

I have setup the app, edited the antd.cfg with the correct username/password for my Garmin account (and I have triple checked this). However, when it tries to post to Garmin, I get the following error:

[MainThread] 2012-07-06 08:48:10,617 DEBUG Attempting to reprocess failed files. [MainThread] 2012-07-06 08:48:10,617 DEBUG Fetching cookies from Garmin Connect. [MainThread] 2012-07-06 08:48:11,750 DEBUG Posting login credentials to Garmin Connect. username=progeek [MainThread] 2012-07-06 08:48:14,341 DEBUG Checking if login was successful. [MainThread] 2012-07-06 08:48:14,669 WARNING Failed to uplaod to Garmin Connect. Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/python_ant_downloader-12.03.25-py2.7.egg/antd/connect.py", line 66, in data_availible self.login() File "/usr/local/lib/python2.7/dist-packages/python_ant_downloader-12.03.25-py2.7.egg/antd/connect.py", line 97, in login raise InvalidLogin() InvalidLogin

This is my connect section from my antd.cfg file:

[antd.connect] ; true to enable upload to garmin connect ; make sure to fill in username / password enabled = true ; Garmin Connect username / password ; Note that you can put this section in ; ~/.antd/antd.cfg if you don't ; want username / password in your git tree username = progeek password = **** ; file used to keep track of all tcx which ; are pending upload. files in the cache ; will have upload re-attempted until successful ; or until cache is deleted. cache = ~/.antd/garmin-connect-upload-queue.txt

So the question is what am I missing?

braiden commented 12 years ago

This is your first time trying to upload with my software?

Its possible garmin was having a temporary issue. I just tested and it worked for me, so I don't think api changed.

Make sure you're editting ~/.antd/antd.cfg and not the copy in your source tree.

If none of that helps... can you edit antd/connect.py:94:

94 reply = self.opener.open("http://connect.garmin.com/user/username")

add "print reply" immediately after that line to see what reply garmin did send.

I'll take a look at increase verbosity of logging. It saw purposely sparse to prevent someone for accidentally posting a log file with passwords or session tokens in them. I'll take a look at improving this, and you can retry. It won't fix you're problem, but may help us figure out what failed.

Regards,

On Fri, Jul 6, 2012 at 10:57 AM, geekruneat reply@reply.github.com wrote:

I have setup the app, edited the antd.cfg with the correct username/password for my Garmin account (and I have triple checked this). However, when it tries to post to Garmin, I get the following error:

[MainThread] 2012-07-06 08:48:10,617 DEBUG Attempting to reprocess failed files. [MainThread] 2012-07-06 08:48:10,617 DEBUG Fetching cookies from Garmin Connect. [MainThread] 2012-07-06 08:48:11,750 DEBUG Posting login credentials to Garmin Connect. username=progeek [MainThread] 2012-07-06 08:48:14,341 DEBUG Checking if login was successful. [MainThread] 2012-07-06 08:48:14,669 WARNING Failed to uplaod to Garmin Connect. Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/python_ant_downloader-12.03.25-py2.7.egg/antd/connect.py", line 66, in data_availible self.login() File "/usr/local/lib/python2.7/dist-packages/python_ant_downloader-12.03.25-py2.7.egg/antd/connect.py", line 97, in login raise InvalidLogin() InvalidLogin

This is my connect section from my antd.cfg file:

[antd.connect] ; true to enable upload to garmin connect ; make sure to fill in username / password enabled = true ; Garmin Connect username / password ; Note that you can put this section in ; ~/.antd/antd.cfg if you don't ; want username / password in your git tree username = progeek password = **** ; file used to keep track of all tcx which ; are pending upload. files in the cache ; will have upload re-attempted until successful ; or until cache is deleted. cache = ~/.antd/garmin-connect-upload-queue.txt

So the question is what am I missing?


Reply to this email directly or view it on GitHub: https://github.com/braiden/python-ant-downloader/issues/29

geekruneat commented 12 years ago

Ok, I have not done anything with the source tree and only editted the ~/.antd/antd.cfg file. It still does not work.

When I add the print reply it returns: <addinfourl at 157653420 whose fp = <socket._fileobject object at 0x965de2c>>

If I add a print reply.read(), it returns:
{"username":"geekruneat"}

This is correct as I have changed my display name on Garmin to geekruneat (but my login name is still progeek). It looks like it is working since it does return my correct username from Garmin, however your code (line 95) checks to see if the Username returned matches the login name (which does not match and yet Garmin allows). For now I will change my display name on Garmin back to progeek so this works but you might want to find another way to verify the login worked since Garmin allows the two values to be different. Thanks for the help

Mike

braiden commented 12 years ago

In your first post your username is progeek. Look like Garmin replied with username:geekruneat. Is Garmin replying with a different value of username, or did you change config file since first post?

On Jul 7, 2012 10:34 PM, "geekruneat" < reply@reply.github.com> wrote:

Ok, I have not done anything with the source tree and only editted the ~/.antd/antd.cfg file. It still does not work.

When I add the print reply it returns: <addinfourl at 157653420 whose fp = <socket._fileobject object at 0x965de2c>>

If I add a print reply.read(), it returns: {"username":"geekruneat"}

This is correct as I have changed my display name on Garmin to geekruneat (but my login name is still progeek). It looks like it is working since it does return my correct username from Garmin, however your code (line 95) checks to see if the Username returned matches the login name (which does not match and yet Garmin allows). For now I will change my display name on Garmin back to progeek so this works but you might want to find another way to verify the login worked since Garmin allows the two values to be different. Thanks for the help

Mike


Reply to this email directly or view it on GitHub:

https://github.com/braiden/python-ant-downloader/issues/29#issuecomment-6828398

geekruneat commented 12 years ago

OK, to reproduce this error: Log into the Garmin Web site, then go into settings. If you look at the Account Information, it says my username is "progeek" (and it is not editable). Now if go to the Connect Profile, you will see a setting called Display Name. This is by default the same as your Username but this field is editable. This is the value Garmin is returning to your app. If you change this value to no longer match your Username, then your Login Validation no longer works.

braiden commented 12 years ago

Committed a fix, let me know if pulling latest from git doesn't resolve your issue.

Regards,

geekruneat commented 12 years ago

That works. Thanks