Tryag File Manager
Home
-
Turbo Force
Current Path :
/
usr
/
lib
/
python2.4
/
site-packages
/
urlgrabber
/
Upload File :
New :
File
Dir
//usr/lib/python2.4/site-packages/urlgrabber/grabber.pyc
mò ¾ôbLc�������� ���@���s��d��Z��d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�k �Z �d�k �Z �d�k�Ty!�d�e�i �d�ƒ�d�d�d�UWn �d�Z�n�Xd�k�Z�e �i�e �i�ƒ��ƒ�Z�y�d�k�l�Z�Wn�e�j �o�Z�d �„��Z�n�Xy�d �k�l�Z�Wn�e�j �o�Z�e�Z�n�Xy�d�k�l�Z�Wn�e�j �o�Z�e�Z�n�Xy/�d�k�Z�d�k�l�Z�l�Z�e�ƒ��Z�e�Z �Wn�e�j �o�Z�e!�Z �n�Xy>�d�k"�Z"�d �k"�l#�Z#�l$�Z$�l%�Z%�l&�Z&�l'�Z'�l(�Z(�l)�Z)�Wn'�e�j �o�Z�f��Z*�e�Z)�d�Z+�n&�Xe#�ƒ��e$�ƒ��e%�ƒ��e&�ƒ��f�Z*�d�Z+�d�k,�Z,�y�e,�i-�Z.�e�Z/�Wn�e0�j �o�e�Z.�e!�Z/�n�Xe�a1�d�„��Z2�d�„��Z3�e3�ƒ��d�e4�f�d�„��ƒ��YZ5�d�f��d�„��ƒ��YZ6�e�d�„�Z7�d�„��Z8�e�d�„�Z9�d�f��d�„��ƒ��YZ:�d�f��d�„��ƒ��YZ;�d�f��d�„��ƒ��YZ<�e<�ƒ��Z=�d�f��d�„��ƒ��YZ>�g��Z?�e�d �„�Z@�g��ZA�d!�„��ZB�d"�„��ZC�d#�„��ZD�d$�„��ZE�d%�„��ZF�e�d�d�e�e�e�d&�d'�d(�d)�d*�d+�d,�g�e�d-�„ �ZG�d.�„��ZH�d/�„��ZI�e�d0�„�ZJ�d1�„��ZK�d2�„��ZL�d3�„��ZM�d4�„��ZN�e�d5�j�o�eH�ƒ��eI�ƒ��eJ�d6�ƒ�n�d�S(7���s½6��A high-level cross-protocol url-grabber. GENERAL ARGUMENTS (kwargs) Where possible, the module-level default is indicated, and legal values are provided. copy_local = 0 [0|1] ignored except for file:// urls, in which case it specifies whether urlgrab should still make a copy of the file, or simply point to the existing copy. The module level default for this option is 0. close_connection = 0 [0|1] tells URLGrabber to close the connection after a file has been transfered. This is ignored unless the download happens with the http keepalive handler (keepalive=1). Otherwise, the connection is left open for further use. The module level default for this option is 0 (keepalive connections will not be closed). keepalive = 1 [0|1] specifies whether keepalive should be used for HTTP/1.1 servers that support it. The module level default for this option is 1 (keepalive is enabled). progress_obj = None a class instance that supports the following methods: po.start(filename, url, basename, length, text) # length will be None if unknown po.update(read) # read == bytes read so far po.end() text = None specifies an alternativ text item in the beginning of the progress bar line. If not given, the basename of the file is used. throttle = 1.0 a number - if it's an int, it's the bytes/second throttle limit. If it's a float, it is first multiplied by bandwidth. If throttle == 0, throttling is disabled. If None, the module-level default (which can be set on default_grabber.throttle) is used. See BANDWIDTH THROTTLING for more information. timeout = None a positive float expressing the number of seconds to wait for socket operations. If the value is None or 0.0, socket operations will block forever. Setting this option causes urlgrabber to call the settimeout method on the Socket object used for the request. See the Python documentation on settimeout for more information. http://www.python.org/doc/current/lib/socket-objects.html bandwidth = 0 the nominal max bandwidth in bytes/second. If throttle is a float and bandwidth == 0, throttling is disabled. If None, the module-level default (which can be set on default_grabber.bandwidth) is used. See BANDWIDTH THROTTLING for more information. range = None a tuple of the form (first_byte, last_byte) describing a byte range to retrieve. Either or both of the values may set to None. If first_byte is None, byte offset 0 is assumed. If last_byte is None, the last byte available is assumed. Note that the range specification is python-like in that (0,10) will yeild the first 10 bytes of the file. If set to None, no range will be used. reget = None [None|'simple'|'check_timestamp'] whether to attempt to reget a partially-downloaded file. Reget only applies to .urlgrab and (obviously) only if there is a partially downloaded file. Reget has two modes: 'simple' -- the local file will always be trusted. If there are 100 bytes in the local file, then the download will always begin 100 bytes into the requested file. 'check_timestamp' -- the timestamp of the server file will be compared to the timestamp of the local file. ONLY if the local file is newer than or the same age as the server file will reget be used. If the server file is newer, or the timestamp is not returned, the entire file will be fetched. NOTE: urlgrabber can do very little to verify that the partial file on disk is identical to the beginning of the remote file. You may want to either employ a custom "checkfunc" or simply avoid using reget in situations where corruption is a concern. user_agent = 'urlgrabber/VERSION' a string, usually of the form 'AGENT/VERSION' that is provided to HTTP servers in the User-agent header. The module level default for this option is "urlgrabber/VERSION". http_headers = None a tuple of 2-tuples, each containing a header and value. These will be used for http and https requests only. For example, you can do http_headers = (('Pragma', 'no-cache'),) ftp_headers = None this is just like http_headers, but will be used for ftp requests. proxies = None a dictionary that maps protocol schemes to proxy hosts. For example, to use a proxy server on host "foo" port 3128 for http and https URLs: proxies={ 'http' : 'http://foo:3128', 'https' : 'http://foo:3128' } note that proxy authentication information may be provided using normal URL constructs: proxies={ 'http' : 'http://user:host@foo:3128' } Lastly, if proxies is None, the default environment settings will be used. prefix = None a url prefix that will be prepended to all requested urls. For example: g = URLGrabber(prefix='http://foo.com/mirror/') g.urlgrab('some/file.txt') ## this will fetch 'http://foo.com/mirror/some/file.txt' This option exists primarily to allow identical behavior to MirrorGroup (and derived) instances. Note: a '/' will be inserted if necessary, so you cannot specify a prefix that ends with a partial file or directory name. opener = None Overrides the default urllib2.OpenerDirector provided to urllib2 when making requests. This option exists so that the urllib2 handler chain may be customized. Note that the range, reget, proxy, and keepalive features require that custom handlers be provided to urllib2 in order to function properly. If an opener option is provided, no attempt is made by urlgrabber to ensure chain integrity. You are responsible for ensuring that any extension handlers are present if said features are required. data = None Only relevant for the HTTP family (and ignored for other protocols), this allows HTTP POSTs. When the data kwarg is present (and not None), an HTTP request will automatically become a POST rather than GET. This is done by direct passthrough to urllib2. If you use this, you may also want to set the 'Content-length' and 'Content-type' headers with the http_headers option. Note that python 2.2 handles the case of these badly and if you do not use the proper case (shown here), your values will be overridden with the defaults. RETRY RELATED ARGUMENTS retry = None the number of times to retry the grab before bailing. If this is zero, it will retry forever. This was intentional... really, it was :). If this value is not supplied or is supplied but is None retrying does not occur. retrycodes = [-1,2,4,5,6,7] a sequence of errorcodes (values of e.errno) for which it should retry. See the doc on URLGrabError for more details on this. You might consider modifying a copy of the default codes rather than building yours from scratch so that if the list is extended in the future (or one code is split into two) you can still enjoy the benefits of the default list. You can do that with something like this: retrycodes = urlgrabber.grabber.URLGrabberOptions().retrycodes if 12 not in retrycodes: retrycodes.append(12) checkfunc = None a function to do additional checks. This defaults to None, which means no additional checking. The function should simply return on a successful check. It should raise URLGrabError on an unsuccessful check. Raising of any other exception will be considered immediate failure and no retries will occur. If it raises URLGrabError, the error code will determine the retry behavior. Negative error numbers are reserved for use by these passed in functions, so you can use many negative numbers for different types of failure. By default, -1 results in a retry, but this can be customized with retrycodes. If you simply pass in a function, it will be given exactly one argument: a CallbackObject instance with the .url attribute defined and either .filename (for urlgrab) or .data (for urlread). For urlgrab, .filename is the name of the local file. For urlread, .data is the actual string data. If you need other arguments passed to the callback (program state of some sort), you can do so like this: checkfunc=(function, ('arg1', 2), {'kwarg': 3}) if the downloaded file has filename /tmp/stuff, then this will result in this call (for urlgrab): function(obj, 'arg1', 2, kwarg=3) # obj.filename = '/tmp/stuff' # obj.url = 'http://foo.com/stuff' NOTE: both the "args" tuple and "kwargs" dict must be present if you use this syntax, but either (or both) can be empty. failure_callback = None The callback that gets called during retries when an attempt to fetch a file fails. The syntax for specifying the callback is identical to checkfunc, except for the attributes defined in the CallbackObject instance. The attributes for failure_callback are: exception = the raised exception url = the url we're trying to fetch tries = the number of tries so far (including this one) retry = the value of the retry option The callback is present primarily to inform the calling program of the failure, but if it raises an exception (including the one it's passed) that exception will NOT be caught and will therefore cause future retries to be aborted. The callback is called for EVERY failure, including the last one. On the last try, the callback can raise an alternate exception, but it cannot (without severe trickiness) prevent the exception from being raised. interrupt_callback = None This callback is called if KeyboardInterrupt is received at any point in the transfer. Basically, this callback can have three impacts on the fetch process based on the way it exits: 1) raise no exception: the current fetch will be aborted, but any further retries will still take place 2) raise a URLGrabError: if you're using a MirrorGroup, then this will prompt a failover to the next mirror according to the behavior of the MirrorGroup subclass. It is recommended that you raise URLGrabError with code 15, 'user abort'. If you are NOT using a MirrorGroup subclass, then this is the same as (3). 3) raise some other exception (such as KeyboardInterrupt), which will not be caught at either the grabber or mirror levels. That is, it will be raised up all the way to the caller. This callback is very similar to failure_callback. They are passed the same arguments, so you could use the same function for both. urlparser = URLParser() The URLParser class handles pre-processing of URLs, including auth-handling for user/pass encoded in http urls, file handing (that is, filenames not sent as a URL), and URL quoting. If you want to override any of this behavior, you can pass in a replacement instance. See also the 'quote' option. quote = None Whether or not to quote the path portion of a url. quote = 1 -> quote the URLs (they're not quoted yet) quote = 0 -> do not quote them (they're already quoted) quote = None -> guess what to do This option only affects proper urls like 'file:///etc/passwd'; it does not affect 'raw' filenames like '/etc/passwd'. The latter will always be quoted as they are converted to URLs. Also, only the path part of a url is quoted. If you need more fine-grained control, you should probably subclass URLParser and pass it in via the 'urlparser' option. BANDWIDTH THROTTLING urlgrabber supports throttling via two values: throttle and bandwidth Between the two, you can either specify and absolute throttle threshold or specify a theshold as a fraction of maximum available bandwidth. throttle is a number - if it's an int, it's the bytes/second throttle limit. If it's a float, it is first multiplied by bandwidth. If throttle == 0, throttling is disabled. If None, the module-level default (which can be set with set_throttle) is used. bandwidth is the nominal max bandwidth in bytes/second. If throttle is a float and bandwidth == 0, throttling is disabled. If None, the module-level default (which can be set with set_bandwidth) is used. THROTTLING EXAMPLES: Lets say you have a 100 Mbps connection. This is (about) 10^8 bits per second, or 12,500,000 Bytes per second. You have a number of throttling options: *) set_bandwidth(12500000); set_throttle(0.5) # throttle is a float This will limit urlgrab to use half of your available bandwidth. *) set_throttle(6250000) # throttle is an int This will also limit urlgrab to use half of your available bandwidth, regardless of what bandwidth is set to. *) set_throttle(6250000); set_throttle(1.0) # float Use half your bandwidth *) set_throttle(6250000); set_throttle(2.0) # float Use up to 12,500,000 Bytes per second (your nominal max bandwidth) *) set_throttle(6250000); set_throttle(0) # throttle = 0 Disable throttling - this is more efficient than a very large throttle setting. *) set_throttle(0); set_throttle(1.0) # throttle is float, bandwidth = 0 Disable throttling - this is the default when the module is loaded. SUGGESTED AUTHOR IMPLEMENTATION (THROTTLING) While this is flexible, it's not extremely obvious to the user. I suggest you implement a float throttle as a percent to make the distinction between absolute and relative throttling very explicit. Also, you may want to convert the units to something more convenient than bytes/second, such as kbps or kB/s, etc. N(���t���*s���from t���.i����s��� import __version__s���???(���t���_c���������C���s���|��S(���N(���t���st(���R���(����(����t6���/usr/lib/python2.4/site-packages/urlgrabber/grabber.pyR�����s����(���s ���HTTPException(���s���HTTPResponse(���s���HTTPHandlers���HTTPSHandler(���s���HTTPRangeHandlers���HTTPSRangeHandlers���FileRangeHandlers���FTPRangeHandlers���range_tuple_normalizes���range_tuple_to_headers ���RangeErrori���c���������C���so���|��a�t�o�t�i�d�j�o �|��t�_�n�t�o�t�i�d�j�o �|��t�_�n�t�i�d�j�o �|��t�_�n�d�S(���s��Set the DEBUG object. This is called by _init_default_logger when the environment variable URLGRABBER_DEBUG is set, but can also be called by a calling program. Basically, if the calling program uses the logging module and would like to incorporate urlgrabber logging, then it can do so this way. It's probably not necessary as most internal logging is only for debugging purposes. The passed-in object should be a logging.Logger instance. It will be pushed into the keepalive and byterange modules if they're being used. The mirror module pulls this object in on import, so you will need to manually push into it. In fact, you may find it tidier to simply push your logging object (or objects) into each of these modules independently. N(���t���DBOBJt���DEBUGt���have_keepalivet ���keepalivet���Nonet ���have_ranget ���byteranget ���sslfactory(���R���(����(����R���t ���set_loggerÀ��s������ c����������C���sT��y!t��i�d�i�d�ƒ�}�d�k�}��|��i�i�|�d�t�|�d�ƒ�ƒ�}�|�d�j��o �t �ƒ��‚�n�|��i �d�ƒ�}�t�|�ƒ�d�j�o�|�d�}�n�d�}�|�d�j�o�|��i�t�i�ƒ�}�n3�|�d�j�o�|��i�t�i�ƒ�}�n�|��i�|�ƒ�}�|�i�|�ƒ�|��i�d �ƒ�}�|�i�|�ƒ�|�i�|�ƒ�Wn"�t�t�t �f�j �o �d�}�n�Xt�|�ƒ�d�S( ���st��Examines the environment variable URLGRABBER_DEBUG and creates a logging object (logging.logger) based on the contents. It takes the form URLGRABBER_DEBUG=level,filename where "level" can be either an integer or a log level from the logging module (DEBUG, INFO, etc). If the integer is zero or less, logging will be disabled. Filename is the filename where logs will be sent. If it is "-", then stdout will be used. If the filename is empty or missing, stderr will be used. If the variable cannot be processed or the logging module cannot be imported (python < 2.3) then logging will be disabled. Here are some examples: URLGRABBER_DEBUG=1,debug.txt # log everything to debug.txt URLGRABBER_DEBUG=WARNING,- # log warning and higher to stdout URLGRABBER_DEBUG=INFO # log info and higher to stderr This funtion is called during module initialization. It is not intended to be called from outside. The only reason it is a function at all is to keep the module-level namespace tidy and to collect the code into a nice block.t���URLGRABBER_DEBUGt���,Ni����i���s���%(asctime)s %(message)st����t���-t ���urlgrabber(���t���ost���environt���splitt���dbinfot���loggingt���_levelNamest���gett���intt���levelt ���ValueErrort ���Formattert ���formattert���lent���filenamet ���StreamHandlert���syst���stderrt���handlert���stdoutt���FileHandlert���setFormattert ���getLoggerR���t ���addHandlert���setLevelt���KeyErrort���ImportErrorR ���R ���(���R���R���R ���R���R���R$���R���(����(����R���t���_init_default_loggerÙ��s.����� # � � � � t���URLGrabErrorc�����������B���s���t��Z�d��Z�RS(���sž�� URLGrabError error codes: URLGrabber error codes (0 -- 255) 0 - everything looks good (you should never see this) 1 - malformed url 2 - local file doesn't exist 3 - request for non-file local file (dir, etc) 4 - IOError on fetch 5 - OSError on fetch 6 - no content length header when we expected one 7 - HTTPException 8 - Exceeded read limit (for urlread) 9 - Requested byte range not satisfiable. 10 - Byte range requested, but range support unavailable 11 - Illegal reget mode 12 - Socket timeout 13 - malformed proxy url 14 - HTTPError (includes .code and .exception attributes) 15 - user abort MirrorGroup error codes (256 -- 511) 256 - No more mirrors left to try Custom (non-builtin) classes derived from MirrorGroup (512 -- 767) [ this range reserved for application-specific error codes ] Retry codes (< 0) -1 - retry the download, unknown reason Note: to test which group a code is in, you can simply do integer division by 256: e.errno / 256 Negative codes are reserved for use by functions passed in to retrygrab with checkfunc. The value -1 is built in as a generic retry code and is already included in the retrycodes list. Therefore, you can create a custom check function that simply returns -1 and the fetch will be re-tried. For more customized retries, you can use other negative number and include them in retry-codes. This is nice for outputting useful messages about what failed. You can use these error codes like so: try: urlgrab(url) except URLGrabError, e: if e.errno == 3: ... # or print e.strerror # or simply print e #### print '[Errno %i] %s' % (e.errno, e.strerror) (���t���__name__t ���__module__t���__doc__(����(����(����R���R.��� ��s���3t���CallbackObjectc�����������B���s���t��Z�d��Z�d�„��Z�RS(���sÜ��Container for returned callback data. This is currently a dummy class into which urlgrabber can stuff information for passing to callbacks. This way, the prototype for all callbacks is the same, regardless of the data that will be passed back. Any function that accepts a callback function as an argument SHOULD document what it will define in this object. It is possible that this class will have some greater functionality in the future. c���������K���s���|��i�i�|�ƒ�d��S(���N(���t���selft���__dict__t���updatet���kwargs(���R3���R6���(����(����R���t���__init__O��s����(���R/���R0���R1���R7���(����(����(����R���R2���C��s����c���������K���s���t��i�|��|�|��S(���sJ��grab the file at <url> and make a local copy at <filename> If filename is none, the basename of the url is used. urlgrab returns the filename of the local file, which may be different from the passed-in filename if the copy_local kwarg == 0. See module documentation for a description of possible kwargs. N(���t���default_grabbert���urlgrabt���urlR ���R6���(���R:���R ���R6���(����(����R���R9���R��s�����c���������K���s���t��i�|��|��S(���s0��open the url and return a file object If a progress object or throttle specifications exist, then a special file object will be returned that supports them. The file object can be treated like any other file object. See module documentation for a description of possible kwargs. N(���R8���t���urlopenR:���R6���(���R:���R6���(����(����R���R;���\��s�����c���������K���s���t��i�|��|�|��S(���s`��read the url into a string, up to 'limit' bytes If the limit is exceeded, an exception will be thrown. Note that urlread is NOT intended to be used as a way of saying "I want the first N bytes" but rather 'read the whole file into memory, but don't use too much' See module documentation for a description of possible kwargs. N(���R8���t���urlreadR:���t���limitR6���(���R:���R=���R6���(����(����R���R<���f��s�����t ���URLParserc�����������B���sA���t��Z�d��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�d�Z�d�„��Z�RS(���sG��Process the URLs before passing them to urllib2. This class does several things: * add any prefix * translate a "raw" file to a proper file: url * handle any http or https auth that's encoded within the url * quote the url Only the "parse" method is called directly, and it calls sub-methods. An instance of this class is held in the options object, which means that it's easy to change the behavior by sub-classing and passing the replacement in. It need only have a method like: url, parts = urlparser.parse(url, opts) c���������C���sJ��|�i�}�|�i�o�|��i�|�|�i�ƒ�}�n�t�i�|�ƒ�}�|�\�} �}�}�} �}�}�| �p#�t�| �ƒ�d�j�oc�| �t�i�j�oS�|�d�d�j�o�t�i �i�|�ƒ�}�n�d�t�i�|�ƒ�}�t�i�|�ƒ�}�d�}�n�| �d�d�g�j�o�|��i�|�ƒ�}�n�|�d�j�o�|��i�|�ƒ�}�n�|�o�|��i�|�ƒ�}�n�t�i�|�ƒ�}�|�|�f�S(���sˆ��parse the url and return the (modified) url and its parts Note: a raw file WILL be quoted when it's converted to a URL. However, other urls (ones which come with a proper scheme) may or may not be quoted according to opts.quote opts.quote = 1 --> quote it opts.quote = 0 --> do not quote it opts.quote = None --> guess i���i����s���/\s���file:t���httpt���httpsN(���t���optst���quotet���prefixR3���t ���add_prefixR:���t���urlparset���partst���schemet���hostt���patht���parmt���queryt���fragR���t���stringt���lettersR���t���abspatht���urllibt���pathname2urlt���process_httpR ���t���guess_should_quotet ���urlunparse(���R3���R:���RA���RL���RB���RH���RF���RK���RI���RG���RJ���(����(����R���t���parse„��s(���� � +� c���������C���sB���|�d�d�j�p�|�d�d�j�o�|�|�}�n�|�d�|�}�|�S(���Niÿÿÿÿt���/i����(���RC���R:���(���R3���R:���RC���(����(����R���RD���©��s����"c���������C���s��|�\�} �}�} �}�}�}�d�|�j�oÓ�t�oÌ�yc�|�i�d�d�ƒ�\�}�}�d�|�j�o:�|�i�d�d�ƒ�\�}�}�t�i �|�ƒ�}�t�i �|�ƒ�}�n�Wn.�t�j �o"�}�t�d�t�d�ƒ�t�ƒ�‚�n�Xt�o�t�i�d�|�|�ƒ�n�t�i�d��|�|�|�ƒ�n�| �|�| �|�|�|�f�S(���Nt���@i���t���:s���Bad URL: %ss���adding HTTP auth: %s, %s(���RF���RG���RH���RI���RJ���RK���RL���t���auth_handlerR���t ���user_passt���usert���passwordRP���t���unquoteR���t���eR.���R���R:���R���t���infot���add_passwordR ���(���R3���RF���RL���R\���R^���RH���R[���RZ���RK���RI���RG���RJ���(����(����R���RR���°��s���� �c���������C���s=���|�\�}�}�}�}�}�}�t�i�|�ƒ�}�|�|�|�|�|�|�f�S(���s ��quote the URL This method quotes ONLY the path part. If you need to quote other parts, you should override this and pass in your derived class. The other alternative is to quote other parts before passing into urlgrabber. N( ���RF���RG���RH���RI���RJ���RK���RL���RP���RB���(���R3���RF���RL���RH���RK���RI���RG���RJ���(����(����R���RB���Á��s�����t���0123456789ABCDEFc��� ������C���sð���|�\�}�}�}�} �}�}�d�|�j�o�d�Sn�t�i�|�d�ƒ�}�|�d�j�o �x•�|�d�j�o‡�t �|�ƒ�|�d�j��o�d�Sn�|�|�d�|�d�!i�ƒ��}�|�d�|��i�j�p�|�d�|��i�j�o�d�Sn�t�i�|�d�|�d�ƒ�}�qO�Wd�Sn�d�S(���sÛ��� Guess whether we should quote a path. This amounts to guessing whether it's already quoted. find ' ' -> 1 find '%' -> 1 find '%XX' -> 0 else -> 1 t��� i���t���%iÿÿÿÿi���i����N(���RF���RG���RH���RI���RJ���RK���RL���RM���t���findt���indR���t���uppert���codeR3���t���hexvals( ���R3���RF���RL���Rg���RH���RK���Re���RI���RG���RJ���(����(����R���RS���Î��s ���� � � (( ���R/���R0���R1���RU���RD���RR���RB���Rh���RS���(����(����(����R���R>���q��s���� % t���URLGrabberOptionsc�����������B���sG���t��Z�d��Z�e�d�„�Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z �RS(���s���Class to ease kwargs handling.c���������K���s5���|�|��_��|�d�j�o�|��i�ƒ��n�|��i�|���d�S(���s���Initialize URLGrabberOptions object. Set default values for all options and then update options specified in kwargs. N(���t���delegateR3���R ���t ���_set_defaultst���_set_attributesR6���(���R3���Rj���R6���(����(����R���R7���ë��s ����� c���������C���s>���|��i�o'�t�|��i�|�ƒ�o�t�|��i�|�ƒ�Sn�t�|�‚�d��S(���N(���R3���Rj���t���hasattrt���namet���getattrt���AttributeError(���R3���Rn���(����(����R���t���__getattr__õ��s����c���������C���sW���|��i�d�j�o�d�Sn<�t�|��i�ƒ�t�d�ƒ�j�o�t�|��i�ƒ�Sn�|��i�|��i�Sd�S(���sR���Calculate raw throttle value from throttle and bandwidth values. i����N(���R3���t���throttlet���typet���floatt ���bandwidth(���R3���(����(����R���t���raw_throttleú��s�����c���������K���s���t��d�|��|��S(���s—���Create a derived URLGrabberOptions instance. This method creates a new instance and overrides the options specified in kwargs. Rj���N(���Ri���R3���R6���(���R3���R6���(����(����R���t���derive��s�����c���������K���s}���|��i�i�|�ƒ�t�o&�|�i�d�ƒ�o�t�|��i�ƒ�|��_�n�|��i�d�d�d�g�j�o#�t �d�t�d�ƒ�|��i�f�ƒ�‚�n�d�S(���s7���Update object attributes with those provided in kwargs.t���ranget���simplet���check_timestampi���s���Illegal reget mode: %sN(���R3���R4���R5���R6���R ���t���has_keyt���range_tuple_normalizeRx���t���regetR ���R.���R���(���R3���R6���(����(����R���Rl�����s�����c���������C���s��d�|��_�d�|��_�d�|��_�d�|��_�d�d�d�d�d�d�g�|��_�d�|��_�d�|��_�d�|��_ �d�|��_ �d �t�|��_�d �|��_ �d�|��_�d�|��_�d�|��_�d�|��_�d�|��_�d�|��_�t�|��_�d�|��_�d�|��_�d�|��_�d�|��_�d�|��_�t�ƒ��|��_�d�|��_�d�|��_�d�|��_�d�S(���s���Set all options to their default values. When adding new options, make sure a default is provided here. f1.0i����iÿÿÿÿi���i���i���i���i���s ���urlgrabber/%si���N( ���R ���R3���t���progress_objRr���Ru���t���retryt ���retrycodest ���checkfunct ���copy_localt���close_connectionRx���t���__version__t ���user_agentR���t���proxiesR}���t���failure_callbackt���interrupt_callbackRC���t���openert���Truet ���cache_openerst���timeoutt���textt���http_headerst���ftp_headerst���dataR>���t ���urlparserRB���t���ssl_ca_certt���ssl_context(���R3���(����(����R���Rk�����s8����� ( ���R/���R0���R1���R ���R7���Rq���Rv���Rw���Rl���Rk���(����(����(����R���Ri���è��s���� t ���URLGrabberc�����������B���sJ���t��Z�d��Z�d�„��Z�d�„��Z�d�„��Z�e�d�„�Z�e�d�„�Z�d�„��Z �RS(���s��Provides easy opening of URLs with a variety of options. All options are specified as kwargs. Options may be specified when the class is created and may be overridden on a per request basis. New objects inherit default values from default_grabber. c���������K���s���t��|���|��_�d��S(���N(���Ri���R6���R3���RA���(���R3���R6���(����(����R���R7���@��s����c������ ���G���s÷��d�} �xê| �d�} �d��}�d��} �d��} �t�o!�t�i�d�| �|�i�|�d�ƒ�n�y9�t �|�|�f�|�h��ƒ�}�t�o�t�i�d�ƒ�n�|�SWnP�t �j �o!�}�|�}�|�i�} �|�i�} �n%�t�j �o�}�|�}�|�i�} �n�Xt�o�t�i�d�|�ƒ�n�| �oo�t�o�t�i�d�| �ƒ�n�|��i�| �ƒ�\�}�}�}�t�d�|�d�|�d�d �| �d �|�i�ƒ�}�|�|�|�|�Ž�n�|�i�d��j�p�| �|�i�j�o�t�o�t�i�d�ƒ�n�‚��n�| �d��j �o8�| �|�i�j�o(�t�o�t�i�d�| �|�i�ƒ�n�‚��q �q �Wd��S( ���Ni����i���s���attempt %i/%s: %st���successs ���exception: %ss���calling callback: %st ���exceptionR:���t���triesR���s���retries exceeded, re-raisings)���retrycode (%i) not in list %s, re-raising(���R—���R ���R–���t ���retrycodet���callbackR���R_���RA���R���t���argst���applyt���funct���rR.���R^���R‡���t���errnot���KeyboardInterruptRˆ���R3���t���_make_callbackt���cb_funct���cb_argst ���cb_kwargsR2���t���objR€���(���R3���RA���Rœ���Rš���R–���R¡���R^���R¤���R£���R™���R—���R���R¢���R˜���(����(����R���t���_retryC��sP������ � � �� �� c���������K���sI���|��i�i�|���}�|�i�i�|�|�ƒ�\�}�}�d�„��}�|��i �|�|�|�ƒ�S(���s��open the url and return a file object If a progress object or throttle value specified when this object was created, then a special file object will be returned that supports them. The file object can be treated like any other file object. c���������C���s���t��|�d�d��d�|��ƒS(���NR ���RA���(���t���URLGrabberFileObjectR:���R ���RA���(���RA���R:���(����(����R���t ���retryfunc{��s����N( ���R3���RA���Rw���R6���R‘���RU���R:���RF���R§���R¥���(���R3���R:���R6���RF���R§���RA���(����(����R���R;���r��s ����� c��� ���������s[��ˆ��i�i�|���}�|�i�i�|�|�ƒ�\�}�}�|�\�} �}�}�} �}�}�|�d�j�o�t�i �i�t�i�|�ƒ�ƒ�}�n�| �d�j�o»�|�i�o°�t�i�|�ƒ�}�|�o�t�i �i�d�|�|�ƒ�}�n�t�i �i�|�ƒ�p �t�d�t�d�ƒ�|�f�ƒ�‚�q9t�i �i�|�ƒ�p �t�d�t�d�ƒ�|�f�ƒ�‚�q9|�i�p�|�Sq9n�‡��d�†��}�ˆ��i�|�|�|�|�ƒ�S( ���s ��grab the file at <url> and make a local copy at <filename> If filename is none, the basename of the url is used. urlgrab returns the filename of the local file, which may be different from the passed-in filename if copy_local == 0. t���files���//i���s���Local file does not exist: %si���s���Not a normal file: %sc������������s“���t��|�|�|��ƒ�}�zo�|�i�ƒ��|��i�d��j �oQ�ˆ��i �|��i�ƒ�\�}�}�}�t �ƒ��}�|�|�_�|�|�_�t�|�|�f�|�|�ƒ�n�Wd��|�i�ƒ��X|�S(���N(���R¦���R:���R ���RA���t���fot���_do_grabR���R ���R3���R ���R¡���R¢���R£���R2���R¤���R›���t���close(���RA���R:���R ���R¤���R£���R¡���R¢���R©���(���R3���(����R���R§���™��s���� �N(���R3���RA���Rw���R6���R‘���RU���R:���RF���RG���RH���RI���RJ���RK���RL���R ���R ���R���t���basenameRP���R]���R‚���t���url2pathnamet���normpatht���existsR.���R���t���isfileRx���R§���R¥���( ���R3���R:���R ���R6���RL���RH���RF���RK���RI���RG���RJ���RA���R§���(����(���R3���R���R9�����s(����� c������������s���ˆ��i�i�|���}�|�i�i�|�|�ƒ�\�}�}�|�d�j �o�|�d�}�n�‡��d�†��}�ˆ��i�|�|�|�|�ƒ�}�|�o6�t �|�ƒ�|�j�o#�t�d�t�d�ƒ�|�|�f�ƒ�‚�n�|�S(���s2��read the url into a string, up to 'limit' bytes If the limit is exceeded, an exception will be thrown. Note that urlread is NOT intended to be used as a way of saying "I want the first N bytes" but rather 'read the whole file into memory, but don't use too much' i���c��� ���������sÁ���t��|�d�d��d�|��ƒ}�d�}�z‘�|�d��j�o�|�i�ƒ��}�n�|�i�|�ƒ�}�|��i�d��j �oQ�ˆ��i �|��i�ƒ�\�}�}�}�t�ƒ��}�|�|�_�|�|�_�t�|�|�f�|�|�ƒ�n�Wd��|�i�ƒ��X|�S(���NR ���RA���R���(���R¦���R:���R ���RA���R©���t���sR=���t���readR���R3���R ���R¡���R¢���R£���R2���R¤���R���R›���R«���( ���RA���R:���R=���R¤���R£���R±���R¡���R¢���R©���(���R3���(����R���R§���¶��s���� � �i���s���Exceeded limit (%i): %sN(���R3���RA���Rw���R6���R‘���RU���R:���RF���R=���R ���R§���R¥���R±���R���R.���R���(���R3���R:���R=���R6���R±���RF���R§���RA���(����(���R3���R���R<���ª��s����� c���������C���s&���t��|�ƒ�o�|�f��h��f�Sn�|�Sd��S(���N(���t���callablet���callback_obj(���R3���R´���(����(����R���R ���Ò��s���� ( ���R/���R0���R1���R7���R¥���R;���R ���R9���R<���R ���(����(����(����R���R”���7��s���� / +(R¦���c�����������B���sƒ���t��Z�d��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z �d�„��Z �e�d �„�Z�e�d �„�Z �d�d�„�Z�d �„��Z�RS(���s¯��This is a file-object wrapper that supports progress objects and throttling. This exists to solve the following problem: lets say you want to drop-in replace a normal open with urlopen. You want to use a progress meter and/or throttling, but how do you do that without rewriting your code? Answer: urlopen will return a wrapped file object that does the progress meter and-or throttling internally. c���������C���sr���|�|��_��|�|��_�|�|��_�d��|��_�d�|��_�d�d�|��_�t�i�ƒ��|��_ �d�|��_ �d�|��_�d��|��_�|��i �ƒ��d��S(���NR���i���i���i����(���R:���R3���R ���RA���R ���R©���t���_rbuft ���_rbufsizet���timet���_ttimet���_tsizet���_amount_readt���_openert���_do_open(���R3���R:���R ���RA���(����(����R���R7���ç��s���� c���������C���s4���t��|��i�|�ƒ�o�t�|��i�|�ƒ�Sn�t�|�‚�d�S(���s«���This effectively allows us to wrap at the instance level. Any attribute not found in _this_ object will be searched for in self.fo. This includes methods.N(���Rm���R3���R©���Rn���Ro���Rp���(���R3���Rn���(����(����R���Rq���ô��s�����c���������C���s„��|��i�i�o�|��i�i�Snc|��i�d�j�oRg��}�t�o �|��i�i�}�t �o�|��i�i �p �|��i�i�}�|��i�i �oY�|�i�t�|��i�i �ƒ�ƒ�|�p�|�i�t�i�ƒ��ƒ�n�|�p�|�i�t�i�ƒ��ƒ�qÊ�n�t�i�|��i�i�|��i�i�ƒ�}�|�o$�|�i�t�ƒ�|�i�t�|�ƒ�ƒ�n�|�o�|�i�t �ƒ�n�|�i�t�ƒ�|��i�i�o�t�|�|�Œ�|��_�n�|�i�|�Œ��|��_�g��|��i�_�n�|��i�S(���s8���Build a urllib2 OpenerDirector based on request options.N( ���R3���RA���R‰���R»���R ���t���handlersR���R���t���need_keepalive_handlert���range_handlersRx���R}���t���need_range_handlerR†���t���appendt���CachedProxyHandlert���urllib2t���HTTPHandlert ���FTPHandlerR���t���get_factoryR’���R“���t���ssl_factoryt���keepalive_http_handlert���HTTPSHandlert���extendRY���R‹���t���CachedOpenerDirectort ���create_openert ���addheaders(���R3���R½���R¾���RÀ���RÇ���(����(����R���t���_get_openerü��s4����� c������ ������sê��ˆ��i�ƒ��}�t�i�ˆ��i�ˆ��i�i�ƒ�‰�ˆ��i �ˆ�ƒ�ˆ��i �ˆ�ƒ�‡��‡�d�†��}�ˆ��i�ˆ�|�ƒ�\�} �}�d�}�ˆ��i�ox�ˆ��i�i�d�j�oe�d�}�y<�|�i�d�ƒ�}�t�i�|�ƒ�}�|�ˆ��i�j�o �d�}�n�Wqð�t�f�j �o �d�}�qð�Xn�|�| �ƒ�o(�d�}�d��ˆ��i�_�d�ˆ��_�d�ˆ��_�n�t�og�|�o\�| �i�ƒ��| �i�ƒ��d��ˆ��i�_�ˆ�i�d�=ˆ��i �ˆ�ƒ�d�ˆ��_�ˆ��i�ˆ�|�ƒ�\�} �}�q“n�t�i�ˆ��i�ƒ�\�}�}�} �}�}�}�t&�i'�| �ƒ�} �ˆ��i�i(�p�ˆ��i�i)�ƒ��p �ˆ��i�i*�p0�| �i+�ˆ��_+�t,�| �d�ƒ�o�| �i-�ˆ��_-�qÓn´�ˆ��i�i(�o¦�y!�t.�|�d�ƒ�} �| �ˆ��i�} �Wn"�t0�t1�t�f�j �o �d��} �n�Xˆ��i�i(�i2�t3�ˆ��i4�ƒ�t&�i'�ˆ��i�ƒ�t5�i"�i6�| �ƒ�| �d �ˆ��i�i7�ƒˆ��i�i(�i8�d�ƒ�n�| �|�ˆ��_ �ˆ��_�d��S( ���Nc������������sX���ˆ��i�i�d��j�o�t�Sn�d�ˆ�i�j�o�t�Sn�t�|��t �ƒ�p�t�Sn�|��i �d�j�S(���Nt���RangeiÎ���(���R3���RA���R}���R ���t���Falset���reqt���headerst ���isinstanceR©���t���HTTPResponseRg���(���R©���(���R3���RÑ���(����R���t ���_checkNoReget9��s����i����Rz���s ���last-modifiedi���RÏ���t���readlines���Content-LengthR���(9���R3���RÎ���R‰���RÃ���t���RequestR:���RA���R���RÑ���t���_add_headerst���_build_rangeRÕ���t ���_make_requestR©���t���hdrt���fetch_againt ���reget_timeR}���t ���getdate_tzt���modified_tuplet���rfc822t ���mktime_tzt���modified_stampt ���TypeErrorR ���RÁ���Rº���RŠ���R«���Rƒ���RÒ���RE���RG���RH���RI���RJ���RK���RL���RP���R]���R~���Rv���RŒ���R²���Rm���RÖ���R���t���lengthR+���R���t���startt���strR ���R���R¬���R���R5���(���R3���Râ���RK���RÑ���R‰���RG���RL���RJ���RH���RI���R©���RÕ���RÛ���Rä���Rß���RÜ���(����(���R3���RÑ���R���R¼���2��s`���� � $* c���������C���sí���|��i�i�o�|�i�d�|��i�i�ƒ�n�y�|�i�ƒ��}�Wn�t�j �o �d��}�n�X|��i�i �o>�|�d�j�o1�x.�|��i�i �D]�\�}�}�|�i�|�|�ƒ�qz�Wn�|��i�i�o>�|�d�j�o1�x.�|��i�i�D]�\�}�}�|�i�|�|�ƒ�qÅ�Wn�d��S(���Ns ���User-agentR?���R@���t���ftp(���s���https���https( ���R3���RA���R…���RÑ���t ���add_headert���get_typet���req_typeR���R ���RŽ���t���ht���vR���(���R3���RÑ���Rì���Rë���Rê���(����(����R���RØ���€��s���� �� � �c���������C���sJ��d��|��_�d�|��_�d�}�d��}�t�o‹�|��i�i�o~�t �|��i �ƒ�t�i�j�oe�y�t �i�|��i �ƒ�}�Wn�t�j �o�q°�X|�t�|��_�|�t�}�|�|��_�|�d�f�}�d�|��_�n�|��i�i�oW�t�p�t�d�t�d�ƒ�ƒ�‚�n�|��i�i�}�|�d�o�|�d�|�|�d�f�}�qn�|�o+�t�|�ƒ�}�|�o�|�i�d�|�ƒ�qFn�d��S(���Ni����R���i���i ���s2���Byte range requested but range support unavailableRÏ���(���R ���R3���RÝ���RÁ���t���reget_lengtht���rtR ���RA���R}���Rs���R ���t���typest���StringTypesR���t���statR±���t���OSErrort���ST_MTIMEt���ST_SIZERº���Rx���R.���R���t���range_tuple_to_headert���headerRÑ���Rè���(���R3���RÑ���Rî���Rí���Rö���R±���(����(����R���RÙ���Œ��s0���� - � �c���������C���s��yz�t��oT�|��i�i�oG�t�i�ƒ��}�t�i�|��i�i�ƒ�z�|�i �|�ƒ�}�Wd��t�i�|�ƒ�Xn�|�i �|�ƒ�}�|�i�ƒ��}�Wn„t�j �o%�}�t�d�t�d�ƒ�|�f�ƒ�‚�n_t�j �o�}�t�d�t�|�ƒ�ƒ�‚�n6t�i�j �o9�}�t�d�t�|�ƒ�ƒ�}�|�i�|�_�|�|�_�|�‚�nï�t�j �oo�}�t�|�d�ƒ�o:�t��o3�t�|�i�t�ƒ�o �t�d�t�d�ƒ�|�f�ƒ�‚�qt�d�t�d �ƒ�|�f�ƒ�‚�nu�t�j �o%�}�t�d �t�d�ƒ�|�f�ƒ�‚�nE�t�j �o.�}�t�d�t�d �ƒ�|�i �i!�|�f�ƒ�‚�n�X|�|�f�Sd��S(���Ni���s���Bad URL: %si ���i���t���reasoni���s���Timeout: %si���s���IOError: %si���s���OSError: %si���s���HTTP Exception (%s): %s("���t���have_socket_timeoutR3���RA���RŒ���t���sockett���getdefaulttimeoutt���old_tot���setdefaulttimeoutR‰���t���openRÑ���R©���R_���RÛ���R���R^���R.���R���t ���RangeErrorRæ���RÃ���t ���HTTPErrort���new_eRg���R–���t���IOErrorRm���RÓ���R÷���t���TimeoutErrorRò���t ���HTTPExceptiont ���__class__R/���(���R3���RÑ���R‰���R©���Rû���RÛ���R^���R���(����(����R���RÚ���¬��s8����� * *c���������C���s‰��|��i�o�t�|��i�d�ƒ�}�n�t�|��i�d�ƒ�}�y �|��i�i�\�}�}�|�|�}�Wn�t �j �o�} �d�}�n�Xd�d�}�d�}�|�d�j �o�t�|�|�|�ƒ�}�n�|��i�|�ƒ�} �|�t�| �ƒ�}�x\�| �oT�|�i�| �ƒ�|�d�j �o�t�|�|�|�ƒ�}�n�|��i�|�ƒ�} �|�t�| �ƒ�}�qÆ�W|�i�ƒ��y>�|��i�i�d�ƒ�}�t�i�|�ƒ�}�t�i�|��i�|�|�f�ƒ�Wn�t �f�j �o �}�n�X|�S(���s���dump the file to self.filename.t���abt���wbi���i���i����s ���last-modifiedN(���R3���RÁ���Rý���R ���t���new_foRA���Rx���t���lowt���hight���amountRã���R���R ���t���bst���sizet���minR²���t���blockR���t���writeR«���RÛ���RÞ���Rß���Rà���Rá���Râ���R���t���utimeR^���(���R3���R^���Rß���R ��R ��Râ���R��R��R��R���R��R��(����(����R���Rª���Ï��s<����� � �� � �c��� ������C���s^��|��i�o?�|�d�j �o2�t�|��i�ƒ�}�|�|�j�o�|�|�}�qI�d�Sn�|��i�g�} �t�|��i�ƒ�}�xÞ|�d�j�p�|�oÉ|��i�i �ƒ��oX�|��i �|��i�i �ƒ��t�i�ƒ��|��i�}�|�d�j�o�t�i�|�ƒ�n�t�i�ƒ��|��_�n�|�d�j�o �|��i�}�n�t�|�|��i�ƒ�}�y�|��i�i�|�ƒ�}�Wn”�t�i�j �o%�}�t�d�t�d�ƒ�|�f�ƒ�‚�nb�t�j �o%�}�t�d�t�d�ƒ�|�f�ƒ�‚�n2�t�j �o%�}�t�d�t�d�ƒ�|�f�ƒ�‚�n�Xt�|�ƒ�}�|�p�Pn�|�o�|�|�}�n�| �i�|�ƒ�|�|�}�|�|��_ �|��i�|�|��_�|��i�i�o�|��i�i�i �|��i�ƒ�qg�qg�Wt!�i"�| �d�ƒ�|��_�d�S( ���s��fill the buffer to contain at least 'amt' bytes by reading from the underlying file object. If amt is None, then it will read until it gets nothing more. It updates the progress meter and throttles after every self._rbufsize bytes.Ni����i���s���Socket Error: %si���s���Timeout: %ss���IOError: %sR���(#���R3���Rµ���t���amtR ���R���t���Lt���buft���bufsizeRA���Rv���R¹���R·���R¸���t���difft���sleepR¶���t ���readamountR ��R©���R²���t���newRù���t���errorR^���R.���R���R��R��t���newsizeRÁ���Rº���R~���R5���RM���t���join( ���R3���R��R��R^���R��R��R��R��R��R��(����(����R���t���_fill_bufferî��sN����� �' � � !�� c���������C���sS���|��i�|�ƒ�|�d��j�o�|��i�d�}�|��_�n�|��i�|� |��i�|�}�|��_�|�S(���NR���(���R3���R��R��R ���Rµ���R±���(���R3���R��R±���(����(����R���R²���"��s ���� iÿÿÿÿc���������C���s%��t��i�|��i�d�ƒ�}�x�|�d�j��o‚�d�|�j��o�t�|��i�ƒ�j�n�oZ�t�|��i�ƒ�}�|��i�|�|��i �ƒ�t�|��i�ƒ�|�j�p�Pn�t��i�|��i�d�|�ƒ�}�q�W|�d�j��o�t�|��i�ƒ�}�n�|�d�}�d�|�j�o�t�|��i�ƒ�j��n�o �|�}�n�|��i�|� |��i�|�}�|��_�|�S(���Ns��� i����i���(���RM���Rd���R3���Rµ���t���iR=���R���R��R��R¶���R±���(���R3���R=���R��R��R±���(����(����R���RÖ���*��s�����5� � '� c���������C���sd���|��i�i�o�|��i�i�i�|��i�ƒ�n�|��i�i�ƒ��|��i�i�o�y�|��i�i�ƒ��Wq`�q`�Xn�d��S(���N(���R3���RA���R~���t���endRº���R©���R«���Rƒ���(���R3���(����(����R���R«���9��s���� ��(���R/���R0���R1���R7���Rq���RÎ���R¼���RØ���RÙ���RÚ���Rª���R ���R��R²���RÖ���R«���(����(����(����R���R¦���Ü��s��� � 6 N # 4c���������G���sŠ���xJ�t��D]B�\�}�}�|�|�j�o)�x�|�i�D]�}�|�i�|�ƒ�q*�W|�Sq�q�W|��p�t�i�ƒ��}��n�|��i �|�Œ��}�t��i �|�|�f�ƒ�|�S(���N(���t���_handler_cachet���cached_handlersR‰���R½���R$���t ���add_parentRÇ���R���RÆ���RÌ���RÁ���(���RÇ���R½���R$���R‰���R ��(����(����R���RË���B��s����� �c��� ������C���s��xü�t��D]9�\�}�}�|�|��j�o �t�o�t�i�d�|��ƒ�n�Pq�q�Wx{�|��i�ƒ��D]m�\�}�}�t �i �|�ƒ�\�}�}�t �i �|�ƒ�\�}�}�|�d��j�p �|�d��j�o�t�d�t�d�ƒ�|�ƒ�‚�qQ�qQ�Wt�o�t�i�d�|��ƒ�n�t�i�|��ƒ�}�t��i�|��|�f�ƒ�|�S(���Ns���re-using proxy settings: %si ���s���Bad proxy URL: %ss���creating new proxy handler: %s(���t���_proxy_cachet���pdictR$���R†���R���t���debugt���itemst���kRì���RP���t ���splittypet���utypeR:���t ���splithostRH���t���otherR ���R.���R���R_���RÃ���t���ProxyHandlerRÁ���( ���R†���R#��R(��R&��R:���RH���R$���Rì���R*��(����(����R���RÂ���O��s"����� � �!�c���������C���s ���|��t�_�d�S(���s8���Deprecated. Use: default_grabber.throttle = new_throttleN(���t���new_throttleR8���Rr���(���R,��(����(����R���t���set_throttleb��s�����c���������C���s ���|��t�_�d�S(���s:���Deprecated. Use: default_grabber.bandwidth = new_bandwidthN(���t ���new_bandwidthR8���Ru���(���R.��(����(����R���t ���set_bandwidthf��s�����c���������C���s ���|��t�_�d�S(���s@���Deprecated. Use: default_grabber.progress_obj = new_progress_objN(���t���new_progress_objR8���R~���(���R0��(����(����R���t���set_progress_objj��s�����c���������C���s ���|��t�_�d�S(���s<���Deprecated. Use: default_grabber.user_agent = new_user_agentN(���t���new_user_agentR8���R…���(���R2��(����(����R���t���set_user_agentn��s�����i���iÿÿÿÿi���i���i���i���i���c ���������C���s^���h��d�|�<d�|�<d�|�<d�|�<d�|�<d�|�<d�|�<d�| �<} �t �|��|�| ��S( ���s5���Deprecated. Use: urlgrab() with the retry arg insteadR‚���Rƒ���R~���Rr���Ru���R���R€���R���N(���R‚���Rƒ���R~���Rr���Ru���t���numtriesR€���R���R6���R9���R:���R ���(���R:���R ���R‚���Rƒ���R~���Rr���Ru���R4��R€���R���R6���(����(����R���t ���retrygrabr��s�����N c���� ������C���sI��d��k��}�y�|�i�d�d�!\�}�}�Wn1�t�j �o%�d�G|�i�d�Gd�GH|�i�ƒ��n�Xh��}�x@�|�i�d�D]1�}��t�i �|��d�d�ƒ�\�}�}�t�|�ƒ�|�|�<qk�Wt �d�ƒ�t�d�d �ƒ�d �t�i�t�i�f�GHy�d�k�l�}�Wn�t�j �o �}�n�X|�ƒ��|�d�<y�t�t�|�|�f�|�ƒ�} �Wn�t�j �o�}�|�GHn�Xd �G| �GHd��S(���Ni���i���s���usage:i����s8���<url> <filename> [copy_local=0|1] [close_connection=0|1]t���=f1.0i ���i���s)���throttle: %s, throttle bandwidth: %s B/s(���s���text_progress_meterR~���s���LOCAL FILE:(���R"���t���argvR:���R ���R���t���exitR6���t���aRM���R���R&��Rì���R���R-��R/��R8���Rr���Ru���t���progresst���text_progress_meterR,���R^���R›���R9���Rn���R.���( ���R9��R^���R:���R&��Rì���R ���R"���R;��R6���Rn���(����(����R���t ���_main_test„��s0���� �� �� �� c����������C���sD��d��k��}�y�|�i�d�d�!\�}�}�Wn1�t�j �o%�d�G|�i�d�Gd�GH|�i�ƒ��n�Xh��}�x@�|�i�d�D]1�}��t�i �|��d�d�ƒ�\�}�}�t�|�ƒ�|�|�<qk�Wy�d�k �l�}�Wn�t�j �o �}�n�X|�ƒ��|�d�<d �d �„�} �| �d�h��d�d�<f�|�d �<y�t�t�|�|�f�|�ƒ�} �Wn�t�j �o�}�|�GHn�Xd�G| �GHd��S(���Ni���i���s���usage:i����s8���<url> <filename> [copy_local=0|1] [close_connection=0|1]R6��(���s���text_progress_meterR~���t���fooc���������C���sq���|�G|�GHd��k�}�|�i�ƒ��}�|�d�j��o�d�GHt�d�d�ƒ�‚�n�|�d�j��o�d�GHt�d�d�ƒ�‚�n�d�GHd��S( ���Nf0.5s ���forcing retryiÿÿÿÿf0.75s���forcing failureiþÿÿÿs���forcing immediate failureR•���(���t���hellot���theret���randomt���rnumR.���(���R ���R>��R?��R@��RA��(����(����R���t���cfunc°��s���� R>��R?��R���s���LOCAL FILE:(���s���hello(���R"���R7��R:���R ���R���R8��R6���R9��RM���R���R&��Rì���R���R:��R;��R,���R^���RB��R›���R5��Rn���R.���(���R9��R^���R:���R&��Rì���R ���R"���R;��R6���RB��Rn���(����(����R���t���_retry_testŸ��s.���� ���� �� c���������C���sê���d��k��}�d��k�}�d��k�}�|��d��j�o �t�}��n�d�|��GHt�|��ƒ�} �| �i�ƒ��}�| �i �ƒ��x†�t�t�t �t�g�D]r�} �|�i�|�ƒ�}�|�i�ƒ��}�t�|�d��d�ƒ�}�d�| �i�G| �|�|�ƒ�|�i�ƒ��}�|�|�j�o �d�GHqp�d�GHqp�Wd��S(���Ns���using file "%s" for comparisonsi����s���testing %-30s t���passedt���FAILED(���R@��t ���cStringIOR"���R ���R ���t���__file__Rý���R©���R²���t���s_inputR«���t���_test_file_object_smallreadt���_test_file_object_readallt���_test_file_object_readlinet���_test_file_object_readlinest���testfunct���StringIOt���fo_inputt ���fo_outputR¦���t���wrapperR/���t���getvaluet���s_output(���R ���RF��RH��RO��R@��RQ��R"���RP��RS��RM��R©���(����(����R���t���_file_object_testÂ��s$���� � � c���������C���s7���x0�|��i�d�ƒ�}�|�i�|�ƒ�|�p�d��Sq�q�Wd��S(���Ni���i���(���RQ��R²���R±���RP��R��(���RQ��RP��R±���(����(����R���RI��Ø��s������ �c���������C���s���|��i�ƒ��}�|�i�|�ƒ�d��S(���N(���RQ��R²���R±���RP��R��(���RQ��RP��R±���(����(����R���RJ��Þ��s����c���������C���s4���x-�|��i�ƒ��}�|�i�|�ƒ�|�p�d��Sq�q�Wd��S(���Ni���(���RQ��RÖ���R±���RP��R��(���RQ��RP��R±���(����(����R���RK��â��s������ �c���������C���s)���|��i�ƒ��}�|�i�t�i�|�d�ƒ�ƒ�d��S(���NR���(���RQ��t ���readlinest���liRP��R��RM���R��(���RQ��RP��RV��(����(����R���RL��è��s����t���__main__t���test(O���R1���R���t���os.pathR"���RE���Rà���R·���Rï���RM���RP���RÃ���Rñ���R/���R���R„���R���t���HTTPBasicAuthHandlert���HTTPPasswordMgrWithDefaultRealmRY���t���i18nR���R,���t���msgt���httplibR��R ���RÔ���R���RÄ���RÉ���RÈ���RŠ���R���RÐ���R���t���HTTPRangeHandlert���HTTPSRangeHandlert���FileRangeHandlert���FTPRangeHandlerR|���Rõ���Rþ���R¿���R ���Rù���RŒ���R��Rø���Rp���R���R ���R-���R��R.���R2���R9���R;���R<���R>���Ri���R”���R8���R¦���R��RË���R"��RÂ���R-��R/��R1��R3��R5��R<��RC��RT��RI��RJ��RK��RL��(>���RÂ���R<��RÈ���R3��R ���RT��R��RL��Rõ���R/��R<���RÄ���R8���R¿���R9���R-���R��RI��RP���R���R���Rþ���RJ��R���Rï���Ra��R]��RÔ���R„���R.���R|���RM���R��Rà���R;���RÉ���RÃ���R"���R¦���Rø���R ���RY���R���RË���RK��R���R`��Rù���R"��R”���Ri���R-��RE���R_��R1��R>���RC��R·���Rb��R5��R���R2���(����(����R���t���?m��s®��� ! 5 -6 wO£ ÿ�f 6 #