+
    <	�i$L  ã                   ó‚  € R t ]t. ROt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHt  ^ R	IHt  ^ RIHt ^ RIHt ^ RIH t  ^ RI!H"t"H#t# ^ RI$H%t% ]&]'J d   ](t)]*t+M]'t)]'t+]PX                  ! R4      t-]PX                  ! R4      t.]PX                  ! R4      t/R t0R t1]Pd                  Pg                  R4      '       d   Rt4M^ RIH5t4  ! R R]4      t6 ! R R]74      t8 ! R R]84      t9 ! R R4      t:R#   ] d    ^ R
IHt ]P2                  t LÞi ; i  ] d
    ^ RIHt  Lêi ; i)zïBrowser object to make requests of lazr.restful web services.

The `Browser` class does some massage of HTTP requests and responses,
and handles custom caches. It is not part of the public
lazr.restfulclient API. (But maybe it should be?)
ÚBrowserÚRestfulHttpN)Úmd5)ÚBytesIO)Údumps)Úsleep)ÚHttpÚurlnorm)Úproxy_info_from_environment)Ú	ProxyInfo)Ú	urlencode)ÚApplication)ÚDatetimeJSONEncoder)Ú	HTTPErrorÚ	error_for)ÚURIs   ^\w+://z^\w+://s   [?/:|]+c                óÊ  €  \        V \        4      '       d   V P                  R4      pMT p\        P	                  V4      '       dK   \        V \        4      '       d$   V P                  R4      p V P                  R4      p MV P                  R4      p \        V \        4      '       d   V P                  R4      p \        V 4      P                  4       p\        P                  RV 4      p \        P                  RV 4      p \        P                  pV^ ,
          ^,
          p\        V 4      V8”  d   V RV p RP!                  V P                  R4      V34      #   \         d     LÐi ; i)z‰Return a filename suitable for the cache.

Strips dangerous and common characters to create a filename we
can use to store the cache in.
úutf-8Úidnaó    ó   ,NÚ,)Ú
isinstanceÚbytesÚdecodeÚre_url_scheme_sÚmatchÚencodeÚUnicodeErrorÚunicode_typer   Ú	hexdigestÚre_url_schemeÚsubÚre_slashr   Úmaximum_cache_filename_lengthÚlenÚjoin)ÚfilenameÚfilename_matchÚfilemd5Úmaximum_filename_lengthÚmaximum_length_before_md5_sums   &    Ú=/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.pyÚsafenamer-   W   s*  € ðÜ�h¤×&Ò&Ø%Ÿ_™_¨WÓ5‰Nà%ˆNä× Ñ  ×0Ò0Ü˜(¤E×*Ò*Ø#Ÿ?™?¨7Ó3�Ø#Ÿ?™?¨6Ó2‘à#Ÿ?™?¨6Ó2�ô �(œL×)Ò)Ø—?‘? 7Ó+ˆÜ�(‹m×%Ñ%Ó'€GÜ× Ñ   hÓ/€HÜ�|‰|˜D (Ó+€Hô  *×GÑGÐØ$;¸bÕ$@À1Õ$DÐ!Ü
ˆ8ƒ}Ð4Ô4ØÐ:Ð:Ð;ˆØ�8‰8�X—_‘_ WÓ-¨wÐ7Ó8Ð8øô5 ô Ùðús   ‚AE Á8E Â E ÅE"Å!E"c                 óT   € \        \        P                  P                  RR4      4      # )zëWhether the user has disabled SSL certificate connection.

Some testing servers have broken certificates.  Rather than raising an
error, we allow an environment variable,
``LP_DISABLE_SSL_CERTIFICATE_VALIDATION`` to disable the check.
Ú%LP_DISABLE_SSL_CERTIFICATE_VALIDATIONF)ÚboolÚosÚenvironÚget© r   r,   Ú#ssl_certificate_validation_disabledr5   †   s   € ô ”—
‘
—‘ÐFÈÓNÓOÐOr   z"/etc/ssl/certs/ca-certificates.crt)ÚCA_CERTSc                   óX   a a€ ] tR t^–t oRt^�tRRR]3V 3R lltV 3R ltR t	Rt
VtV ;t# )r   zêAn Http subclass with some custom behavior.

This Http client uses the TE header instead of the Accept-Encoding
header to ask for compressed representations. It also knows how to
react when its cache is a MultipleRepresentationCache.
Nc                ó¶   <€ \        4       p\        \        V `  VVVV\        R 7       Wn        V P
                  e   V P
                  P                  V 4       R# R# ))Ú"disable_ssl_certificate_validationÚca_certsN)r5   Úsuperr   Ú__init__ÚSYSTEM_CA_CERTSÚ
authorizerÚauthorizeSession)Úselfr>   ÚcacheÚtimeoutÚ
proxy_infoÚcert_disabledÚ	__class__s   &&&&& €r,   r<   ÚRestfulHttp.__init__    sX   ø€ ô <Ó=ˆÜŒk˜4Ñ)ØØØØ/<Ü$ð 	*ô 	
ð %ŒØ�?‰?Ò&Ø�O‰O×,Ñ,¨TÖ2ñ 'r   c
                ó¢   <€ RV9   d   VR V P                   e   V P                   P                  W5Wg4       \        \        V `  VVVVVVVVV	4	      # )z4Use the authorizer to authorize an outgoing request.Úauthorization)r>   ÚauthorizeRequestr;   r   Ú_request)r@   ÚconnÚhostÚabsolute_uriÚrequest_uriÚmethodÚbodyÚheadersÚredirectionsÚcachekeyrE   s   &&&&&&&&&&€r,   rJ   ÚRestfulHttp._request³   si   ø€ ð ˜gÔ%ð ˜Ð(Ø�?‰?Ò&Ø�O‰O×,Ñ,Ø dôô ”[ $Ñ0ØØØØØØØØØó

ð 
	
r   c                ó|   € \        V P                  \        4      '       d   V P                  P                  W4      # R# )ú+Retrieve a cached value for an HTTP header.N)r   rA   ÚMultipleRepresentationCacheÚ_getCachedHeader)r@   ÚuriÚheaders   &&&r,   rX   ÚRestfulHttp._getCachedHeaderØ   s,   € ä�d—j‘jÔ"=×>Ò>Ø—:‘:×.Ñ.¨sÓ;Ð;Ùr   )r>   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r$   r
   r<   rJ   rX   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©rE   Ú__classdict__s   @@r,   r   r   –   s5   ù‡ € ñð %(Ð!ð ØØØ.÷3õ&#
÷Jò r   c                   óL   a € ] tR t^ßt o RtRt]3R ltR tR t	R t
R tRtV tR	# )
ÚAtomicFileCachez‹A FileCache that can be shared by multiple processes.

Based on a patch found at
<http://code.google.com/p/httplib2/issues/detail?id=125>.
z.tempc                ó  € \         P                  P                  V4      V n        W n         \         P
                  ! V P                  4       R#   \         d,   pTP                  \        P                  8w  d   h  Rp?R# Rp?ii ; i)a%  Construct an ``AtomicFileCache``.

:param cache: The directory to use as a cache.
:param safe: A function that takes a key and returns a name that's
    safe to use as a filename.  The key must never return a string
    that begins with ``TEMPFILE_PREFIX``.  By default uses
    ``safename``.
N)	r1   ÚpathÚnormpathÚ
_cache_dirÚ_get_safe_nameÚmakedirsÚOSErrorÚerrnoÚEEXIST)r@   rA   ÚsafeÚes   &&& r,   r<   ÚAtomicFileCache.__init__è   s]   € ô Ÿ'™'×*Ñ*¨5Ó1ˆŒØ"Ôð	Ü�KŠK˜Ÿ™Ö(øÜô 	Ø�w‰wœ%Ÿ,™,Ô&Øõ 'ûð	ús   ¬ A ÁBÁ A?Á?Bc                óò   € V P                  V4      pVP                  V P                  4      '       d   \        RV P                  ,          4      h\        P
                  P                  V P                  V4      # )z0Return the path on disk where ``key`` is stored.z Cache key cannot start with '%s')rl   Ú
startswithÚTEMPFILE_PREFIXÚ
ValueErrorr1   ri   r&   rk   )r@   ÚkeyÚsafe_keys   && r,   Ú_get_key_pathÚAtomicFileCache._get_key_pathù   sa   € à×&Ñ& sÓ+ˆØ×Ñ˜t×3Ñ3×4Ò4ô Ø2°T×5IÑ5IÕIóð ô �w‰w�|‰|˜DŸO™O¨XÓ6Ð6r   c                ó(  € V P                  V4      p \        VR4      p VP                  4       VP                  4        #   TP                  4        i ; i  \        \
        3 d,   pTP                  \        P                  8w  d   h  Rp?R# Rp?ii ; i)al  Get the value of ``key`` if set.

This behaves slightly differently to ``FileCache`` in that if
``set()`` fails to store a key, this ``get()`` will behave as if that
key were never set whereas ``FileCache`` returns the empty string.

:param key: The key to retrieve.  Must be either bytes or unicode
    text.
:return: The value of ``key`` if set, None otherwise.
ÚrbN)rz   ÚopenÚreadÚcloseÚIOErrorrn   ro   ÚENOENT)r@   rx   Úcache_full_pathÚfrr   s   &&   r,   r3   ÚAtomicFileCache.get  sr   € ð ×,Ñ,¨SÓ1ˆð	Ü�_ dÓ+ˆAðØ—v‘v“xà—‘•	ø�—‘•	ûÜœÐ!ô 	Ø�w‰wœ%Ÿ,™,Ô&Øõ 'ûð	ús-   “A  A  ¯A Á AÁA ÁBÁ& BÂBc                óÀ  € \         P                  ! V P                  V P                  R7      w  r4\        P
                  ! VR4      pVP                  V4       VP                  4        V P                  V4      p\        P                  R8X  d<   \        P                  P                  V4      '       d   \        P                  ! V4       \        P                  ! WF4       R# )z™Set ``key`` to ``value``.

:param key: The key to set.  Must be either bytes or unicode text.
:param value: The value to set ``key`` to.  Must be bytes.
)ÚprefixÚdirÚwbÚwin32N)ÚtempfileÚmkstemprv   rk   r1   ÚfdopenÚwriter€   rz   ÚsysÚplatformri   ÚexistsÚunlinkÚrename)r@   rx   ÚvalueÚhandleÚ	path_namer„   rƒ   s   &&&    r,   ÚsetÚAtomicFileCache.set  s’   € ô %×,Ò,Ø×'Ñ'¨T¯_©_ô
Ñˆô �IŠI�f˜dÓ#ˆØ	�‰�ŒØ	�‰Œ	Ø×,Ñ,¨SÓ1ˆä�<‰<˜7Ô"¤r§w¡w§~¡~°o×'FÒ'FÜ�IŠI�oÔ&Ü
�	Š	�)Ö-r   c                óÈ   € V P                  V4      p \        P                  ! V4       R#   \         d,   pTP                  \        P
                  8w  d   h  Rp?R# Rp?ii ; i)zŸDelete ``key`` from the cache.

If ``key`` has not already been set then has no effect.

:param key: The key to delete.  Must be either bytes or unicode text.
N)rz   r1   Úremovern   ro   r‚   )r@   rx   rƒ   rr   s   &&  r,   ÚdeleteÚAtomicFileCache.delete.  sM   € ð ×,Ñ,¨SÓ1ˆð	Ü�IŠI�oÖ&øÜô 	Ø�w‰wœ%Ÿ,™,Ô&Øõ 'ûð	ús   “+ «A!¶ AÁA!)rk   rl   N)r\   r]   r^   r_   r`   rv   r-   r<   rz   r3   r—   r›   ra   rb   ©re   s   @r,   rg   rg   ß   s2   ø‡ € ñð €Oà#+ô ò"
7òò,.÷&ð r   rg   c                   óB   a a€ ] tR tRt oRtV 3R ltR tR tRtVt	V ;t
# )rW   i=  a  A cache that can hold different representations of the same resource.

If a resource has two representations with two media types,
FileCache will only store the most recently fetched
representation. This cache can keep track of multiple
representations of the same resource.

This class works on the assumption that outside calling code sets
an instance's request_media_type attribute to the value of the
'Accept' header before initiating the request.

This class is very much not thread-safe, but FileCache isn't
thread-safe anyway.
c                óP   <€ \         \        V `  WP                  4       RV n        R# )z>Tell FileCache to call append_media_type when generating keys.N)r;   rW   r<   Úappend_media_typeÚrequest_media_type)r@   rA   rE   s   &&€r,   r<   Ú$MultipleRepresentationCache.__init__M  s&   ø€ äÔ)¨4Ñ9Ø×)Ñ)ô	
ð #'ˆÖr   c                óh   € V P                   e   VR,           V P                   ,           p\        V4      # )z·Append the request media type to the cache key.

This ensures that representations of the same resource will be
cached separately, so long as they're served as different
media types.
Ú-)r¡   r-   )r@   rx   s   &&r,   r    Ú-MultipleRepresentationCache.append_media_typeT  s.   € ð ×"Ñ"Ò.Ø˜•)˜d×5Ñ5Õ5ˆCÜ˜‹}Ðr   c                ó:  € \        V4      w  r4rVV P                  V4      pVR,           p\        V\        4      '       g   VP	                  R4      pVeH   \        V4       F8  p	V	P                  V4      '       g   K  V	\        V4      R P                  4       u # 	  R# )rV   Ú:r   N)	r	   r3   r   r   r   r   ru   r%   Ústrip)
r@   rY   rZ   ÚschemeÚ	authorityrN   rS   Úcached_valueÚheader_startÚlines
   &&&       r,   rX   Ú,MultipleRepresentationCache._getCachedHeader_  s‰   € ä5<¸S³\Ñ2ˆ˜KØ—x‘x Ó)ˆØ •|ˆÜ˜,¬×.Ò.Ø'×.Ñ.¨wÓ7ˆLØÒ#Ü Ö-�Ø—?‘? <×0Ô0Ø¤ LÓ 1Ð 3Ð4×:Ñ:Ó<Ò<ñ .ñ r   )r¡   )r\   r]   r^   r_   r`   r<   r    rX   ra   rb   rc   rd   s   @@r,   rW   rW   =  s   ù‡ € ñõ'ò	÷ò r   rW   c                   óŠ   a € ] tR tRt o Rt]! 4       t^tRRRR]3R ltR t	RR lt
RR ltR tR	 tRR
 ltR tRR ltRtV tR# )r   im  z6A class for making calls to lazr.restful web services.Nc                ó
  € Vf;   \         P                  ! 4       p\        P                  ! \        P
                  V4       \        V\        4      '       d   \        V4      pVP                  W#WE4      V n
        W`n        Wpn        R# )zÅInitialize, possibly creating a cache.

If no cache is provided, a temporary directory will be used as
a cache. The temporary directory will be automatically removed
when the Python process exits.
N)r‹   ÚmkdtempÚatexitÚregisterÚshutilÚrmtreer   Ú	str_typesrW   ÚhttpFactoryÚ_connectionÚ
user_agentÚmax_retries)r@   Úservice_rootÚcredentialsrA   rB   rC   r¹   rº   s   &&&&&&&&r,   r<   ÚBrowser.__init__s  se   € ð  Š=Ü×$Ò$Ó&ˆEÜ�OŠOœFŸM™M¨5Ô1Ü�eœY×'Ò'Ü/°Ó6ˆEØ'×3Ñ3Ø ó
ˆÔð %ŒØ&Ör   c                ó"  € \        ^ V P                  ^,           4       Fk  pV P                  P                  WW4R7      w  rgVP                  R9   d7   WPP                  8  d'   \        ^V^,
          ,          4      p\        V4       Ki   Wg3# 	  XX3# )é    ©rO   rP   rQ   )iö  i÷  )Úrangerº   r¸   ÚrequestÚstatusÚintr   )	r@   ÚurlrO   rP   rQ   Úretry_countÚresponseÚcontentÚ	sleep_fors	   &&&&&    r,   Ú_request_and_retryÚBrowser._request_and_retryŽ  s‘   € Ü   D×$4Ñ$4°qÕ$8Ö9ˆKØ $× 0Ñ 0× 8Ñ 8Ø¨ð !9ó !ÑˆHð —‘ :Ô-Ø×"2Ñ"2Ô2ô    k°A¥oÕ 6Ó7�	Ü�iÖ ààÐ Ð ñ :ð ˜Ð Ð r   c                ó  € VR8X  d   \        R4      hRV/pV P                  e   V P                  VR&   \        V P                  P                  \
        4      '       d   W@P                  P                  n        Ve   VP                  V4       V P                  \        V4      W2VR7      w  rxVP                  R8X  d8   VR8X  d'   RV9   g   R	V9   d   WpP                  3# \        Wx4      h^ÈVn
        Wx3# \        Wx4      p	V	e   V	hWx3# )
z'Create an authenticated request object.ztag:launchpad.net:2008:redactedzUYou tried to access a resource that you don't have the server-side permission to see.ÚAcceptz
User-AgentrÀ   i0  r   zIf-None-MatchzIf-Modified-Since)rw   r¹   r   r¸   rA   rW   r¡   ÚupdaterÊ   ÚstrrÃ   ÚNOT_MODIFIEDr   r   )
r@   rÅ   ÚdatarO   Ú
media_typeÚextra_headersrQ   rÇ   rÈ   Úerrors
   &&&&&&    r,   rJ   ÚBrowser._request   s  € ð Ð3Ô3Üð@óð ð ˜ZÐ(ˆØ�?‰?Ò&Ø$(§O¡OˆG�LÑ!Ü�d×&Ñ&×,Ñ,Ô.I×JÒJØ8B×Ñ×"Ñ"Ô5ØÒ$Ø�N‰N˜=Ô)Ø ×3Ñ3Ü�‹H˜V¸ð 4ó 
Ñˆð �?‰?˜cÔ!à˜#Œ~à# wÔ.Ø*¨gÔ5ð $×%6Ñ%6Ð6Ð6ô $ HÓ6Ð6ð #&�”ØÐ$Ð$ä˜(Ó,ˆØÒØˆKØÐ Ð r   c                óÄ   € \        V\        \        34      '       d   TpM!VP                  R4      pVP	                  4       pV P                  WBR7      w  rgV'       d   Wg3# V# )z2GET a representation of the given resource or URI.r3   ©rÓ   )r   r¶   r   Ú
get_methodÚbuild_request_urlrJ   )r@   Úresource_or_urirQ   Úreturn_responserÅ   rO   rÇ   rÈ   s   &&&&    r,   r3   ÚBrowser.getç  s[   € ä�o¬	´3Ð'7×8Ò8Ø!‰Cà$×/Ñ/°Ó6ˆFØ×*Ñ*Ó,ˆCØ ŸM™M¨#˜MÓEÑˆßØÐ&Ð&Øˆr   c                ó¨   € RpV P                  WR7      w  r4\        V4      p\        V\        4      '       g   VP	                  R4      p\        W4      # )z?GET a WADL representation of the resource at the requested url.zapplication/vnd.sun.wadl+xml)rÒ   r   )rJ   rÏ   r   r   r   r   )r@   rÅ   Ú	wadl_typerÇ   rÈ   s   &&   r,   Úget_wadl_applicationÚBrowser.get_wadl_applicationó  sI   € à2ˆ	Ø ŸM™M¨#˜MÓDÑˆÜ�#‹hˆÜ˜'¤5×)Ò)Ø—n‘n WÓ-ˆGÜ˜3Ó(Ð(r   c                óD   € W#R&   \        V4      pV P                  WR4      # )z"POST a request to the web service.zws.opÚPOST)r   rJ   )r@   rÅ   Úmethod_nameÚkwsrÑ   s   &&&, r,   ÚpostÚBrowser.postü  s#   € à"ˆG‰Ü˜‹~ˆØ�}‰}˜S¨Ó/Ð/r   c                ó\   € RV/pVe   VP                  V4       V P                  WRVR7      # )z(PUT the given representation to the URL.úContent-TypeÚPUTr×   )rÎ   rJ   )r@   rÅ   ÚrepresentationrÒ   rQ   rÓ   s   &&&&& r,   ÚputÚBrowser.put  s=   € à'¨Ð4ˆØÒØ× Ñ  Ô)Ø�}‰}Ø °mð ó 
ð 	
r   c                ó,   € V P                  VRR7       R# )z%DELETE the resource at the given URL.ÚDELETE)rO   N)rJ   )r@   rÅ   s   &&r,   r›   ÚBrowser.delete  s   € à�‰�c (ˆÔ+Ùr   c                ó  € RR/pVe   VP                  V4       V P                  P                  \        V4      R4      pVe!   V P                  P                  '       g   WSR&   V P                  V\        V\        R7      RVR7      # )z8PATCH the object at url with the updated representation.rè   úapplication/jsonÚetagzIf-Match)ÚclsÚPATCHr×   )rÎ   r¸   rX   rÏ   Úignore_etagrJ   r   r   )r@   rÅ   rê   rQ   rÓ   Úcached_etags   &&&&  r,   ÚpatchÚBrowser.patch  sˆ   € à'Ð);Ð<ˆØÒØ× Ñ  Ô)ð ×&Ñ&×7Ñ7¼¸C»À&ÓIˆØÒ"¨4×+;Ñ+;×+G×+GÐ+Gà"-�JÑà�}‰}ØÜ�.Ô&9Ô:ØØ'ð	 ó 
ð 	
r   )r¸   rº   r¹   )NÚGETrñ   N)NF)N)r\   r]   r^   r_   r`   ÚobjectrÐ   ÚMAX_RETRIESr<   rÊ   rJ   r3   rß   rå   rë   r›   r÷   ra   rb   r�   s   @r,   r   r   m  sY   ø‡ € Ù@á“8€LØ€Kð ØØØØô'ò6!ô$E!ôN
ò)ò0ô
ò÷

ò 
r   )r   r   r5   );r`   ÚtypeÚ__metaclass__Ú__all__r²   ro   r1   Úrer´   r�   r‹   Úhashlibr   Úior   Újsonr   Útimer   Úhttplib2r   r	   r
   ÚImportErrorr   Úfrom_environmentÚurllib.parser   ÚurllibÚwadllib.applicationr   Úlazr.restfulclient._jsonr   Úlazr.restfulclient.errorsr   r   Úlazr.urir   r   rÏ   Úunicoder   Ú
basestringr¶   Úcompiler!   r   r#   r-   r5   ri   r‘   r=   r6   r   rú   rg   rW   r   r4   r   r,   Ú<module>r     s:  ðñ&ð €ò€ó Û Û 	Û 	Û Û 
Û Ý Ý Ý õ ç "ð=Ý4ð!å&õ ,å 8ß :Ý àˆCƒ<à€LØ�Ià€LØ€Ið —
’
˜;Ó'€Ø—*’*˜ZÓ(€Ø�:Š:�kÓ"€ò,9ò^Pð ‡7�7‡>�>Ð6×7Ò7Ø:�Oå4ôF�$ô FôR[�fô [ô|- /ô -÷`u
ó u
øðs	 ô =Ý"à"+×"<Ñ"<Òð=ûð ô !ß ð!ús$   ÁD ÁD. ÄD+Ä*D+Ä.D>Ä=D>