Getting the source of a remote webpage

Discussion in 'Python' started by Ryan Kaskel, Jun 24, 2004.

  1. Ryan Kaskel

    Ryan Kaskel Guest

    Is it possible to get the source of a remote webpage (just the
    straight HTML) without anything too complicated (like COM, I just want
    to write a simple script if possible) and write it to a file? For
    example, is it possible to do something like os.system(....run
    iexplorer.exe command....) with another command that automatically
    opens the page? Thanks.

    Ryan Kaskel
    Ryan Kaskel, Jun 24, 2004
    #1
    1. Advertising

  2. Ryan Kaskel

    Nugget Guest

    On Wed, 23 Jun 2004 19:47:02 -0700, Ryan Kaskel wrote:

    > Is it possible to get the source of a remote webpage (just the
    > straight HTML) without anything too complicated (like COM, I just want
    > to write a simple script if possible) and write it to a file? For
    > example, is it possible to do something like os.system(....run
    > iexplorer.exe command....) with another command that automatically
    > opens the page? Thanks.


    import urllib

    f = urllib.urlopen(url)
    s = site.read()






    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
    Nugget, Jun 24, 2004
    #2
    1. Advertising

  3. In article <>, Nugget wrote:

    >> Is it possible to get the source of a remote webpage (just the
    >> straight HTML) without anything too complicated (like COM, I
    >> just want to write a simple script if possible) and write it
    >> to a file? For example, is it possible to do something like
    >> os.system(....run iexplorer.exe command....) with another
    >> command that automatically opens the page? Thanks.

    >
    > import urllib
    >
    > f = urllib.urlopen(url)
    > s = site.read()


    least we lead the gentle reader astray...

    >>> import urllib
    >>> f = urllib.urlopen('http://www.visi.com')
    >>> s = site.read()


    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    NameError: name 'site' is not defined

    What you meant was:

    >>> s = f.read()
    >>> print s

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    [...]

    --
    Grant Edwards grante Yow! ... A housewife
    at is wearing a polypyrene
    visi.com jumpsuit!!
    Grant Edwards, Jun 24, 2004
    #3
  4. Ryan Kaskel

    Ryan Kaskel Guest

    Nevermind....a simple look in the Standard Library gave me the simple
    solution I needed....


    (Ryan Kaskel) wrote in message news:<>...
    > Is it possible to get the source of a remote webpage (just the
    > straight HTML) without anything too complicated (like COM, I just want
    > to write a simple script if possible) and write it to a file? For
    > example, is it possible to do something like os.system(....run
    > iexplorer.exe command....) with another command that automatically
    > opens the page? Thanks.
    >
    > Ryan Kaskel
    Ryan Kaskel, Jun 24, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    418
  2. Paul
    Replies:
    14
    Views:
    840
    Alexey Smirnov
    Jun 19, 2008
  3. Markus Arike
    Replies:
    2
    Views:
    97
    Markus Arike
    Aug 19, 2008
  4. sifar
    Replies:
    5
    Views:
    413
  5. soren625
    Replies:
    2
    Views:
    371
    soren625
    Dec 12, 2006
Loading...

Share This Page