Menu
Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Submitting forms over HTTPS with mechanize
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Rex, post: 3624547"] Hello, I am working on an academic research project where I need to log in to a website ([URL="http://www.lexis.com"]www.lexis.com[/URL]) over HTTPS and execute a bunch of queries to gather a data set. I just discovered the mechanize module, which seems great because it's a high-level tool. However, I can't find any decent documentation for mechanize apart from the docstrings, which are pretty thin. So I just followed some other examples I found online, to produce the following: baseurl = '[URL]http://www.lexis.com/[/URL]' br = mechanize.Browser() br.set_handle_robots(False) br.addheaders = [('User-Agent', 'Firefox')] br.open(baseurl) br.select_form(name="formauth") br["USER_ID"]="my_user_id" br["PASSWORD"]="my_password" result = br.submit() This code hangs at br.submit(), and I can't tell what I'm doing wrong. Typically I would inspect the HTTP data with an HTTP debugging proxy (Fiddler), but I guess since this is HTTPS I can't do that. Any glaring errors in my code? By the way, does anyone have suggestions for Python modules that I should use instead of mechanize (and that are sufficiently easy)? If mechanize fails, I might try modifying some similar Perl code a friend sent me that logs into lexis.com. Thanks so much, Rex [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Submitting forms over HTTPS with mechanize
Top