LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-12-2005, 02:09 PM   #1
indian
Member
 
Registered: Aug 2004
Posts: 137

Rep: Reputation: 15
Getting the web page in python :: What's wrong with the code ?


Hi,

I am looking to get the web page content i.e. html code using python for given URL. But this code is not working at all. when I compile it just gives blank. No error - No output and NO warning.

Code:
#/usr/bin/python

import httplib

def main():
    # test site - say for e.g. I want to get the html code of google
    ServerAdr='www.google.com'

    http = httplib.HTTP(ServerAdr)
    doc = http.getfile()

    data = doc.read()  # read file
    doc.close()
    print data
Thanks in advance
 
Old 09-12-2005, 03:17 PM   #2
nephish
Member
 
Registered: Jun 2005
Distribution: arch, ubuntu
Posts: 456

Rep: Reputation: 30
just guessing, as i have not employed this module before, but don't you have to establish a connection?
like this ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cant make web server run my local web page... Nik0s Linux - Newbie 22 10-08-2006 10:30 PM
What is wrong with this python code ? indian Programming 5 09-22-2005 02:20 PM
my web browser "mozilla fire fox" isn't rendering the page, rather opening the page amolgupta Linux - Software 2 07-26-2005 12:41 AM
How to fetch source from a web page with Python rootyard Programming 1 07-19-2004 01:56 PM
Jerky mouse when web browsers download web page stodge Linux - Software 1 07-08-2003 10:29 PM


All times are GMT -5. The time now is 04:51 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration