Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


Search this Thread
Old 09-12-2005, 03:09 PM   #1
Registered: Aug 2004
Posts: 137

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


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.


import httplib

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

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

    data =  # read file
    print data
Thanks in advance
Old 09-12-2005, 04:17 PM   #2
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 ?


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 11:30 PM
What is wrong with this python code ? indian Programming 5 09-22-2005 03:20 PM
my web browser "mozilla fire fox" isn't rendering the page, rather opening the page amolgupta Linux - Software 2 07-26-2005 01:41 AM
How to fetch source from a web page with Python rootyard Programming 1 07-19-2004 02:56 PM
Jerky mouse when web browsers download web page stodge Linux - Software 1 07-08-2003 11:29 PM

All times are GMT -5. The time now is 06:11 PM.

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