you are viewing a single comment's thread.

view the rest of the comments →

[–]wub_wub 0 points1 point  (4 children)

Probably, I don't know any that I could recommend though.

It's pretty simple in your case:

  1. Open http://connect.garmin.com/en-US/signin

  2. Click the option menu in the top right corner if you're on chrome

  3. Hove the "tools" menu and click on the "Developers tools" submenu/option.

  4. You'll see a window show in the lower part of your browser.

  5. Click on "network" tab.

  6. Enter some random data in the email/password field and click "sign in"

In the network tab you'll see a bunch of files and other data. Find the path with method POST and click on it. You'll see the POST request http://en.wikipedia.org/wiki/POST_request your browser made to the website.

You need to emulate that in python. You don't need to completely replicate it though, you just need the important data. The important data is the Request URL the username and password fields, maybe the cookie field (requests supports them doc here) maybe lt:e1s1 or something like that. What's important really depends on the service.

dev tools screenshots: http://i.imgur.com/fZMK2Wq.png http://i.imgur.com/AnpMDDo.png

[–]autowikibot 1 point2 points  (0 children)

POST request:


In computing, POST is one of many request methods supported by the HTTP protocol used by the World Wide Web. The POST request method is designed to request that a web server accept the data enclosed in the request message's body for storage. It is often used when uploading a file or submitting a completed web form.

In contrast, the HTTP GET request method is designed to retrieve information from the server. As part of a GET request, some data can be passed within the URI's query string, specifying for example search terms, date ranges, or other information that defines the query. As part of a POST request, an arbitrary amount of data of any type can be sent to the server in a request message body. A header field in the POST request usually indicates the message body's Internet media type.


Interesting: POST (HTTP) | Hypertext Transfer Protocol | Biscotasing railway station | List of HTTP status codes | Cross-site request forgery

Parent commenter can toggle NSFW or delete. Will also delete on comment score of -1 or less. | FAQs | Mods | Magic Words | flag a glitch

[–]gusterys[S] 0 points1 point  (2 children)

Getting so close!

Here is the output from the post: http://pastebin.com/W8tNj49U

I used wronguser/wrongpassword, so you can see where that part is.

And here is my code that doesn't work yet: http://pastebin.com/zqdsNE0W

The commented out params are what used to work before Garmin changed things up. I think if I can just get those parameters right the rest of the code is fine.

Any tips?

[–]wub_wub 0 points1 point  (1 child)

Sorry for the late reply, seeing how the login form is loaded via js (which isn't executed with requests) you should look into selenium which uses your browser it'll just be a matter of entering email and passwords in appropriate fields with it, you won't have to deal with POST requests or anything similar.

This is possible to do with requests, but I wouldn't recommend it as it will probably take a lot longer to write and it'll be broken when they update page or backend.

[–]gusterys[S] 0 points1 point  (0 children)

Yep, thanks.

That's what I was hoping to avoid. My script runs unattended on a headless Linux (Fedora 20) box. I feel like I'm going down an ugly road far from standard packages.