+
    Z4iv                        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      # )zWhether 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# )zPOST 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gc&'	&8Ig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   zStandard 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3J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%%%LL)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 2GH&sV<gu%%nnW-G111ZZ(F"'.|$"-"9"9&"ADM"-"9"9'"BD$##''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_token3Credentials.exchange_request_token_for_access_token   s     +	CB	C+''1#}}00#.++//!D$7$7$>$>>	
 **h'&sV<'33G<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7L,%@]#3x1}OOO}!f,-6{aM!MM**\*G!<;<!ajG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  zStore 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# )zConstructor.

: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)zSave 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^    	*LL9    	 	***2''))		*s    AA AAc                    \        4       h)zStore 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  zStore 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23IJDN 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>     GI%79,.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! ++DNN;; (1)#dnn*=*?@)%)556G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  zStore 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     GGNN4==))GGDMM*4<<8A=--dmm<<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  zCredentialStore 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      # )zReturn 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_url1RequestTokenAuthorizationEngine.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5k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    
 )::]]1N1N ; 
 "-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}  zAuthorize using a URL.

This authorizer simply shows the URL for the user to open for
authorization, and waits until the server responds.
zPlease 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# )zDisplay 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_authorization9AuthorizeRequestTokenWithURL.check_end_user_authorization  s    	8??N ''t33  	8zz  C' 3199==::$$+?@!H,QYY77	8s   + 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.
zThe 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    . 	D2H	
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 Li ; 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    12CD	$$..*Kk:t<G%)?)??O
 KK,,t||;< !%"b$,,?KE1a "OO-. #  	$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../YY[
&&.JJ-.44[AA B yy{j+DDD014M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  /  % # )  # !2J? 
P=/ =D), )@!< !H$ H$Vc_ cL_ 21O 1(U$ U$p8:#B 8:va'C aH	) 		$? 		!< 		#= 		7 		!7 		- 		- 		4 		$? 	r   