Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Urllib closes connection itself after finishing urlopen, fp.close() just closes filebuffer, which holds retrieved info:</p> <pre><code>&gt;&gt;&gt; import urllib &gt;&gt;&gt; fp = urllib.urlopen('http://www.httpbin.org/ip') &gt;&gt;&gt; fp.read() 0: '{"origin": "::ffff:92.242.181.219"}' &gt;&gt;&gt; fp.close() </code></pre> <p>There are many good http libraries:</p> <ul> <li><a href="http://docs.python-requests.org/en/latest/index.html" rel="nofollow">requests</a> - easy http-client, built around urlib2/httplib</li> <li><a href="http://www.tornadoweb.org/documentation/httpclient.html" rel="nofollow">tornado asyncclient</a> - very light and async interface, mainly to make simple REST requests.</li> <li><p><a href="http://pycurl.sourceforge.net/" rel="nofollow">pycurl</a> - fastest and most powerful networking library, supports another protocols, there also exist curls modules,which are ported to <a href="https://github.com/facebook/tornado/blob/master/tornado/curl_httpclient.py" rel="nofollow">tornado</a> and <a href="https://bitbucket.org/denis/gevent-curl" rel="nofollow">gevent</a></p></li> <li><p>i am currently building profilers for those libraries: <a href="https://bitbucket.org/timgluz/httpclient/wiki/Home" rel="nofollow">source</a> - there will be speed and memory comparison also. </p></li> </ul> <p>another choices:</p> <ul> <li><a href="http://twistedmatrix.com/documents/8.1.0/api/twisted.web.client.html" rel="nofollow">twisted webclient</a> - grownup async library</li> <li><a href="http://docs.python.org/library/urllib2.html" rel="nofollow">urllib2</a> - traditional library for opening URLs</li> <li><a href="http://docs.python.org/library/httplib.html" rel="nofollow">httplib</a> - HTTP protocol client</li> <li><a href="http://www.doughellmann.com/PyMOTW/internet_protocols.html" rel="nofollow">Doug Hellman's list of Internet and networking modules</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload