;ò 5Ec @sÄdZdkZdkZdkZdkZdkZdkZdkZdkZdk Z dk Ty!de i dƒdddUWn dZ nXdkZe ie iƒƒZydklZWnej oZd „ZnXyd klZWnej oZeZnXy&dkZd klZlZeZWnej oZeZnXy>dkZd kl Z l!Z!l"Z"l#Z#l$Z$l%Z%l&Z&Wn'ej oZfZ'eZ&dZ(n&Xe ƒe!ƒe"ƒe#ƒfZ'd Z(dk)Z)ye)i*Z+eZ,Wne-j oeZ+eZ,nXea.d„Z/d„Z0e0ƒde1fd„ƒYZ2dfd„ƒYZ3ed„Z4d„Z5ed„Z6dfd„ƒYZ7dfd„ƒYZ8dfd„ƒYZ9e9ƒZ:dfd„ƒYZ;gZ<ed„Z=gZ>d „Z?d!„Z@d"„ZAd#„ZBd$„ZCeddeeed%d&d'd(d)d*d+ged,„ ZDd-„ZEd.„ZFed/„ZGd0„ZHd1„ZId2„ZJd3„ZKe d4joeEƒeFƒeGd5ƒndS(6s½6A 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(s*sfrom s.is import __version__s???(s_cCs|SdS(N(sst(sst((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_Œs(s HTTPException(s HTTPHandlers HTTPSHandler(sHTTPRangeHandlersHTTPSRangeHandlersFileRangeHandlersFTPRangeHandlersrange_tuple_normalizesrange_tuple_to_headers RangeErroricCso|ato titjo |t_nto titjo |t_ntitjo |t_ndS(sSet 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(sDBOBJsDEBUGshave_keepalives keepalivesNones have_ranges byteranges sslfactory(sDBOBJ((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys set_logger¹s  cCsTy!tididƒ}dk}|ii|dt|dƒƒ}|djo t ƒ‚n|i dƒ}t |ƒdjo|d}nd}|djo|itiƒ}n3|djo|itiƒ}n|i|ƒ}|i|ƒ|id ƒ}|i|ƒ|i|ƒWn"ttt fj o t}nXt|ƒdS( stExamines 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.sURLGRABBER_DEBUGs,Niis%(asctime)s %(message)sss-s urlgrabber(sossenvironssplitsdbinfosloggings _levelNamessgetsintslevels ValueErrors Formatters formatterslensfilenames StreamHandlerssyssstderrshandlersstdouts FileHandlers setFormatters getLoggersDBOBJs addHandlerssetLevelsKeyErrors ImportErrorsNones set_logger(sloggingslevelsfilenamesdbinfosDBOBJshandlers formatter((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_init_default_loggerÒs. #      s URLGrabErrorcBstZdZRS(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) (s__name__s __module__s__doc__(((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys URLGrabErrors 3sCallbackObjectcBstZdZd„ZRS(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. cKs|ii|ƒdS(N(sselfs__dict__supdateskwargs(sselfskwargs((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys__init__Hs(s__name__s __module__s__doc__s__init__(((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysCallbackObject<s cKsti|||SdS(sJgrab the file at and make a local copy at 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(sdefault_grabbersurlgrabsurlsfilenameskwargs(surlsfilenameskwargs((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysurlgrabKscKsti||SdS(s0open 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(sdefault_grabbersurlopensurlskwargs(surlskwargs((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysurlopenUscKsti|||SdS(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(sdefault_grabbersurlreadsurlslimitskwargs(surlslimitskwargs((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysurlread_ss URLParsercBsAtZdZd„Zd„Zd„Zd„ZdZd„ZRS(sGProcess 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 CsN|i}|io|i||iƒ}nti|ƒ}|\} }}} }}| p t| ƒdjo | tijoS|ddjoti i|ƒ}ndti|ƒ}ti|ƒ}d}n| ddgjo|i|ƒ}n|tjo|i|ƒ}n|o|i|ƒ}nti|ƒ}||fSdS(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 iis/\sfile:shttpshttpsN(soptssquotesprefixsselfs add_prefixsurlsurlparsespartssschemeshostspathsparmsquerysfragslensstringsletterssossabspathsurllibs pathname2urls process_httpsNonesguess_should_quotes urlunparse( sselfsurlsoptssfragsquoteshostspartssqueryspathsschemesparm((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysparse}s(   +  cCsF|ddjp|ddjo||}n|d|}|SdS(Niÿÿÿÿs/i(sprefixsurl(sselfsurlsprefix((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys add_prefix¢s"c Csô|\} }} } }}d|joto®yE|iddƒ\}}d|jo|iddƒ\}}nWn.t j o"}tdtdƒtƒ‚nXtotid||ƒntit|||ƒn| || | ||fSdS(Ns@is:s Bad URL: %ssadding HTTP auth: %s, %s(spartssschemeshostspathsparmsquerysfrags auth_handlerssplits user_passsuserspasswords ValueErrorses URLGrabErrors_surlsDEBUGsinfos add_passwordsNone( sselfspartssfragspasswordseshostsusers user_passsqueryspathsschemesparm((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys process_http©s  cCsA|\}}}}}}ti|ƒ}||||||fSdS(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( spartssschemeshostspathsparmsquerysfragsurllibsquote(sselfspartssfragshostsqueryspathsschemesparm((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysquote¸ss0123456789ABCDEFc Csô|\}}}} }}d|jodSnti|dƒ}|djo x•|djo‡t |ƒ|djodSn||d|d!i ƒ}|d|ijp|d|ijodSnti|d|dƒ}qOWdSndSdS(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 s is%iÿÿÿÿiiN(spartssschemeshostspathsparmsquerysfragsstringsfindsindslensupperscodesselfshexvals( sselfspartssfragscodeshostsquerysindspathsschemesparm((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysguess_should_quoteÅs    (( s__name__s __module__s__doc__sparses add_prefixs process_httpsquoteshexvalssguess_should_quote(((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys URLParserjs  %   sURLGrabberOptionscBsGtZdZed„Zd„Zd„Zd„Zd„Zd„Z RS(sClass to ease kwargs handling.cKs5||_|tjo|iƒn|i|dS(sInitialize URLGrabberOptions object. Set default values for all options and then update options specified in kwargs. N(sdelegatesselfsNones _set_defaultss_set_attributesskwargs(sselfsdelegateskwargs((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys__init__âs   cCs>|iot|i|ƒot|i|ƒSnt|‚dS(N(sselfsdelegateshasattrsnamesgetattrsAttributeError(sselfsname((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys __getattr__ìscCsW|idjodSn<t|iƒtdƒjot|iƒSn|i|iSdS(sRCalculate raw throttle value from throttle and bandwidth values. iN(sselfsthrottlestypesfloats bandwidth(sself((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys raw_throttleñs cKstd||SdS(s—Create a derived URLGrabberOptions instance. This method creates a new instance and overrides the options specified in kwargs. sdelegateN(sURLGrabberOptionssselfskwargs(sselfskwargs((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysderiveüscKs~|ii|ƒto |idƒot|iƒ|_n|it ddgj o#t dt dƒ|ifƒ‚ndS(s7Update object attributes with those provided in kwargs.srangessimplescheck_timestampi sIllegal reget mode: %sN( sselfs__dict__supdateskwargss have_rangeshas_keysrange_tuple_normalizesrangesregetsNones URLGrabErrors_(sselfskwargs((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_set_attributess cCst|_d|_d|_t|_ddddddg|_t|_d|_d|_ t|_ d t |_ d |_ t|_t|_t|_t|_t|_t|_t|_t|_t|_t|_t|_t|_tƒ|_t|_t|_t|_d S( sSet all options to their default values. When adding new options, make sure a default is provided here. f1.0iiÿÿÿÿiiiiis urlgrabber/%siN( sNonesselfs progress_objsthrottles bandwidthsretrys retrycodess checkfuncs copy_localsclose_connectionsranges __version__s user_agents keepalivesproxiessregetsfailure_callbacksinterrupt_callbacksprefixsopenersTrues cache_openersstimeoutstexts http_headerss ftp_headerssdatas URLParsers urlparsersquotes ssl_ca_certs ssl_context(sself((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys _set_defaults s8                         ( s__name__s __module__s__doc__sNones__init__s __getattr__s raw_throttlesderives_set_attributess _set_defaults(((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysURLGrabberOptionsßs    s URLGrabbercBsJtZdZd„Zd„Zd„Zed„Zed„Zd„Z RS(sProvides 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. cKst||_dS(N(sURLGrabberOptionsskwargssselfsopts(sselfskwargs((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys__init__7sc Gsþd} xñnoé| d} t}t} t} to!tid| |i|dƒny9t ||f|hƒ} totidƒn| SWnPt j o!}|}|i} |i} n%tj o}|}|i} nXtotid|ƒn| oototid| ƒn|i| ƒ\}} }td|d|dd | d |iƒ}||| |Žn|itjp | |ijototid ƒn‚n| tj o | |ijo(totid | |iƒn‚q qWdS( Niisattempt %i/%s: %sssuccesss exception: %sscalling callback: %ss exceptionsurlstriessretrysretries exceeded, re-raisings)retrycode (%i) not in list %s, re-raising(striessNones exceptions retrycodescallbacksDEBUGsinfosoptssretrysargssapplysfuncsrs URLGrabErrorsesfailure_callbackserrnosKeyboardInterruptsinterrupt_callbacksselfs_make_callbackscb_funcscb_argss cb_kwargssCallbackObjectsobjs retrycodes(sselfsoptssfuncsargss exceptionscb_funcsesobjs cb_kwargsscallbackstriessrscb_argss retrycode((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_retry:sP      cKsM|ii|}|ii||ƒ\}}d„}|i |||ƒSdS(sopen 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. cCst|dtd|ƒSdS(Nsfilenamesopts(sURLGrabberFileObjectsurlsNonesopts(soptssurl((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys retryfuncrsN( sselfsoptssderiveskwargss urlparsersparsesurlspartss retryfuncs_retry(sselfsurlskwargsspartss retryfuncsopts((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysurlopenis  c  sbˆii|} | ii|| ƒ\}}|\} }}} }}|tjoti iti|ƒƒ}n| djo| i o³ti|ƒ}|oti id||ƒ}nti i|ƒ o tdtdƒ|fƒ‚q<ti i|ƒ o tdtdƒ|fƒ‚q<| i o|Sq<n‡d†} ˆi| | ||ƒSdS( s grab the file at and make a local copy at 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. sfiles//isLocal file does not exist: %sisNot a normal file: %scs˜t|||ƒ}zp|iƒ|itj oQˆi |iƒ\}}}t ƒ}||_||_t||f||ƒnWd|iƒX|SdS(N(sURLGrabberFileObjectsurlsfilenamesoptssfos_do_grabs checkfuncsNonesselfs_make_callbackscb_funcscb_argss cb_kwargssCallbackObjectsobjsapplysclose(soptssurlsfilenamesobjs cb_kwargsscb_funcscb_argssfo(sself(sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys retryfuncs     N(sselfsoptssderiveskwargss urlparsersparsesurlspartssschemeshostspathsparmsquerysfragsfilenamesNonesossbasenamesurllibsunquotes copy_locals url2pathnamesnormpathsexistss URLGrabErrors_sisfilesranges retryfuncs_retry( sselfsurlsfilenameskwargssfragshostspartssqueryspathsschemesparmsoptss retryfunc((sselfsP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysurlgrabvs(    c s±ˆii|}|ii||ƒ\}}|t j o|d}n‡d†}ˆi ||||ƒ}|ot |ƒ|jo#tdtdƒ||fƒ‚n|SdS(s2read 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' ic sÆt|dtd|ƒ}d}z’|tjo|iƒ}n|i|ƒ}|itj oQˆi |iƒ\}}}tƒ}||_||_t||f||ƒnWd|iƒX|SdS(Nsfilenamesoptss(sURLGrabberFileObjectsurlsNonesoptssfossslimitsreads checkfuncsselfs_make_callbackscb_funcscb_argss cb_kwargssCallbackObjectsobjsdatasapplysclose( soptssurlslimitsobjs cb_kwargsssscb_funcscb_argssfo(sself(sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys retryfunc­s     isExceeded limit (%i): %sN(sselfsoptssderiveskwargss urlparsersparsesurlspartsslimitsNones retryfuncs_retryssslens URLGrabErrors_(sselfsurlslimitskwargsssspartss retryfuncsopts((sselfsP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysurlread¡s  cCs&t|ƒo|fhfSn|SdS(N(scallables callback_obj(sselfs callback_obj((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_make_callbackÉs ( s__name__s __module__s__doc__s__init__s_retrysurlopensNonesurlgrabsurlreads_make_callback(((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys URLGrabber.s   / + (sURLGrabberFileObjectcBsƒtZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z e d „Z e d „Z d d „Zd „ZRS(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. cCsr||_||_||_t|_d|_dd|_tiƒ|_ d|_ d|_ t|_ |i ƒdS(Nsiii(surlsselfsfilenamesoptssNonesfos_rbufs _rbufsizestimes_ttimes_tsizes _amount_reads_openers_do_open(sselfsurlsfilenamesopts((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys__init__Þs         cCs4t|i|ƒot|i|ƒSnt|‚dS(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(shasattrsselfsfosnamesgetattrsAttributeError(sselfsname((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys __getattr__ëscCs|iio|iiSnh|itjoWg}to |ii}t o|ii p |ii }|ii o[|it|ii ƒƒ| o|itiƒƒn| o|itiƒƒqÌnti|ii|iiƒ}|o'|itƒƒ|it|ƒƒn|o|it ƒn|itƒ|iiot||Œ|_n|i|Œ|_g|i_n|iSdS(s8Build a urllib2 OpenerDirector based on request options.N(sselfsoptssopeners_openersNoneshandlersshave_keepalives keepalivesneed_keepalive_handlersrange_handlerssrangesregetsneed_range_handlersproxiessappendsCachedProxyHandlersurllib2s HTTPHandlers FTPHandlers sslfactorys get_factorys ssl_ca_certs ssl_contexts ssl_factorys HTTPSHandlersextends auth_handlers cache_openerssCachedOpenerDirectors create_openers addheaders(sselfshandlerssneed_keepalive_handlersneed_range_handlers ssl_factory((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys _get_openerós4     cCsˆ|iƒ}ti|i|iiƒ}|i |ƒ|i |ƒ|i ||ƒ\} } |io|iidjoµd}y<| idƒ} ti| ƒ}||ijo d}nWntfj o d}nX|oI| iƒt|i_|id=|i |ƒ|i ||ƒ\} } q+nti|iƒ\}}} }}}t!i"| ƒ} |ii#p|ii$ƒp |ii% o0| i&|_&t'| dƒo| i(|_(qln´|ii#o¦y!t)| dƒ} | |i+} Wn"t,t-tfj o t} nX|ii#i.t/|i0ƒt!i"|iƒt1ii2| ƒ| d|ii3ƒ|ii#i4dƒn| | f\|_ |_ dS( Nscheck_timestampis last-modifiedisRangesreadlinesContent-Lengthstext(5sselfs _get_openersopenersurllib2sRequestsurlsoptssdatasreqs _add_headerss _build_ranges _make_requestsfoshdrs reget_timesregets fetch_agains getdate_tzsmodified_tuplesrfc822s mktime_tzsmodified_stamps TypeErrorsclosesNonesheaderssurlparsesschemeshostspathsparmsquerysfragsurllibsunquotes progress_objs raw_throttlestimeoutsreadshasattrsreadlinesintslengths _amount_readsKeyErrors ValueErrorsstartsstrsfilenamesossbasenamestextsupdate(sselfsmodified_stampsquerysreqsopenersschemesfragsparmshostspathsfoshdrslengthsmodified_tuples fetch_again((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_do_open)sL         $+   cCsó|iio|id|iiƒny|iƒ}Wntj o t}nX|ii o|ddfjo1x.|ii D]\}}|i||ƒq€Wn|ii o |djo1x.|ii D]\}}|i||ƒqËWndS(Ns User-agentshttpshttpssftp( sselfsoptss user_agentsreqs add_headersget_typesreq_types ValueErrorsNones http_headersshsvs ftp_headers(sselfsreqsvshsreq_type((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys _add_headers^s     cCsNt|_d|_d}t}to&|iiot |i ƒt dƒjoeyt i |i ƒ}Wntj oq³X|t|_|t}||_|df}d|_n|iioXt otdtdƒƒ‚n|ii}|do|d||df}qn|o+t|ƒ}|o|id|ƒqJndS(Nisii s2Byte range requested but range support unavailablesRange(sNonesselfs reget_timesappends reget_lengthsrts have_rangesoptssregetstypesfilenamesossstatsssOSErrorsST_MTIMEsST_SIZEs _amount_readsranges URLGrabErrors_srange_tuple_to_headersheadersreqs add_header(sselfsreqsrts reget_lengthsheaderss((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys _build_rangejs0  0         cCsyzto |iioGtiƒ}ti|iiƒz|i |ƒ}Wdti|ƒXn|i |ƒ}|i ƒ}Wn„tj o%}tdtdƒ|fƒ‚n_tj o}tdt|ƒƒ‚n6tij o9}tdt|ƒƒ}|i|_||_|‚nïtj oo}t|dƒotot|itƒo tdtdƒ|fƒ‚q tdtd ƒ|fƒ‚nutj o%}td td ƒ|fƒ‚nEtj o.}td td ƒ|i i!|fƒ‚n X||fSdS(Nis Bad URL: %si isreasoni s Timeout: %sis IOError: %sis OSError: %sisHTTP Exception (%s): %s("shave_socket_timeoutsselfsoptsstimeoutssocketsgetdefaulttimeoutsold_tossetdefaulttimeoutsopenersopensreqsfosinfoshdrs ValueErrorses URLGrabErrors_s RangeErrorsstrsurllib2s HTTPErrorsnew_escodes exceptionsIOErrorshasattrs isinstancesreasons TimeoutErrorsOSErrors HTTPExceptions __class__s__name__(sselfsreqsopenersfosold_toshdrsesnew_e((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys _make_requestŠs8     *   *cCs|iot|idƒ}nt|idƒ}dd}d}|i|ƒ}|t |ƒ}x8|o0|i |ƒ|i|ƒ}|t |ƒ}qdW|i ƒy>|i i dƒ}ti|ƒ}ti|i||fƒWntfj o }nX|SdS(sdump the file to self.filename.sabswbiiis last-modifiedN(sselfsappendsopensfilenamesnew_fosbsssizesreadsblockslenswritescloseshdrs getdate_tzsmodified_tuplesrfc822s mktime_tzsmodified_stampsossutimes TypeErrorse(sselfsesmodified_tuplesmodified_stampsnew_fosbssblockssize((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_do_grab­s*    c Csd|io |tj o2t|iƒ}||jo||}qJdSn|ig} t|iƒ}xß|tjp|oÊ|ii ƒoX|i |ii ƒt i ƒ|i }|djot i|ƒnt i ƒ|_ n|tjo |i}nt||iƒ}y|ii|ƒ}Wn”tij o%}tdtdƒ|fƒ‚nbtj o%}tdtdƒ|fƒ‚n2tj o%}tdtdƒ|fƒ‚nXt|ƒ}| oPn|o||}n| i|ƒ||}||_ |i||_|iio|iii |iƒqhqhWt!i"| dƒ|_dSdS( sfill 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.NiisSocket Error: %si s Timeout: %ss IOError: %ss(#sselfs_rbufsamtsNoneslensLsbufsbufsizesoptss raw_throttles_tsizestimes_ttimesdiffssleeps _rbufsizes readamountsminsfosreadsnewssocketserrorses URLGrabErrors_s TimeoutErrorsIOErrorsnewsizesappends _amount_reads progress_objsupdatesstringsjoin( sselfsamtsnewsizesesnewsLs readamountsdiffsbufsizesbuf((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys _fill_bufferÄsN  '    !     cCsa|i|ƒ|tjo|idf\}|_n$|i| |i|f\}|_|SdS(Ns(sselfs _fill_buffersamtsNones_rbufss(sselfsamtss((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysreadøs   #iÿÿÿÿcCs/ti|idƒ}x‘|djo%d|jot|iƒjn o[t|iƒ}|i||i ƒt|iƒ|j oPnti|id|ƒ}qW|djot|iƒ}n |d}d|jot|iƒjno |}n|i| |i|f\}|_|SdS(Ns ii( sstringsfindsselfs_rbufsislimitslensLs _fill_buffers _rbufsizess(sselfslimitsisLss((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysreadlines5  ' #cCsd|iio|iii|iƒn|iiƒ|iioy|iiƒWq`q`XndS(N(sselfsoptss progress_objsends _amount_readsfosclosesclose_connection(sself((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pyscloses   (s__name__s __module__s__doc__s__init__s __getattr__s _get_openers_do_opens _add_headerss _build_ranges _make_requests_do_grabsNones _fill_buffersreadsreadlinesclose(((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysURLGrabberFileObjectÓs   6 5 #  4  cGsxJtD]B\}}||jo)x|iD]}|i|ƒq*W|SqqW| otiƒ}n|i |Œ}ti ||fƒ|SdS(N( s_handler_cachescached_handlerssopenershandlersshandlers add_parents ssl_factorys sslfactorys get_factorys create_openersappend(s ssl_factoryshandlersshandlersopenerscached_handlers((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysCachedOpenerDirectors    c CsxütD]9\}}||jo totid|ƒnPqqWx{|iƒD]m\}}t i |ƒ\}}t i |ƒ\}}|tjp |tjotdtdƒ|ƒ‚qQqQWtotid|ƒnti|ƒ}ti||fƒ|SdS(Nsre-using proxy settings: %si sBad proxy URL: %sscreating new proxy handler: %s(s _proxy_cachespdictshandlersproxiessDEBUGsdebugsitemssksvsurllibs splittypesutypesurls splithostshostsothersNones URLGrabErrors_sinfosurllib2s ProxyHandlersappend( sproxiesspdictsutypesksurlshostshandlersvsother((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysCachedProxyHandler%s"    !cCs |t_dS(s8Deprecated. Use: default_grabber.throttle = new_throttleN(s new_throttlesdefault_grabbersthrottle(s new_throttle((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys set_throttle8scCs |t_dS(s:Deprecated. Use: default_grabber.bandwidth = new_bandwidthN(s new_bandwidthsdefault_grabbers bandwidth(s new_bandwidth((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys set_bandwidth<scCs |t_dS(s@Deprecated. Use: default_grabber.progress_obj = new_progress_objN(snew_progress_objsdefault_grabbers progress_obj(snew_progress_obj((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysset_progress_obj@scCs |t_dS(s<Deprecated. Use: default_grabber.user_agent = new_user_agentN(snew_user_agentsdefault_grabbers user_agent(snew_user_agent((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pysset_user_agentDsiiÿÿÿÿiiiiic Csbhd|<d|<d|<d|<d|<d|<d|<d| <} t ||| Sd S( s5Deprecated. Use: urlgrab() with the retry arg insteads copy_localsclose_connections progress_objsthrottles bandwidthsretrys retrycodess checkfuncN( s copy_localsclose_connections progress_objsthrottles bandwidthsnumtriess retrycodess checkfuncskwargssurlgrabsurlsfilename( surlsfilenames copy_localsclose_connections progress_objsthrottles bandwidthsnumtriess retrycodess checkfuncskwargs((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys retrygrabHsN c CsIdk}y|idd!\}}Wn1tj o%dG|idGdGH|iƒnXh}x@|idD]1}ti |ddƒ\}}t |ƒ|| [copy_local=0|1] [close_connection=0|1]s=f1.0i is)throttle: %s, throttle bandwidth: %s B/s(stext_progress_meters progress_objs LOCAL FILE:(ssyssargvsurlsfilenames ValueErrorsexitskwargssasstringssplitsksvsints set_throttles set_bandwidthsdefault_grabbersthrottles bandwidthsprogressstext_progress_meters ImportErrorsesapplysurlgrabsnames URLGrabError( sasesurlsksvsfilenamessysstext_progress_meterskwargssname((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys _main_testZs0    c CsGdk}y|idd!\}}Wn1tj o%dG|idGdGH|iƒnXh}x@|idD]1}ti |ddƒ\}}t |ƒ|| [copy_local=0|1] [close_connection=0|1]s=(stext_progress_meters progress_objsfoocCsu|G|GHdk}|iƒ}|djodGHtddƒ‚n|djodGHtddƒ‚ndGHdSdS( Nf0.5s forcing retryiÿÿÿÿf0.75sforcing failureiþÿÿÿsforcing immediate failuressuccess(shellostheresrandomsrnums URLGrabError(sfilenameshellostheresrandomsrnum((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pyscfunc†s     shellostheres checkfuncs LOCAL FILE:(ssyssargvsurlsfilenames ValueErrorsexitskwargssasstringssplitsksvsintsprogressstext_progress_meters ImportErrorsescfuncsapplys retrygrabsnames URLGrabError( sasesurlsksvsfilenamessysstext_progress_meterskwargsscfuncsname((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys _retry_testus.    c Csêdk}dk}dk}|tjo t}nd|GHt|ƒ} | iƒ}| i ƒx†t t t tgD]r} |i|ƒ}|iƒ}t|tdƒ}d| iG| ||ƒ|iƒ}||jo dGHqpdGHqpWdS(Nsusing file "%s" for comparisonsistesting %-30s spassedsFAILED(srandoms cStringIOssyssfilenamesNones__file__sopensfosreadss_inputscloses_test_file_object_smallreads_test_file_object_readalls_test_file_object_readlines_test_file_object_readlinesstestfuncsStringIOsfo_inputs fo_outputsURLGrabberFileObjectswrappers__name__sgetvaluess_output( sfilenames cStringIOss_inputsfo_inputsrandomswrapperssyss fo_outputss_outputstestfuncsfo((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_file_object_test˜s$           cCs?x8no0|idƒ}|i|ƒ| odSqq WdS(Nii(swrappersreadsss fo_outputswrite(swrappers fo_outputss((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_test_file_object_smallread®s  cCs|iƒ}|i|ƒdS(N(swrappersreadsss fo_outputswrite(swrappers fo_outputss((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_test_file_object_readall´s cCs<x5no-|iƒ}|i|ƒ| odSqq WdS(Ni(swrappersreadlinesss fo_outputswrite(swrappers fo_outputss((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_test_file_object_readline¸s   cCs)|iƒ}|iti|dƒƒdS(Ns(swrappers readlinesslis fo_outputswritesstringsjoin(swrappers fo_outputsli((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys_test_file_object_readlines¾s s__main__stest(Ls__doc__sossos.pathssyssurlparsesrfc822stimesstringsurllibsurllib2sstats__name__ssplits __version__s sslfactorysHTTPBasicAuthHandlersHTTPPasswordMgrWithDefaultRealms auth_handlersi18ns_s ImportErrorsmsgshttplibs HTTPExceptionsNones keepalives HTTPHandlers HTTPSHandlersTrueshave_keepalivesFalses byterangesHTTPRangeHandlersHTTPSRangeHandlersFileRangeHandlersFTPRangeHandlersrange_tuple_normalizesrange_tuple_to_headers RangeErrorsrange_handlerss have_rangessocketstimeouts TimeoutErrorshave_socket_timeoutsAttributeErrorsDEBUGs set_loggers_init_default_loggersIOErrors URLGrabErrorsCallbackObjectsurlgrabsurlopensurlreads URLParsersURLGrabberOptionss URLGrabbersdefault_grabbersURLGrabberFileObjects_handler_cachesCachedOpenerDirectors _proxy_cachesCachedProxyHandlers set_throttles set_bandwidthsset_progress_objsset_user_agents retrygrabs _main_tests _retry_tests_file_object_tests_test_file_object_smallreads_test_file_object_readalls_test_file_object_readlines_test_file_object_readlines(;sCachedProxyHandlers _main_testsset_user_agents set_loggers_file_object_tests TimeoutErrors_test_file_object_readlinessrange_tuple_to_headers set_bandwidthsurlreads HTTPHandlersdefault_grabbersrange_handlerssurlgrabs_init_default_loggers_handler_caches_test_file_object_smallreadsurllibshave_keepalives keepalives RangeErrors_test_file_object_readalls byteranges URLGrabErrorsFileRangeHandlersmsgs __version__srange_tuple_normalizesstrings HTTPExceptionsrfc822surlopens HTTPSHandlersurllib2ssyssURLGrabberFileObjectshave_socket_timeouts have_ranges auth_handlers_sCachedOpenerDirectors_test_file_object_readlines sslfactorysHTTPSRangeHandlerssockets _proxy_caches URLGrabbersURLGrabberOptionss set_throttlesurlparsesHTTPRangeHandlersset_progress_objs URLParsers _retry_teststimesFTPRangeHandlers retrygrabsossCallbackObject((sP/mnt/gmirror/ports/www/py-urlgrabber/work/urlgrabber-3.1.0/urlgrabber/grabber.pys?ms¢         !       5       -6 uO£ ÿE      6  #