Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are downloading the remote file through HTTP, you need to set the <code>Range</code> header.</p> <p>Check <a href="http://code.activestate.com/recipes/83208/" rel="nofollow noreferrer">in this example</a> how it can be done. Looks like this:</p> <pre><code>myUrlclass.addheader("Range","bytes=%s-" % (existSize)) </code></pre> <p><strong>EDIT</strong>: <a href="http://74.125.93.132/search?q=cache:1B4vbPKIz-YJ:linux.duke.edu/projects/urlgrabber/contents/urlgrabber/byterange.py+urllib+range+header&amp;cd=2&amp;hl=en&amp;ct=clnk&amp;client=firefox-a" rel="nofollow noreferrer">I just found a better implementation</a>. This class is very simple to use, as it can be seen in the docstring.</p> <pre><code>class HTTPRangeHandler(urllib2.BaseHandler): """Handler that enables HTTP Range headers. This was extremely simple. The Range header is a HTTP feature to begin with so all this class does is tell urllib2 that the "206 Partial Content" reponse from the HTTP server is what we expected. Example: import urllib2 import byterange range_handler = range.HTTPRangeHandler() opener = urllib2.build_opener(range_handler) # install it urllib2.install_opener(opener) # create Request and set Range header req = urllib2.Request('http://www.python.org/') req.header['Range'] = 'bytes=30-50' f = urllib2.urlopen(req) """ def http_error_206(self, req, fp, code, msg, hdrs): # 206 Partial Content Response r = urllib.addinfourl(fp, hdrs, req.get_full_url()) r.code = code r.msg = msg return r def http_error_416(self, req, fp, code, msg, hdrs): # HTTP's Range Not Satisfiable error raise RangeError('Requested Range Not Satisfiable') </code></pre> <p><strong>Update</strong>: The "better implementation" has moved to <a href="https://github.com/excid3/urlgrabber" rel="nofollow noreferrer">github: excid3/urlgrabber</a> in the <a href="https://github.com/excid3/urlgrabber/blob/master/byterange.py" rel="nofollow noreferrer">byterange.py</a> file.</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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