3
2

What is the best way to fetch a webpage in python?

urllib seems extra difficult to use and not pythonic...

asked 10 Sep '11, 14:19

Russell%20Ballestrini's gravatar image

Russell Ball...
1.3k232937
accept rate: 43%


Check out 'requests' module

easy_install requests

>>> import requests
>>> r = requests.get("http://www.google.com/search?q=dogs")
>>> print r.content
link

answered 10 Sep '11, 14:21

LostHero's gravatar image

LostHero
89091320
accept rate: 61%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×7
×2
×1
×1

Asked: 10 Sep '11, 14:19

Seen: 1,565 times

Last updated: 10 Sep '11, 14:21

powered by OSQA