Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to send requests with python

Status
Not open for further replies.

Arrowx7

Programmer
Feb 16, 2005
17
CA
Hello,
I an trying to recieve an XML or HTML page from another server.
Is there a way to make python send a request to that server via HTTP and recieve a response containing the XML/HTML page.
How do we get that into a string so I can process it etc..
Kind of like a web browser does. It goes to a certain URL and recieves the HTML or XML via text transfer.

I am sure python is capable of something like that.
Any help would be GREATLY appreciated.
Thanks
 
check out urllib, urllib2
Code:
>>> import urllib
>>> readable = urllib.urlopen('[URL unfurl="true"]http://www.python.org/')[/URL]
>>> contents = readable.read()
>>> print contents
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top