/usr/lib/python2.6/site-packages/ndg/httpsclient
NameSizeModeActions
test/-0755rm
https.py48340644editdlrm
https.pyc50620644editdlrm
ssl_context_util.py34580644editdlrm
ssl_context_util.pyc40410644editdlrm
ssl_peer_verification.py96610644editdlrm
ssl_peer_verification.pyc91640644editdlrm
ssl_socket.py93440644editdlrm
ssl_socket.pyc123320644editdlrm
subj_alt_name.py61310644editdlrm
subj_alt_name.pyc68580644editdlrm
urllib2_build_opener.py26890644editdlrm
urllib2_build_opener.pyc26280644editdlrm
utils.py157360644editdlrm
utils.pyc132160644editdlrm
__init__.py3900644editdlrm
__init__.pyc6250644editdlrm
Edit: /usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pyc (13216B)
Ñò ˜KVc@s¨dZdZdZdZdZdZdZddkZdd kl Z ddk Z ddk Z e i d d jo¡ddk iZddkiZdd klZdd klZddklZddklZddklZddklZddk l!Z"ddk#i$Z%n•ddk&Zddk'Zdd k(lZdd k(lZddk(lZddk(lZddk(lZddk(lZddk(l!Z"ddk)Z%ddk*l+Z+ddk,l-Z-ddk.l/Z/ei0e1ƒZ2defd„ƒYZ3de4fd„ƒYZ5ddd„Z7ddd„Z8ddd„Z9ddd„Z:dd„Z;d„Z<d e=fd!„ƒYZ>d"„Z?e1d#joei@ƒe?ƒndS($s`Utilities using NDG HTTPS Client, including a main module that can be used to fetch from a URL. s R B Wilkinsons09/12/11s2(C) 2011 Science and Technology Facilities Councils-BSD - see LICENSE file in top-level directorysPhilip.Kershaw@stfc.ac.uks$Id$iÿÿÿÿN(t OptionParserii(tRequest(t HTTPHandler(tHTTPCookieProcessor(tHTTPBasicAuthHandler(tHTTPPasswordMgrWithDefaultRealm(t ProxyHandler(t HTTPError(t build_opener(tHTTPSContextHandler(tssl_context_utiltAccumulatingHTTPCookieProcessorcBseZdZd„ZeZRS(stCookie processor that adds new cookies (instead of replacing the existing ones as HTTPCookieProcessor does) cCs³d}t|iƒ|ih|i|iƒ}|ii|ƒ|i|ƒ}|o\|i|ƒo8|i|ƒ}di ||gƒ}|i ||ƒq¯|i ||ƒn|S(s¹Processes cookies for a HTTP request. @param request: request to process @type request: urllib2.Request @return: request @rtype: urllib2.Request tCookies; ( tRequest_t get_full_urltdatatorigin_req_hostt unverifiablet cookiejartadd_cookie_headert get_headert has_headertjointadd_unredirected_header(tselftrequesttCOOKIE_HEADER_NAMEt tmp_requestt new_cookiest old_cookiestmerged_cookies((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pyt http_request3s   (t__name__t __module__t__doc__Rt https_request(((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pyR /s t URLFetchErrorcBseZdZRS(sError fetching content from URL(R R!R"(((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pyR$QscCsft||d|d|ƒ\}}}|o+|tijo|iƒ}|iƒ|St|ƒ‚dS(sáReturns data retrieved from a URL. @param url: URL to attempt to open @type url: basestring @param config: SSL context configuration @type config: Configuration @return data retrieved from URL or None RthandlersN(topen_urlt http_client_tOKtreadtcloseR$(turltconfigRR%t return_codetreturn_messagetresponset return_data((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pytfetch_from_urlUs  c CsŠt||d|d|ƒ\}}}|tijo@|iƒ}|iƒt|dƒ} | i|ƒ| iƒn|||tijfS(s¨Writes data retrieved from a URL to a file. @param url: URL to attempt to open @type url: basestring @param config: SSL context configuration @type config: Configuration @param output_file: output file @type output_file: basestring @return: tuple ( returned HTTP status code or 0 if an error occurred returned message boolean indicating whether access was successful) RR%tw(R&R'R(R)R*topentwrite( R+R,t output_fileRR%R-R.R/R0toutfile((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pytfetch_from_url_to_filefs    cCsPt||d|d|ƒ\}}}|o|tijo|St|ƒ‚dS(sœReturns data retrieved from a URL. @param url: URL to attempt to open @type url: basestring @param config: SSL context configuration @type config: Configuration @param data: HTTP POST data @type data: str @param handlers: list of custom urllib2 handlers to add to the request @type handlers: iterable @return: data retrieved from URL or None @rtype: file derived type RR%N(R&R'R(R$(R+R,RR%R-R.R/((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pytfetch_stream_from_urls c Cs |iodnd}|io |i}n tiƒ}t|ƒ}|p g}n|i|ƒ|io;td|ƒ}t|id|ƒ}|i ||gƒn|i oPt t ƒƒ} | i ddd|d|idd|idƒ|i| ƒnt||iƒp$|ithƒƒtidƒn9|io.|it|iƒƒtid |iƒntd |i|Œ} |i} | djo h} nt||| ƒ} d} d }d}| i| ƒ}yl| i| ƒ}|i}|i} titiƒo4x1t|ƒD]\}}tid ||ƒqWnWnµtj oO}|i} d |i}titiƒotid|i|iƒqþn\t j oO}d |i!ƒ}titiƒo#ddk"}ti|i#ƒƒqþnX| ||fS(sÞAttempts to open a connection to a specified URL. @param url: URL to attempt to open @param config: SSL context configuration @type config: Configuration @param data: HTTP POST data @type data: str @param handlers: list of custom urllib2 handlers to add to the request @type handlers: iterable @return: tuple ( returned HTTP status code or 0 if an error occurred returned message or error description response object) iit debugleveltrealmturitusertpasswdsNot using proxysConfiguring proxies: %st ssl_contextts %s : %ss Error: %ss%s %siÿÿÿÿN($tdebugtcookiet cookiejar_t CookieJarR tappendt HTTPHandler_R R>textendthttp_basicauthtHTTPBasicAuthHandler_t HTTPPasswordMgrWithDefaultRealm_t add_passwordtNonethttpautht_should_use_proxytno_proxyt ProxyHandler_tlogtproxiesRtheadersR R3tmsgtcodet isEnabledFortloggingtDEBUGt enumeratet HTTPError_t Exceptiont__str__t tracebackt format_exc(R+R,RR%R9tcjtcookie_handlert http_handlert https_handlert auth_handlertopenerRRRR-R.R/tindexRAtexcR\((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pyR&”sj                    ! cCs•|djotiiddƒ}n|}tit|ƒƒ}xMg}|idƒD]}||iƒqX~D]}|i |jot SqrWt S(sØDetermines whether a proxy should be used to open a connection to the specified URL, based on the value of the no_proxy environment variable. @param url: URL @type url: basestring or urllib2.Request RNR?t,N( RKtostenvirontgett urlparse_turlparset_url_as_stringtsplittstripthostnametFalsetTrue(R+RNtno_proxy_effectiveturlObjt_[1]thtnp((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pyRMös 1 cCsJt|tƒo |iƒSt|tƒo|Stdttfƒ‚dS(sÍReturns the URL string from a URL value that is either a string or urllib2.Request.. @param url: URL @type url: basestring or urllib2.Request @return: URL string @rtype: basestring sExpected type %r or %rN(t isinstanceR Rtstrt TypeError(R+((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pyRls  t ConfigurationcBs)eZdZedddddd„ZRS(sConnection configuration. cCsC||_||_||_||_||_||_||_dS(sÔ @param ssl_context: SSL context to use with this configuration @type ssl_context: OpenSSL.SSL.Context @param debug: if True, output debugging information @type debug: bool @param proxies: proxies to use for @type proxies: dict with basestring keys and values @param no_proxy: hosts for which a proxy should not be used @type no_proxy: basestring @param cookie: cookies to set for request @type cookie: cookielib.CookieJar (python 3 - http.cookiejar) @param http_basicauth: http authentication, or None @type http_basicauth: tuple of (username,password) @param headers: http headers @type headers: dict N(R>R@RQRNRARGRR(RR>R@RQRNRARGRR((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pyt__init__s      N(R R!R"RpRKR{(((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pyRzs c Csètddƒ}|iddddddd tiid ƒd d ƒ|id dddddd d8d dƒ|iddddddd d8d dƒ|iddddddd td dƒ|iddddddd d8d dƒ|id d!dd"ddd d8d d#ƒ|id$d%dddd&d td d'ƒ|id(d)dd*dd+d d8d d,ƒ|id-dd.dd/dd0d d1ƒ|iƒ\}}t|ƒd2jo|i d3ƒn|d4}|i ot i ƒi t iƒn|io#tii|iƒo |i}nd8}|io#tii|iƒo |i}nd8}|io#tii|iƒo |i}nd8}|i }|io?tii|iƒo)t|iƒ}|iƒ} |iƒnd8} |io|iid5d2ƒ} nd8} h} |ioFxC|iD]4} | id5d2ƒ\} }|iƒ| | iƒR,R-R.((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pytmain7sœ                      t__main__(AR"t __author__t__date__t __copyright__t __license__t __contact__t __revision__RVtoptparseRRgtsyst version_infothttp.cookiejarRRBt http.clienttclientR'turllib.requestRR RRERtHTTPCookieProcessor_RRHRRIRROt urllib.errorRRYt urllib.parsetparseRjt cookielibthttplibturllib2Rkt$ndg.httpsclient.urllib2_build_openerRtndg.httpsclient.httpsR tndg.httpsclientR R’R RPR RZR$RKR1R7R8R&RMRltobjectRzRžt basicConfig(((s9/usr/lib/python2.6/site-packages/ndg/httpsclient/utils.pyts`      "b   e