+
    Z4i�v  ã                   ó˜  € R t . R7Ot^ RIHtHt ^ RIt^ R	IHt ^ RIt^ RI	t	^ R
I
H
t
 ^ RIt^ RIHt ^ RIt^ RIHtHtHt ^ RIt^ RIHt ^ RIHtHtHtHt ^ RIHt RtRtRt ^t!R8t"]#]$]%3t&R t'R t( ! R R]4      t) ! R R]4      t ! R R]4      t* ! R R4      t+ ! R R]+4      t, ! R R]+4      t- ! R R]+4      t. ! R R4      t/ ! R  R!]/4      t0 ! R" R]04      t1 ! R# R$]24      t3 ! R% R&]34      t4 ! R' R(]34      t5 ! R) R*]54      t6 ! R+ R,]54      t7 ! R- R.]74      t8 ! R/ R0]34      t9 ! R1 R2]34      t: ! R3 R4]34      t; ! R5 R6]34      t<R# )9z4launchpadlib credentials and authentication support.ÚAccessTokenÚAnonymousAccessTokenÚ AuthorizeRequestTokenWithBrowserÚCredentialStoreÚRequestTokenAuthorizationEngineÚCredentials)Ú	b64decodeÚ	b64encodeN)ÚStringIO)Úselect)Ústdin)Ú	urlencodeÚurljoinÚparse_qs)Ú	HTTPError)r   ÚConsumerÚOAuthAuthorizerÚSystemWideConsumer)Úurisz+request-tokenz+access-tokenz+authorize-tokenc                 ó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© ó    Ú:/usr/lib/python3/dist-packages/launchpadlib/credentials.pyÚ$_ssl_certificate_validation_disabledr   ?   s   € ô ”—
‘
—‘ÐFÈÓNÓOÐOr   c                ó¾   € \        4       p\        P                  ! VR7      P                  V RV\	        V4      R7      w  rEVP
                  ^È8w  d   \        WE4      hWE3# )zÔPOST to ``url`` with ``headers`` and a body of urlencoded ``params``.

Wraps it up to make sure we avoid the SSL certificate validation if our
environment tells us to.  Also, raises an error on non-200 statuses.
)Ú"disable_ssl_certificate_validationÚPOST)ÚmethodÚheadersÚbody)r   Úhttplib2ÚHttpÚrequestr   Ústatusr   )Úurlr#   ÚparamsÚcert_disabledÚresponseÚcontents   &&&   r   Ú
_http_postr.   L   s[   € ô 9Ó:€MÜ ŸšØ+8ôç�gˆc˜&¨'¼	À&Ó8I€gÓJñ €Hð ‡�˜#ÔÜ˜Ó*Ð*ØÐÐr   c                   ó’   a € ] tR t^[t o RtRtRtRtRtRt	R t
]R 4       tR]P                  ]3R	 lt]P                  3R
 ltRtV tR# )r   zÔStandard credentials storage and usage class.

:ivar consumer: The consumer (application)
:type consumer: `Consumer`
:ivar access_token: Access information on behalf of the user
:type access_token: `AccessToken`
NÚuriÚdictz<BR>Ú
c                óª   € \        4       pV P                  V4       VP                  4       p\        V\        4      '       d   VP                  R4      pV# )zUTurn this object into a string.

This should probably be moved into OAuthAuthorizer.
úutf-8)r
   ÚsaveÚgetvalueÚ
isinstanceÚstrÚencode)ÚselfÚsioÚ
serializeds   &  r   Ú	serializeÚCredentials.serializek   sD   € ô
 ‹jˆØ�	‰	�#ŒØ—\‘\“^ˆ
Ü�j¤#×&Ò&Ø#×*Ñ*¨7Ó3ˆJØÐr   c                ó–   € V ! 4       p\        V\        4      '       g   VP                  R4      pVP                  \	        V4      4       V# )zmCreate a `Credentials` object from a serialized string.

This should probably be moved into OAuthAuthorizer.
r4   )r7   r8   ÚdecodeÚloadr
   )ÚclsÚvalueÚcredentialss   && r   Úfrom_stringÚCredentials.from_stringw   s>   € ñ “eˆÜ˜%¤×%Ò%Ø—L‘L Ó)ˆEØ×Ñœ %›Ô)ØÐr   c                óØ  € V P                   f   Q R4       hV P                  e   Q R4       h\        P                  ! V4      p\	        V P                   P
                  RRR7      pV\        ,           pRV/pW0P                  8X  d   RVR&   \        WVV4      w  rx\        V\        4      '       d   VP                  R	4      pW0P                  8X  d;   \        P                  ! V4      pVe   WR
&   \        P                  V4      V n        V# \        P#                  V4      V n        V: \$        : RV P                   P
                  : 2pVe!   WP                   n        VRV,          ,          pV# )a[  Request an OAuth token to Launchpad.

Also store the token in self._request_token.

This method must not be called on an object with no consumer
specified or if an access token has already been obtained.

:param context: The context of this token, that is, its scope of
    validity within Launchpad.
:param web_root: The URL of the website on which the token
    should be requested.
:token_format: How the token should be
    presented. URI_TOKEN_FORMAT means just return the URL to
    the page that authorizes the token.  DICT_TOKEN_FORMAT
    means return a dictionary describing the token
    and the site's authentication policy.

:return: If token_format is URI_TOKEN_FORMAT, the URL for the
    user to authorize the `AccessToken` provided by
    Launchpad. If token_format is DICT_TOKEN_FORMAT, a dict of
    information about the new access token.
zConsumer not specified.zAccess token already obtained.Ú	PLAINTEXTÚ&)Úoauth_consumer_keyÚoauth_signature_methodÚoauth_signatureÚRefererzapplication/jsonÚAcceptr4   ú
lp.contextú?oauth_token=z&lp.context=%s)ÚconsumerÚaccess_tokenr   Úlookup_web_rootr1   ÚkeyÚrequest_token_pageÚDICT_TOKEN_FORMATr.   r7   Úbytesr@   ÚjsonÚloadsr   Úfrom_paramsÚ_request_tokenrE   Úauthorize_token_pageÚcontext)	r:   r]   Úweb_rootÚtoken_formatr*   r)   r#   r,   r-   s	   &&&&     r   Úget_request_tokenÚCredentials.get_request_tokenƒ   sN  € ð8 �}‰}Ò(ÐCÐ*CÓCÐ(Ø× Ñ Ò(ÐJÐ*JÓJÐ(Ü×'Ò'¨Ó1ˆÜØ#Ÿ}™}×0Ñ0Ø#.Øô
ˆð
 Ô+Õ+ˆØ˜hÐ'ˆØ×1Ñ1Ô1Ø 2ˆG�HÑÜ& s°VÓ<ÑˆÜ�gœu×%Ò%Ø—n‘n WÓ-ˆGØ×1Ñ1Ô1Ü—Z’Z Ó(ˆFØÒ"Ø'.�|Ñ$Ü"-×"9Ñ"9¸&Ó"AˆDÔØˆMä"-×"9Ñ"9¸'Ó"BˆDÔâß$Ø×#Ñ#×'Ó'ðˆCð
 Ò"Ø.5×#Ñ#Ô+ØÐ'¨'Õ1Õ1�ØˆJr   c                ór  € V P                   f   Q R4       h\        P                  ! V4      p\        V P                  P
                  RV P                   P
                  RV P                   P                  ,          R7      pV\        ,           pRV/p\        W4V4      w  rV\        P                  V4      V n        R# )a4  Exchange the previously obtained request token for an access token.

This method must not be called unless get_request_token() has been
called and completed successfully.

The access token will be stored as self.access_token.

:param web_root: The base URL of the website that granted the
    request token.
Nz5get_request_token() doesn't seem to have been called.rH   z&%s)rJ   rK   Úoauth_tokenrL   rM   )r[   r   rS   r1   rQ   rT   ÚsecretÚaccess_token_pager.   r   rE   rR   )r:   r^   r*   r)   r#   r,   r-   s   &&     r   Ú'exchange_request_token_for_access_tokenÚ3Credentials.exchange_request_token_for_access_tokenÀ   s¨   € ð ×ÑÒ+ð	CàBó	CØ+ä×'Ò'¨Ó1ˆÜØ#Ÿ}™}×0Ñ0Ø#.Ø×+Ñ+×/Ñ/Ø! D×$7Ñ$7×$>Ñ$>Õ>ô	
ˆð Ô*Õ*ˆØ˜hÐ'ˆÜ& s°VÓ<ÑˆÜ'×3Ñ3°GÓ<ˆÖr   )r[   rR   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r[   ÚURI_TOKEN_FORMATrV   ÚITEM_SEPARATORÚNEWLINEr=   ÚclassmethodrE   r   ÚSTAGING_WEB_ROOTr`   rf   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r   [   sl   ø‡ € ñð €NàÐØÐØ€NØ€Gò
ð ñ	ó ð	ð Ø×&Ñ&Ø%ô	;ð| ×,Ñ,÷=ò =r   c                   óD   a € ] tR t^Ýt o Rt]R 4       t]R 4       tRtV t	R# )r   zAn OAuth access token.c                óZ   € VR,          pVR,          pVP                  R4      pV ! W#V4      # )z:Create and return a new `AccessToken` from the given dict.rc   Úoauth_token_secretrO   )r   )rB   r*   rT   rd   r]   s   &&   r   rZ   ÚAccessToken.from_paramsà   s4   € ð �]Õ#ˆØÐ,Õ-ˆØ—*‘*˜\Ó*ˆÙ�3 Ó(Ð(r   c                óŠ  € \        V\        4      '       g   VP                  R4      p\        VRR7      pVR,          p\	        V4      ^8X  g   Q R4       hV^ ,          pVR,          p\	        V4      ^8X  g   Q R4       hV^ ,          pVP                  R4      pVe!   \	        V4      ^8X  g   Q R	4       hV^ ,          pV ! W4V4      # )
z<Create and return a new `AccessToken` from the given string.r4   F)Úkeep_blank_valuesrc   z/Query string must have exactly one oauth_token.rx   z*Query string must have exactly one secret.rO   z*Query string must have exactly one context)r7   r8   r@   r   Úlenr   )rB   Úquery_stringr*   rT   rd   r]   s   &&    r   rE   ÚAccessToken.from_stringè   sÈ   € ô ˜,¬×,Ò,Ø'×.Ñ.¨wÓ7ˆLÜ˜,¸%Ô@ˆØ�]Õ#ˆÜ�3‹x˜1Œ}ÐOÐOÓOˆ}Ø�!�fˆØÐ,Õ-ˆÜ�6‹{˜aÔÐMÐ!MÓMÐØ˜•ˆØ—*‘*˜\Ó*ˆØÒä�G“ Ô!ð<à;ó<Ø!à˜a•jˆGÙ�3 Ó(Ð(r   r   N)
rh   ri   rj   rk   rl   rp   rZ   rE   rr   rs   rt   s   @r   r   r   Ý   s.   ø‡ € Ù àñ)ó ð)ð ñ)ó ö)r   c                   ó6   a a€ ] tR t^ýt oRtV 3R ltRtVtV ;t# )r   zgAn OAuth access token that doesn't authenticate anybody.

This token can be used for anonymous access.
c                ó(   <€ \         SV `  R R 4       R# )Ú N©ÚsuperÚ__init__)r:   Ú	__class__s   &€r   r„   ÚAnonymousAccessToken.__init__  s   ø€ Ü‰Ñ˜˜RÖ r   r   )	rh   ri   rj   rk   rl   r„   rr   rs   Ú__classcell__©r…   ru   s   @@r   r   r   ý   s   ù‡ € ñ÷
!õ !r   c                   óF   a € ] tR tRt o RtR
R ltR tR tR tR t	R	t
V tR# )r   i  zÆStore OAuth credentials locally.

This is a generic superclass. To implement a specific way of
storing credentials locally you'll need to subclass this class,
and implement `do_save` and `do_load`.
Nc                ó   € Wn         R# )zÝConstructor.

:param credential_save_failed: A callback to be invoked if the
    save to local storage fails. You should never invoke this
    callback yourself! Instead, you should raise an exception
    from do_save().
N©Úcredential_save_failed)r:   rŒ   s   &&r   r„   ÚCredentialStore.__init__  s
   € ð '=Ö#r   c                ó²   €  V P                  W4       V#   \         d    h \         d,   pT P                  f   ThT P                  4         Rp?T# Rp?ii ; i)z„Save the credentials and invoke the callback on failure.

Do not override this method when subclassing. Override
do_save() instead.
N)Údo_saveÚEXPLOSIVE_ERRORSÚ	ExceptionrŒ   )r:   rD   Úunique_consumer_idÚes   &&& r   r5   ÚCredentialStore.save  s^   € ð	*Ø�L‰L˜Ô9ð Ðøô  ô 	ØÜô 	*Ø×*Ñ*Ò2Ø�Ø×'Ñ'×)Ð)ØÐûð		*ús   ‚ •AªA« AÁAc                ó   € \        4       h)zÕStore newly-authorized credentials locally for later use.

:param credentials: A Credentials object to save.
:param unique_consumer_id: A string uniquely identifying an
    OAuth consumer on a Launchpad instance.
©ÚNotImplementedError)r:   rD   r’   s   &&&r   r�   ÚCredentialStore.do_save)  s   € ô "Ó#Ð#r   c                ó$   € V P                  V4      # )aà  Retrieve credentials from a local store.

This method is the inverse of `save`.

There's no special behavior in this method--it just calls
`do_load`. There _is_ special behavior in `save`, and this
way, developers can remember to implement `do_save` and
`do_load`, not `do_save` and `load`.

:param unique_key: A string uniquely identifying an OAuth consumer
    on a Launchpad instance.

:return: A `Credentials` object if one is found in the local
    store, and None otherise.
)Údo_load©r:   Ú
unique_keys   &&r   rA   ÚCredentialStore.load2  s   € ð  �|‰|˜JÓ'Ð'r   c                ó   € \        4       h)a  Retrieve credentials from a local store.

This method is the inverse of `do_save`.

:param unique_key: A string uniquely identifying an OAuth consumer
    on a Launchpad instance.

:return: A `Credentials` object if one is found in the local
    store, and None otherise.
r–   r›   s   &&r   rš   ÚCredentialStore.do_loadD  s   € ô "Ó#Ð#r   r‹   ©N)rh   ri   rj   rk   rl   r„   r5   r�   rA   rš   rr   rs   rt   s   @r   r   r     s(   ø‡ € ñô=òò $ò(÷$$ð $r   c                   óZ   a a€ ] tR tRt oRtRtR	V 3R llt]R 4       tR t	R t
RtVtV ;t# )
ÚKeyringCredentialStoreiR  zæStore credentials in the GNOME keyring or KDE wallet.

This is a good solution for desktop applications and interactive
scripts. It doesn't work for non-interactive scripts, or for
integrating third-party websites into Launchpad.
s   <B64>c                óh   <€ \         SV `  V4       R V n        V'       d   \        V4      V n        R # R # r    )rƒ   r„   Ú	_fallbackÚMemoryCredentialStore)r:   rŒ   Úfallbackr…   s   &&&€r   r„   ÚKeyringCredentialStore.__init__\  s-   ø€ Ü‰ÑÐ/Ô0ØˆŒßÜ2Ð3IÓJˆDŽNñ r   c                 óŒ   € R\        4       9  d   ^ RIsR\        4       9  d
    ^ RIHs R# R#   \         d    \
        s R# i ; i)a  Ensure the keyring module is imported (postponing side effects).

The keyring module initializes the environment-dependent backend at
import time (nasty).  We want to avoid that initialization because it
may do things like prompt the user to unlock their password store
(e.g., KWallet).
ÚkeyringNÚNoKeyringError)rª   )Úglobalsr©   Úkeyring.errorsrª   ÚImportErrorÚRuntimeErrorr   r   r   Ú_ensure_keyring_importedÚ/KeyringCredentialStore._ensure_keyring_importedb  s>   € ð œG›IÔ%ãØ¤7£9Ô,ð.ß9ñ -øô ô .Ü!-“ð.ús   ¤. ®AÁAc                ó˜  € V P                  4        VP                  4       pV P                  \        V4      ,           p \        P                  RW#P                  R4      4       R#   \         dZ   p\        \        8X  d   R\        T4      9  d   h T P                  '       d"   T P                  P                  Y4        Rp?R# h Rp?ii ; i)z2Store newly-authorized credentials in the keyring.Úlaunchpadlibr4   ú$No recommended backend was availableN)r¯   r=   Ú	B64MARKERr	   r©   Úset_passwordr@   rª   r®   r8   r¤   r5   )r:   rD   rœ   r<   r“   s   &&&  r   r�   ÚKeyringCredentialStore.do_saveu  s    € à×%Ñ%Ô'Ø ×*Ñ*Ó,ˆ
ð —^‘^¤i°
Ó&;Õ;ˆ
ð	Ü× Ñ Ø 
×,=Ñ,=¸gÓ,Föøô ô 	ô ¤,Ô.Ø:Ä#ÀaÃ&ÔHàØ�~�~ˆ~Ø—‘×#Ñ# K×<Ò<àûð	ús#   ¾%A% Á%C	Á01CÂ"CÃCÃC	c                ót  € V P                  4         \        P                  RV4      pTeƒ   \        T\
        4      '       d   TP                  R4      pTP                  T P                  4      '       d#    \        T\        T P                  4      R 4      p \        P!                  T4      pT# R#   \         dY   p\        \        8X  d   R\        T4      9  d   h T P                  '       d!   T P                  P                  T4      u Rp?# h Rp?ii ; i  \         d     R# i ; i  \"         d     R# i ; i)z&Retrieve credentials from the keyring.r²   r³   NÚutf8)r¯   r©   Úget_passwordrª   r®   r8   r¤   rA   r7   r9   Ú
startswithr´   r   r|   Ú	TypeErrorr   rE   r‘   )r:   rœ   Úcredential_stringr“   rD   s   &&   r   rš   ÚKeyringCredentialStore.do_loadŽ  s!  € à×%Ñ%Ô'ð	Ü '× 4Ñ 4Ø 
ó!Ðð Ò(ÜÐ+¬S×1Ò1Ø$5×$<Ñ$<¸VÓ$DÐ!Ø ×+Ñ+¨D¯N©N×;Ò;ð Ü(1Ø)¬#¨d¯n©nÓ*=Ð*?Ð@ó)Ð%ðÜ)×5Ñ5Ð6GÓH�Ø"Ð"ñ øôA ô 	ô ¤,Ô.Ø:Ä#ÀaÃ&ÔHàØ�~�~ˆ~Ø—~‘~×*Ñ*¨:Ó6Õ6àûð	ûô( !ô  ò  ð ûô ô ò ð	úsM   ’B0 Á5!D ÂD( Â0DÂ;1DÃ-DÄDÄDÄDÄD%Ä$D%Ä(D7Ä6D7)r¤   )NF)rh   ri   rj   rk   rl   r´   r„   Ústaticmethodr¯   r�   rš   rr   rs   r‡   rˆ   s   @@r   r¢   r¢   R  s:   ù‡ € ñð €I÷Kð ñ.ó ð.ò$÷2'ò 'r   r¢   c                   óF   a a€ ] tR tRt oRtRV 3R lltR tR tRtVt	V ;t
# )ÚUnencryptedFileCredentialStorei¸  z…Store credentials unencrypted in a file on disk.

This is a good solution for scripts that need to run without any
user interaction.
c                ó2   <€ \         SV `  V4       Wn        R # r    )rƒ   r„   Úfilename)r:   rÂ   rŒ   r…   s   &&&€r   r„   Ú'UnencryptedFileCredentialStore.__init__¿  s   ø€ Ü‰ÑÐ/Ô0Ø Žr   c                ó<   € VP                  V P                  4       R# )zSave the credentials to disk.N)Úsave_to_pathrÂ   ©r:   rD   rœ   s   &&&r   r�   Ú&UnencryptedFileCredentialStore.do_saveÃ  s   € à× Ñ  §¡Ö/r   c                ó  € \         P                  P                  V P                  4      '       dZ   \         P                  ! V P                  4      \        P
                  ,          ^ 8X  g    \        P                  V P                  4      # R# )zLoad the credentials from disk.N)r   ÚpathÚexistsrÂ   ÚstatÚST_SIZEr   Úload_from_pathr›   s   &&r   rš   Ú&UnencryptedFileCredentialStore.do_loadÇ  sQ   € ô �G‰G�N‰N˜4Ÿ=™=×)Ò)Ü—G’G˜DŸM™MÓ*¬4¯<©<Õ8¸AÔ=ä×-Ñ-¨d¯m©mÓ<Ð<Ùr   )rÂ   r    ©rh   ri   rj   rk   rl   r„   r�   rš   rr   rs   r‡   rˆ   s   @@r   rÀ   rÀ   ¸  s   ù‡ € ñ÷!ò0÷ò r   rÀ   c                   óF   a a€ ] tR tRt oRtRV 3R lltR tR tRtVt	V ;t
# )r¥   iÑ  z CredentialStore that stores keys only in memory.

This can be used to provide a CredentialStore instance without
actually saving any key to persistent storage.
c                ó4   <€ \         SV `  V4       / V n        R # r    )rƒ   r„   Ú_credentials)r:   rŒ   r…   s   &&€r   r„   ÚMemoryCredentialStore.__init__Ø  s   ø€ Ü‰ÑÐ/Ô0ØˆÖr   c                ó"   € WP                   V&   R# )z!Store the credentials in our dictN©rÒ   rÆ   s   &&&r   r�   ÚMemoryCredentialStore.do_saveÜ  s   € à(3×Ñ˜*Ó%r   c                ó8   € V P                   P                  V4      # )z&Retrieve the credentials from our dict)rÒ   r   r›   s   &&r   rš   ÚMemoryCredentialStore.do_loadà  s   € à× Ñ ×$Ñ$ ZÓ0Ð0r   rÕ   r    rÏ   rˆ   s   @@r   r¥   r¥   Ñ  s   ù‡ € ñ÷ò4÷1ò 1r   r¥   c                   óZ   a € ] tR tRt o RtRtRR lt]R 4       tR t	R t
R	 tR
 tRtV tR# )r   iå  a  The superclass of all request token authorizers.

This base class does not implement request token authorization,
since that varies depending on how you want the end-user to
authorize a request token. You'll need to subclass this class and
implement `make_end_user_authorize_token`.
ÚUNAUTHORIZEDNc                óJ  € \         P                  ! V4      V n        \         P                  ! V4      V n        Vf   Vf   \        R4      hVe   Ve   \        RV: RV: R24      hVf   R.p\        V4      pM\        V4      pTpWPn        W n	        T;'       g    . V n
        R# )a¬  Base class initialization.

:param service_root: The root of the Launchpad instance being
    used.

:param application_name: The name of the application that
    wants to use launchpadlib. This is used in conjunction
    with a desktop-wide integration.

    If you specify this argument, your values for
    consumer_name and allow_access_levels are ignored.

:param consumer_name: The OAuth consumer name, for an
    application that wants its own point of integration into
    Launchpad. In almost all cases, you want to specify
    application_name instead and do a desktop-wide
    integration. The exception is when you're integrating a
    third-party website into Launchpad.

:param allow_access_levels: A list of the Launchpad access
    levels to present to the user. ('READ_PUBLIC' and so on.)
    Your value for this argument will be ignored during a
    desktop-wide integration.
:type allow_access_levels: A list of strings.
Nz:You must provide either application_name or consumer_name.zOYou must provide only one of application_name and consumer_name. (You provided z and z.)ÚDESKTOP_INTEGRATION)r   Úlookup_service_rootÚservice_rootÚweb_root_for_service_rootr^   Ú
ValueErrorr   r   rQ   Úapplication_nameÚallow_access_levels)r:   rÞ   rá   Úconsumer_namerâ   rQ   s   &&&&& r   r„   Ú(RequestTokenAuthorizationEngine.__init__ð  s¶   € ô@ !×4Ò4°\ÓBˆÔÜ×6Ò6°|ÓDˆŒàÒ#¨Ò(=ÜØLóð ð Ò'¨MÒ,EÝó $£]ð4óð ð Ò ð $9Ð"9ÐÜ)Ð*:Ó;‰Hô   Ó.ˆHØ,Ðà ŒØ 0Ôà#6×#<Ð#<¸"ˆÖ r   c                ó^   € V P                   P                  R,           V P                  ,           # )z7Return a string identifying this consumer on this host.Ú@)rQ   rT   rÞ   )r:   s   &r   r’   Ú2RequestTokenAuthorizationEngine.unique_consumer_id0  s$   € ð �}‰}× Ñ  3Õ&¨×):Ñ):Õ:Ð:r   c                óÐ   € \         : RV: 2pRp\        V P                  4      ^ 8”  d)   W#VP                  V P                  4      ,           ,          p\	        V P
                  V4      # )z¾Return the authorization URL for a request token.

This is the URL the end-user must visit to authorize the
token. How exactly does this happen? That depends on the
subclass implementation.
rP   z&allow_permission=)r\   r|   râ   Újoinr   r^   )r:   Úrequest_tokenÚpageÚallow_permissions   &&  r   Úauthorization_urlÚ1RequestTokenAuthorizationEngine.authorization_url5  s`   € ÷ ';ºMÐJˆØ/ÐÜˆt×'Ñ'Ó(¨1Ô,ØÐ'7×'<Ñ'<Ø×(Ñ(ó(õ õ ˆDô �t—}‘} dÓ+Ð+r   c                ó    € V P                  V4      pV P                  W4       VP                  f   R# VP                  WP                  4       V# )aô  Authorize a token and associate it with the given credentials.

If the credential store runs into a problem storing the
credential locally, the `credential_save_failed` callback will
be invoked. The callback will not be invoked if there's a
problem authorizing the credentials.

:param credentials: A `Credentials` object. If the end-user
    authorizes these credentials, this object will have its
    .access_token property set.

:param credential_store: A `CredentialStore` object. If the
    end-user authorizes the credentials, they will be
    persisted locally using this object.

:return: If the credentials are successfully authorized, the
    return value is the `Credentials` object originally passed
    in. Otherwise the return value is None.
N)r`   Úmake_end_user_authorize_tokenrR   r5   r’   )r:   rD   Úcredential_storeÚrequest_token_strings   &&& r   Ú__call__Ú(RequestTokenAuthorizationEngine.__call__D  sL   € ð(  $×5Ñ5°kÓBÐà×*Ñ*¨;ÔMØ×#Ñ#Ò+áà×Ñ˜k×+BÑ+BÔCØÐr   c                ój   € VP                  V P                  \        P                  R7      pVR,          # )zLGet a new request token from the server.

:param return: The request token.
)r^   r_   rc   )r`   r^   r   rV   )r:   rD   Úauthorization_jsons   && r   r`   Ú1RequestTokenAuthorizationEngine.get_request_tokenb  s6   € ð
 )×:Ñ:Ø—]‘]´×1NÑ1Nð ;ó 
Ðð " -Õ0Ð0r   c                ó   € \        4       h)aí  Authorize the given request token using the given credentials.

Your subclass must implement this method: it has no default
implementation.

Because an access token may expire or be revoked in the middle
of a session, this method may be called at arbitrary points in
a launchpadlib session, or even multiple times during a single
session (with a different request token each time).

In most cases, however, this method will be called at the
beginning of a launchpadlib session, or not at all.
r–   )r:   rD   rê   s   &&&r   rð   Ú=RequestTokenAuthorizationEngine.make_end_user_authorize_tokenl  s   € ô "Ó#Ð#r   )râ   rá   rQ   rÞ   r^   ©NNN)rh   ri   rj   rk   rl   ÚUNAUTHORIZED_ACCESS_LEVELr„   Úpropertyr’   rí   ró   r`   rð   rr   rs   rt   s   @r   r   r   å  sE   ø‡ € ñð !/Ðô>=ð@ ñ;ó ð;ò,òò<1÷$ð $r   c                   óJ   a € ] tR tRt o RtRtRtR tR tR t	R t
R	 tR
tV tR# )ÚAuthorizeRequestTokenWithURLi}  zŠAuthorize using a URL.

This authorizer simply shows the URL for the user to open for
authorization, and waits until the server responds.
zŠPlease open this authorization page:
 (%s)
in your browser. Use your browser to authorize
this program to access Launchpad on your behalf.z.Press Enter after authorizing in your browser.c                ó   € \        V4       R# )z“Display a message.

By default, prints the message to standard output. The message
does not require any user interaction--it's solely
informative.
N)Úprint)r:   Úmessages   &&r   ÚoutputÚ#AuthorizeRequestTokenWithURL.outputŒ  s   € ô 	ˆgŽr   c                óJ   € V P                  V P                  V,          4       R# )úNotify the end-user of the URL.N)r  ÚWAITING_FOR_USER)r:   rí   s   &&r   Ú!notify_end_user_authorization_urlÚ>AuthorizeRequestTokenWithURL.notify_end_user_authorization_url•  s   € à�‰�D×)Ñ)Ð,=Õ=Ö>r   c                óh  €  VP                  V P                  4       TP                  RJ#   \         d|   pTP                  P                  R8X  d   \        TP                  4      hTP                  P                  R8w  d   \        R4       \        T4       \        TP                  4      hRp?ii ; i)z Check if the end-user authorizedi“  i‘  z#Unexpected response from Launchpad:N)
rf   r^   r   r,   r(   ÚEndUserDeclinedAuthorizationr-   r   ÚEndUserNoAuthorizationrR   )r:   rD   r“   s   && r   Úcheck_end_user_authorizationÚ9AuthorizeRequestTokenWithURL.check_end_user_authorization™  s’   € ð	8Ø×?Ñ?ÀÇÁÔNð ×'Ñ'¨tÐ3Ð3øô ô 	8Ø�z‰z× Ñ  CÔ'ô 3°1·9±9Ó=Ð=à—:‘:×$Ñ$¨Ô+äÐ?Ô@Ü˜!”Hä,¨Q¯Y©YÓ7Ð7ûð	8ús   ‚+ «B1¶A6B,Â,B1c                óˆ   € V P                  V P                  4       \        P                  ! 4        V P	                  V4       R# )ú"Wait for the end-user to authorizeN)r  ÚWAITING_FOR_LAUNCHPADr   Úreadliner  )r:   rD   s   &&r   Úwait_for_end_user_authorizationÚ<AuthorizeRequestTokenWithURL.wait_for_end_user_authorization«  s,   € à�‰�D×.Ñ.Ô/Ü�ŠÔØ×)Ñ)¨+Ö6r   c                ól   € V P                  V4      pV P                  V4       V P                  V4       R# )z2Have the end-user authorize the token using a URL.N)rí   r  r  )r:   rD   rê   rí   s   &&& r   rð   Ú:AuthorizeRequestTokenWithURL.make_end_user_authorize_token±  s0   € à ×2Ñ2°=ÓAÐØ×.Ñ.Ð/@ÔAØ×,Ñ,¨[Ö9r   r   N)rh   ri   rj   rk   rl   r  r  r  r  r  r  rð   rr   rs   rt   s   @r   rþ   rþ   }  s;   ø‡ € ñð	;ð ð MÐòò?ò4ò$7÷:ð :r   rþ   c                   ó`   a a€ ] tR tRt oRtRtRt^tR
tRt	RV 3R llt
V 3R ltR tR	tVtV ;t# )r   i¸  a;  Authorize using a URL that pops-up automatically in a browser.

This authorizer simply opens up the end-user's web browser to a
Launchpad URL and lets the end-user authorize the request token
themselves.

This is the same as its superclass, except this class also
performs the browser automatic opening of the URL.
z�The authorization page:
 (%s)
should be opening in your browser. Use your browser to authorize
this program to access Launchpad on your behalf.z/Press Enter to continue or wait (%d) seconds...z5Waiting to hear from Launchpad about your decision...c                ó*   <€ \         SV `  WRV4       R# )a  Constructor.

:param service_root: See `RequestTokenAuthorizationEngine`.
:param application_name: See `RequestTokenAuthorizationEngine`.
:param consumer_name: The value of this argument is
    ignored. If we have the capability to open the end-user's
    web browser, we must be running on the end-user's computer,
    so we should do a full desktop integration.
:param credential_save_failed: See `RequestTokenAuthorizationEngine`.
:param allow_access_levels: The value of this argument is
    ignored, for the same reason as consumer_name.
Nr‚   )r:   rÞ   rá   rã   rŒ   râ   r…   s   &&&&&&€r   r„   Ú)AuthorizeRequestTokenWithBrowser.__init__Ù  s   ø€ ô. 	‰ÑØ¨DÐ2Hö	
r   c                óâ  <€ \         SV `  V4        \        P                  ! 4       p\	        VRR4      pW0P
                  9   pV'       dk   V P                  V P                  V P                  ,          4       \        \        .. . V P                  4      w  p pV'       d   \        P                  ! 4        Ve   \        P                  ! V4       R# R#   \        P                   d    RpRp L«i ; i)r  ÚbasenameNF)rƒ   r  Ú
webbrowserr   ÚgetattrÚTERMINAL_BROWSERSÚErrorr  ÚTIMEOUT_MESSAGEÚTIMEOUTr   r   r  Úopen)r:   rí   Úbrowser_objÚbrowserÚconsole_browserÚrlistÚ_r…   s   &&     €r   r  ÚBAuthorizeRequestTokenWithBrowser.notify_end_user_authorization_urlô  sÂ   ø€ ä‰Ñ1Ð2CÔDð	$Ü$Ÿ.š.Ó*ˆKÜ˜k¨:°tÓ<ˆGØ%×)?Ñ)?Ñ?ˆO÷
 Ø�K‰K˜×,Ñ,¨t¯|©|Õ;Ô<ô !¤% ¨"¨b°$·,±,Ó?‰KˆE�1�aßÜ—’Ô àÒ"Ü�OŠOÐ-Ö.ñ #øô ×Ñô 	$ØˆKØ#ŠOð	$ús   ’0C ÃC.Ã-C.c                óˆ  € V P                  V P                  4       \        P                  ! 4       pVP                  fs   \        P                  ! \
        4        V P                  V4      '       d   R#  \        P                  ! 4       V\        ,           8¼  g   Kj  \        R\        ,          4      hR#   \         d     LLi ; i)r  NzTimed out after %d seconds.)
r  r  ÚtimerR   ÚsleepÚaccess_token_poll_timer  r  Úaccess_token_poll_timeoutÚTokenAuthorizationTimedOut)r:   rD   Ú
start_times   && r   r  Ú@AuthorizeRequestTokenWithBrowser.wait_for_end_user_authorization  sœ   € à�‰�D×.Ñ.Ô/Ü—Y’Y“[ˆ
Ø×&Ñ&Ò.Ü�JŠJÔ-Ô.ðØ×4Ñ4°[×AÒAÙð Bô �yŠy‹{˜jÔ+DÕDÖDÜ0Ø1Ô4MÕMóð ñ /øô
 *ô Ùðús   ÁB3 Â3CÃ Cr   )zwww-browserÚlinksÚlinks2ÚlynxÚelinkszelinks-liteÚnetrikÚw3mrú   )rh   ri   rj   rk   rl   r  r  r   r  r  r„   r  r  rr   rs   r‡   rˆ   s   @@r   r   r   ¸  sH   ù‡ € ñð	;ð ð H€OØ€Gð	Ðð 	@ð ÷
õ6/÷.ò r   c                   ó   € ] tR tRtRtR# )ÚTokenAuthorizationExceptioni  r   N©rh   ri   rj   rk   rr   r   r   r   r7  r7    ó   † Ûr   r7  c                   ó   € ] tR tRtRtR# )ÚRequestTokenAlreadyAuthorizedi   r   Nr8  r   r   r   r;  r;     r9  r   r;  c                   ó   € ] tR tRtRtRtR# )ÚEndUserAuthorizationFailedi$  z?Superclass exception for all failures of end-user authorizationr   N©rh   ri   rj   rk   rl   rr   r   r   r   r=  r=  $  s   † ÙIãr   r=  c                   ó   € ] tR tRtRtRtR# )r
  i*  zEnd-user declined authorizationr   Nr>  r   r   r   r
  r
  *  s   † Ù)ãr   r
  c                   ó   € ] tR tRtRtRtR# )r  i0  z*End-user did not perform any authorizationr   Nr>  r   r   r   r  r  0  s   † Ù4ãr   r  c                   ó   € ] tR tRtRtRtR# )r-  i6  z<End-user did not perform any authorization in timeout periodr   Nr>  r   r   r   r-  r-  6  s   † ÙFãr   r-  c                   ó   € ] tR tRtRtR# )ÚClientErrori<  r   Nr8  r   r   r   rC  rC  <  r9  r   rC  c                   ó   € ] tR tRtRtR# )ÚServerErrori@  r   Nr8  r   r   r   rE  rE  @  r9  r   rE  c                   ó   € ] tR tRtRtR# )ÚNoLaunchpadAccountiD  r   Nr8  r   r   r   rG  rG  D  r9  r   rG  c                   ó   € ] tR tRtRtR# )ÚTooManyAuthenticationFailuresiH  r   Nr8  r   r   r   rI  rI  H  r9  r   rI  )r   r   r   r   r   r   r   i„  )=rl   Ú__all__Úbase64r   r	   r%   Úior
   rX   r   r   rË   Úsysr   r)  Úurllib.parser   r   r   r  Úlazr.restfulclient.errorsr   Ú"lazr.restfulclient.authorize.oauthr   Ú_AccessTokenr   r   r   r²   r   rU   re   r\   r+  r,  ÚMemoryErrorÚKeyboardInterruptÚ
SystemExitr�   r   r.   r   r   r   r¢   rÀ   r¥   r   rþ   r   r‘   r7  r;  r=  r
  r  r-  rC  rE  rG  rI  r   r   r   Ú<module>rU     sŠ  ðñ" ;ò€÷ó Ý Û Û 	Ý Û Ý Û ß 5Ñ 5Û å /÷ó õ à%Ð Ø#Ð Ø)Ð ØÐ Ø#Ð àÐ!2°JÐ?Ð ò
Pòô=�/ô =ôD)�,ô )ô@!˜<ô !÷H$ñ H$ôVc˜_ô côL _ô ô21˜Oô 1÷(U$ñ U$ôp8:Ð#Bô 8:ôvaÐ'Cô aôH	 )ô 	ô	Ð$?ô 	ô	Ð!<ô 	ô	Ð#=ô 	ô	Ð7ô 	ô	Ð!7ô 	ô	Ð-ô 	ô	Ð-ô 	ô	Ð4ô 	ô	Ð$?ö 	r   