Questions tagged [mechanize-python]

Stateful programmatic web browsing in Python, after Andy Lester’s Perl module WWW::Mechanize.

Stateful programmatic web browsing in Python, after Andy Lester’s Perl module WWW::Mechanize.

Some of the key features:

  • The browser class mechanize.Browser implements the interface of urllib2.OpenerDirector, so any URL can be opened not just http.
  • Easy HTML form filling.
  • Convenient link parsing and following.
  • Browser history (.back() and .reload() methods).
  • The Referer HTTP header is added properly (optional).
  • Automatic observance of robots.txt (can be disabled if desired).
  • Automatic handling of HTTP-Equiv and Refresh.

python-mechanize was created by John J. Lee. Maintenance was taken over by Kovid Goyal.


HomePage | Documentation | Github | FAQ


235 questions
0
votes
1 answer

Not able to parse HTML with mechanize or requests

i'm trying to get/view an HTML code for a certain website however i'm not able to do so, below is a snip of my code and the output that i got import mechanize from BeautifulSoup import BeautifulSoup page =…
fooBar
  • 412
  • 6
  • 17
0
votes
0 answers

Python's Requests or Mechanize to login to a site

I want to start off by apologizing. I know this has more than likely been done more than enough times, and I'm just beating a dead horse, but I'd really like to know how to get this to work. I am trying to use the Requests module for python in order…
davelupt
  • 1,845
  • 4
  • 21
  • 32
0
votes
1 answer

Work on my Python Scripts in different computers

Python newbie here. I am looking for a way to save my python scripts online so that I can work on them from both work and at home. I would like to build some (simple) web scraping tools, using Mechanize, and perhaps Scrapy. After doing a little bit…
Theo
  • 87
  • 7
0
votes
1 answer

Selecting Form Name using Mechanize

I am trying to select an option in a drop down menu form on a web page using Mechanize. so far I have the following: import mechanize as mc br = mc.Browser() br.open(url='http://www.marseille-port.fr/fr/Page/Escale_consultation/13286') which…
Ross Middleton
  • 237
  • 2
  • 6
  • 13
0
votes
1 answer

Filling in select field form with mechanize

I'm trying to fill out 3 select fields in a form like so. br.select_form(name='frmentermemorableinformation1') br['frmentermemorableinformation1:strEnterMemorableInformation_memInfo1'] = ['g'] When running the program I get the following…
Diofsi
  • 35
  • 3
0
votes
1 answer

password vailidation failing using mechanize/python

I'm trying to log on onto a website with mechanize for python; however when presented with correct credentials in the form it fails to log in. Here's what I'm doing following the mechanize tutorial: def logon(self): baseurl =…
RMSD
  • 476
  • 5
  • 12
0
votes
0 answers

Can't access field with mechanize python

I am trying to enter the site http://www.sj.se/travel/booksearchlocation.form?mode=normal&l=sv using Mechanize Python using the following code: import mechanize import cookielib # Browser br = mechanize.Browser() # Cookie Jar cj =…
user1319951
  • 495
  • 6
  • 16
0
votes
1 answer

How to add client certificate using python mechanize

I am a client to a secured HTTPS server who has issued to me a password protected .pfx certificate to identify me to its system every-time. Using browser where I have installed the certificate (apparently only IE6 and previous versions works) i am…
Hemant
  • 225
  • 4
  • 17
0
votes
1 answer

Submitting a form with mechanize HTTP Error 500

This is my first time using mechanize and I'm trying to fill out a form with mechanize Here are my browser…
Kevin
  • 3,209
  • 9
  • 39
  • 53
0
votes
1 answer

scraping way2sms with mechanize

I am trying to send an sms with by scraping way2sms.com, but I am unable to login into way2sms.com using mechanize. I am using following code to submit the login form. import mechanize br =…
0
votes
1 answer

How to press a button and click on checkbox

How can i click on button and check the check box with mechanize python... HTML code: i tried with: br.click(id ="btn_t") But…
Surya Gupta
  • 165
  • 6
  • 13
0
votes
0 answers

Why would mechanize .open() / .read() / .close() return None/have socket internals be None?

I'm getting occasional AttributeErrors with code of the following sort. I set a mechanize instance up with: self.mech = mechanize.Browser(factory=mechanize.RobustFactory()) self.cj =…
Claudiu
  • 224,032
  • 165
  • 485
  • 680
0
votes
0 answers

why does mechanize not recognize these radio buttons?

I am trying to get controls information of a form on a website (http://www.proxy-listen.de/Proxy/Proxyliste.html). (Actually I want to fill the form, submit it, and get a list of proxy servers). I am using this code to read out the form elements: …
julianschnell
  • 193
  • 1
  • 2
  • 8
0
votes
1 answer

Click on input tag, not in form

Im using mechanize to scrape a few pages. Pagination is implemented by a javascript post, and the pagination links are actually input buttons. These are not included in a form. Any idea how I could trigger a click on these? Im still working on the…
zsquare
  • 9,916
  • 6
  • 53
  • 87
0
votes
2 answers

Password - protected sites using mechanize

I want to access way2sms which is a password protected site using mechanize. import mechanize br = mechanize.Browser() br.open('http://site2.way2sms.com/content/index.html') for form in br.forms(): print form which gives this
Manoj
  • 961
  • 4
  • 11
  • 37
1 2 3
15
16