http request doesn't work!

Ben Finney bignose-hates-spam at and-benfinney-does-too.id.au
Thu Mar 25 23:51:13 EST 2004


bart3rNOSPAM at clinicdesignNOSPAM.com.au wrote:
> Could someone please let me know what i'm doing wrong here:

Using the obsolete httplib.HTTP class.

    <http://www.python.org/doc/lib/module-httplib.html>

Try using HTTPConnection and HTTPResponse objects:

    >>> import httplib
    >>>
    >>> webhost = 'adsl.internode.on.net'
    >>> pagepath = '/htm/un-metered-sites-ip-list.htm'
    >>>
    >>> http_conn = httplib.HTTPConnection( webhost )
    >>> http_conn.request( 'GET', pagepath )
    >>>
    >>> http_resp = http_conn.getresponse()
    >>> ( http_resp.status, http_resp.reason )
    (200, 'OK')

-- 
 \      "I stayed up all night playing poker with tarot cards. I got a |
  `\               full house and four people died."  -- Steven Wright |
_o__)                                                                  |
Ben Finney <http://bignose.squidly.org/>



More information about the Python-list mailing list