473,326 Members | 2,182 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How can I get the content of a web site using http library

I am trying to get the content of a web site like this:
But my question is how can I do a 'GET' request without putting the '/
index.html''
h = httplib.HTTP('www.yahoo.com')

# it takes 2 arguments here, but I don't know if the site has
'/index.html' , how can I leave this out?

h.putrequest('GET')
h.endheaders()

errcode, errmsg, headers = h.getreply()

if (errcode == 200):

f = h.getfile()

Thank you for your help.

Mar 29 '07 #1
6 1154
On Mar 29, 2:18 pm, "silverburgh.me...@gmail.com"
<silverburgh.me...@gmail.comwrote:
I am trying to get the content of a web site like this:
But my question is how can I do a 'GET' request without putting the '/
index.html''

h = httplib.HTTP('www.yahoo.com')

# it takes 2 arguments here, but I don't know if the site has
'/index.html' , how can I leave this out?

h.putrequest('GET')
h.endheaders()

errcode, errmsg, headers = h.getreply()

if (errcode == 200):

f = h.getfile()

Thank you for your help.
You may want to go with the urllib module instead. Check out the how-
to below:

http://www.voidspace.org.uk/python/a.../urllib2.shtml

Mike

Mar 29 '07 #2
On Mar 29, 2:34 pm, kyoso...@gmail.com wrote:
On Mar 29, 2:18 pm, "silverburgh.me...@gmail.com"

<silverburgh.me...@gmail.comwrote:
I am trying to get the content of a web site like this:
But my question is how can I do a 'GET' request without putting the '/
index.html''
h = httplib.HTTP('www.yahoo.com')
# it takes 2 arguments here, but I don't know if the site has
'/index.html' , how can I leave this out?
h.putrequest('GET')
h.endheaders()
errcode, errmsg, headers = h.getreply()
if (errcode == 200):
f = h.getfile()
Thank you for your help.

You may want to go with the urllib module instead. Check out the how-
to below:

http://www.voidspace.org.uk/python/a.../urllib2.shtml

Mike
Thanks. Can you please tell me how can I do a Post form submission
using the urlLib2 library? I look at your link, but i cant find an
example there.

Thank you.

Mar 29 '07 #3
* si***************@gmail.com (29 Mar 2007 12:18:19 -0700)
I am trying to get the content of a web site like this:
But my question is how can I do a 'GET' request without putting the '/
index.html''
import urllib
print urllib.urlopen('http://www.yahoo.com/').read()
Mar 29 '07 #4
On Mar 29, 3:07 pm, Thorsten Kampe <thors...@thorstenkampe.dewrote:
* silverburgh.me...@gmail.com (29 Mar 2007 12:18:19 -0700)
I am trying to get the content of a web site like this:
But my question is how can I do a 'GET' request without putting the '/
index.html''

import urllib
print urllib.urlopen('http://www.yahoo.com/').read()
Posting to a form:

urllib:
http://www.thescripts.com/forum/thread23871.html

httplib:
http://aspn.activestate.com/ASPN/Coo.../Recipe/146306
http://www.python.org/infogami-faq/l...n-method-post/

Mike

Mar 29 '07 #5
On Mar 29, 10:49 pm, "silverburgh.me...@gmail.com"
<silverburgh.me...@gmail.comwrote:
Thanks. Can you please tell me how can I do a Post form submission
using the urlLib2 library? I look at your link, but i cant find an
example there.

Thank you.
http://www.python.org/doc/current/li...e-urllib2.html

Look into urlopen's data parameter.

Mar 29 '07 #6
<ir****@gmail.comwrote:
http://www.python.org/doc/current/li...e-urllib2.html

Look into urlopen's data parameter.
I add also this tutorial to the plate:
http://www.voidspace.org.uk/python/a.../urllib2.shtml

--
Lawrence, oluyede.org - neropercaso.it
"It is difficult to get a man to understand
something when his salary depends on not
understanding it" - Upton Sinclair
Mar 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Bozo Schmozo | last post by:
Greetings! I've searched groups.google.com already to see if I can determine if using PHP/MySQL (if needed) for a web site I wish to develop. As the subject indicated, it will be a content...
10
by: Mathias Mink | last post by:
hello ng, i need your help. how can i display ftp-content (files which lies on a ftp-server) on an asp-site? do there anybody have an idea, how can i solve this? at the moment we list the...
22
by: Trevor Orton | last post by:
Hello, I'm having a slight problem using the W3C html validator and I've reviewed the FAQ's with no luck so hopefully someone here would be kind enough to point me in the right direction. I...
1
by: Epetruk | last post by:
Hello all, I'm sorry for the long post, but I think it's better if I'm as detailed as I can be so that I don't make a mistake in my choice and so that there's a clear understanding of to what...
1
by: Sunil Menon | last post by:
Dear All, I stumbled upon an article on "Content Management Server"...but got a bit confused...i would like to know if "Content Management Server" can.. 1. Show me a Word Document in a browser...
3
by: Tom | last post by:
Hi, I am currently looking for a Content Management System for one of my project in ASP.NET. Here are the requirements: * web based content management * ability to enter content/fragment...
5
by: Federico | last post by:
I have a problem, I have an event declared in a Master Page, and I want to use in a Content Page holder of a Content Page. When I want to create the method to handle the event, I can njot reference...
7
by: Water Cooler v2 | last post by:
I know what it is, and yet the knowledge of what a CMS is, is so vague that I find myself asking this question every now and then. I've googled and read the resources too. However, the knowledge is...
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.