Jump to content


Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  GamerZfury : (24 June 2018 - 01:59 AM) Welcome to our forum ErzestLab :)
@  David : (23 June 2018 - 08:42 PM) Hello everyone
@  Cyborg : (19 June 2018 - 01:34 AM) hi David
@  GamerZfury : (15 June 2018 - 07:40 PM) Welcome to our forum StephenDup :)
@  GamerZfury : (15 June 2018 - 03:44 AM) Welcome to our forum shokimi :)
@  GamerZfury : (13 June 2018 - 02:24 PM) Welcome to our forum PhilomenaM :)
@  GamerZfury : (12 June 2018 - 04:03 PM) Welcome to our forum yvvafq :)
@  GamerZfury : (12 June 2018 - 11:46 AM) Welcome to our forum MaryellenB :)
@  GamerZfury : (12 June 2018 - 09:01 AM) Welcome to our forum Petra26720 :)
@  GamerZfury : (11 June 2018 - 10:37 PM) Welcome to our forum Syreeta939 :)
@  GamerZfury : (11 June 2018 - 08:07 PM) Welcome to our forum AugustaWis :)
@  GamerZfury : (11 June 2018 - 05:30 AM) Welcome to our forum RobertTendy :)
@  GamerZfury : (08 June 2018 - 08:42 AM) Welcome to our forum Wizliammom :)
@  Cyborg : (04 June 2018 - 04:27 AM) aLLNuTs would like to wish WilliamRat a happy birthday.
@  GamerZfury : (03 June 2018 - 05:18 PM) Welcome to our forum qhermv :)
@  GamerZfury : (02 June 2018 - 10:36 AM) Welcome to our forum DarinaDEW :)
@  GamerZfury : (02 June 2018 - 06:05 AM) Welcome to our forum thzgcp :)
@  GamerZfury : (02 June 2018 - 04:00 AM) Welcome to our forum iazswv :)
@  GamerZfury : (01 June 2018 - 03:05 PM) Welcome to our forum Michaelpiefs :)
@  Ashley9519 : (31 May 2018 - 12:22 AM) Thank you so much for the welcome!

Register on GamerZFuRY!


Sign In 

Create Account
Welcome to GamerZFuRY !!! Like most online communities you must register to post or access the Downloads section. But don't worry this is a simple FREE process that requires minimal information for you to signup. Be apart of GamerZFuRY by signing in or creating an account.
 
Guest Message by DevFuse

[Python] Working with mechanize module-basics


  • Please log in to reply
No replies to this topic

#1 Cyborg

Cyborg

    Administrator

  • Administrators
  • 246 posts
  • LocationEarth
  • :

Posted 07 March 2015 - 08:14 AM

Browsing with Mechanize

The mechanize module in Python is similar to perl WWW:Mechanize.

It gives you a browser like object to interact with web pages.

Here is an example on how to use it in a program.

Please Login or Register to see this Hidden Content

Follow second link with element text matching regular expression

Please Login or Register to see this Hidden Content

To get the response code from a website, you can the response.code

Please Login or Register to see this Hidden Content

Get all forms from a website

Please Login or Register to see this Hidden Content

I found this post at

Please Login or Register to see this Hidden Content

that very accurate describes how
to emulate a browser in Python using mechanize.

Browsing with Python (

Please Login or Register to see this Hidden Content

)

Please Login or Register to see this Hidden Content

Ignore robots.txt

Please Login or Register to see this Hidden Content

Google demands a user-agent that isn't a robot

Please Login or Register to see this Hidden Content

Retrieve the Google home page, saving the response

Please Login or Register to see this Hidden Content

Select the search box and search for 'foo'

Please Login or Register to see this Hidden Content

Get the search results

Please Login or Register to see this Hidden Content

Find the link to foofighters.com; why did we run a search?

Please Login or Register to see this Hidden Content

Please Login or Register to see this Hidden Content

Print the site

Please Login or Register to see this Hidden Content

The script above is split up to make it easier to read

Its time for GamerZFuRY to become famous!!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users