ó ôBQc@ssdZddlZddlZddlZddlZdZdZdZdZdZ dZ d „Z e d „Z dS( s=Helper routines to facilitate use of oauth2_client in gsutil.iÿÿÿÿNs'909320924072.apps.googleusercontent.comsp3RlpR10xMFh9ZXBS/ZNLYUutGoogles)https://accounts.google.com/o/oauth2/auths*https://accounts.google.com/o/oauth2/tokensurn:ietf:wg:oauth:2.0:oobc Cs€d}|jdddƒ}|dkri|jddƒrZtjd|jddƒƒ}q”tjƒ}n+|dkr„tjƒ}ntd|ƒ‚d}|jdd ƒré|jdd ƒréd |jdd ƒ|jdd ƒf}n|jdd tƒ}|jdd tƒ}|jddt ƒ}|jddt ƒ}|jddt ƒ}tj tj |||ƒ||d |d|ƒS(NtOAuth2t token_cachet file_systemttoken_cache_path_patternt path_patternt in_memorys6Invalid value for config option OAuth2/token_cache: %stBototproxyt proxy_ports%s:%stprovider_labeltprovider_authorization_uritprovider_token_urit client_idt client_secrettaccess_token_cache(tNonetgett has_optiont oauth2_clienttFileSystemTokenCachetInMemoryTokenCachet ExceptiontGOOGLE_OAUTH2_PROVIDER_LABELt(GOOGLE_OAUTH2_PROVIDER_AUTHORIZATION_URIt GOOGLE_OAUTH2_PROVIDER_TOKEN_URItGSUTIL_CLIENT_IDtGSUTIL_CLIENT_NOTSOSECRETt OAuth2ClienttOAuth2Provider( tconfigRttoken_cache_typeRR R R R R((s9/tmp/tmp.yUYbTOKr8o/gsutil/oauth2_plugin/oauth2_helper.pytOAuth2ClientFromBotoConfig&s@       cCsÄ|jt|ƒ}|r/tjjd|ƒntjjd|ƒtjjdƒ|rŒtj|dddtƒ rŒtjjd|ƒntj dƒt d ƒ}|j |t|ƒ\}}|S( NsÚAttempting to launch a browser with the OAuth2 approval dialog at URL: %s [Note: due to a Python bug, you may see a spurious error message "object is not callable [...] in [...] Popen.__del__" which can be ignored.] s6Please navigate your browser to the following URL: %s s¸In your browser you should see a page that requests you to authorize gsutil to access Google Cloud Storage on your behalf. After you approve, an authorization code will be displayed. tnewit autoraises]Launching browser appears to have failed; please navigate a browser to the following URL: %s isEnter the authorization code: ( tGetAuthorizationUritOOB_REDIRECT_URItsyststdouttwritet webbrowsertopentTruettimetsleept raw_inputtExchangeAuthorizationCode(Rtscopestlaunch_browsert approval_urltcodet refresh_tokent access_token((s9/tmp/tmp.yUYbTOKr8o/gsutil/oauth2_plugin/oauth2_helper.pytOAuth2ApprovalFlowOs(        (t__doc__R%R+R(RRRRRRR$R tFalseR5(((s9/tmp/tmp.yUYbTOKr8o/gsutil/oauth2_plugin/oauth2_helper.pyts     )