diff --git a/docs/build b/doc-build similarity index 100% rename from docs/build rename to doc-build diff --git a/docs/epy/api-objects.txt b/docs/epy/api-objects.txt deleted file mode 100644 index ef1ed4c..0000000 --- a/docs/epy/api-objects.txt +++ /dev/null @@ -1,585 +0,0 @@ -oauth2client oauth2client-module.html -oauth2client.GOOGLE_REVOKE_URI oauth2client-module.html#GOOGLE_REVOKE_URI -oauth2client.GOOGLE_TOKEN_URI oauth2client-module.html#GOOGLE_TOKEN_URI -oauth2client.GOOGLE_DEVICE_URI oauth2client-module.html#GOOGLE_DEVICE_URI -oauth2client.GOOGLE_AUTH_URI oauth2client-module.html#GOOGLE_AUTH_URI -oauth2client.appengine oauth2client.appengine-module.html -oauth2client.appengine._safe_html oauth2client.appengine-module.html#_safe_html -oauth2client.appengine._build_state_value oauth2client.appengine-module.html#_build_state_value -oauth2client.appengine.XSRF_MEMCACHE_ID oauth2client.appengine-module.html#XSRF_MEMCACHE_ID -oauth2client.appengine.OAUTH2CLIENT_NAMESPACE oauth2client.appengine-module.html#OAUTH2CLIENT_NAMESPACE -oauth2client.appengine.logger oauth2client.appengine-module.html#logger -oauth2client.appengine._generate_new_xsrf_secret_key oauth2client.appengine-module.html#_generate_new_xsrf_secret_key -oauth2client.appengine.xsrf_secret_key oauth2client.appengine-module.html#xsrf_secret_key -oauth2client.appengine.ndb oauth2client.appengine-module.html#ndb -oauth2client.appengine.oauth2decorator_from_clientsecrets oauth2client.appengine-module.html#oauth2decorator_from_clientsecrets -oauth2client.appengine._parse_state_value oauth2client.appengine-module.html#_parse_state_value -oauth2client.client oauth2client.client-module.html -oauth2client.client._get_well_known_file oauth2client.client-module.html#_get_well_known_file -oauth2client.client._extract_id_token oauth2client.client-module.html#_extract_id_token -oauth2client.client.HAS_CRYPTO oauth2client.client-module.html#HAS_CRYPTO -oauth2client.client._get_environment oauth2client.client-module.html#_get_environment -oauth2client.client.AUTHORIZED_USER oauth2client.client-module.html#AUTHORIZED_USER -oauth2client.client.ADC_HELP_MSG oauth2client.client-module.html#ADC_HELP_MSG -oauth2client.client._get_application_default_credential_GCE oauth2client.client-module.html#_get_application_default_credential_GCE -oauth2client.client._get_application_default_credential_from_file oauth2client.client-module.html#_get_application_default_credential_from_file -oauth2client.client._get_application_default_credential_GAE oauth2client.client-module.html#_get_application_default_credential_GAE -oauth2client.client.credentials_from_code oauth2client.client-module.html#credentials_from_code -oauth2client.client.ID_TOKEN_VERIFICATON_CERTS oauth2client.client-module.html#ID_TOKEN_VERIFICATON_CERTS -oauth2client.client.credentials_from_clientsecrets_and_code oauth2client.client-module.html#credentials_from_clientsecrets_and_code -oauth2client.client._raise_exception_for_missing_fields oauth2client.client-module.html#_raise_exception_for_missing_fields -oauth2client.client.EXPIRY_FORMAT oauth2client.client-module.html#EXPIRY_FORMAT -oauth2client.client.logger oauth2client.client-module.html#logger -oauth2client.client._update_query_params oauth2client.client-module.html#_update_query_params -oauth2client.client._env_name oauth2client.client-module.html#_env_name -oauth2client.client.AccessTokenInfo oauth2client.client-module.html#AccessTokenInfo -oauth2client.client._abstract oauth2client.client-module.html#_abstract -oauth2client.client.clean_headers oauth2client.client-module.html#clean_headers -oauth2client.client._get_environment_variable_file oauth2client.client-module.html#_get_environment_variable_file -oauth2client.client.OOB_CALLBACK_URN oauth2client.client-module.html#OOB_CALLBACK_URN -oauth2client.client._raise_exception_for_reading_json oauth2client.client-module.html#_raise_exception_for_reading_json -oauth2client.client._parse_exchange_token_response oauth2client.client-module.html#_parse_exchange_token_response -oauth2client.client.HAS_OPENSSL oauth2client.client-module.html#HAS_OPENSSL -oauth2client.client.ID_TOKEN_VERIFICATION_CERTS oauth2client.client-module.html#ID_TOKEN_VERIFICATION_CERTS -oauth2client.client._RequireCryptoOrDie oauth2client.client-module.html#_RequireCryptoOrDie -oauth2client.client.GOOGLE_APPLICATION_CREDENTIALS oauth2client.client-module.html#GOOGLE_APPLICATION_CREDENTIALS -oauth2client.client._cached_http oauth2client.client-module.html#_cached_http -oauth2client.client.verify_id_token oauth2client.client-module.html#verify_id_token -oauth2client.client.flow_from_clientsecrets oauth2client.client-module.html#flow_from_clientsecrets -oauth2client.client.save_to_well_known_file oauth2client.client-module.html#save_to_well_known_file -oauth2client.client.SERVICE_ACCOUNT oauth2client.client-module.html#SERVICE_ACCOUNT -oauth2client.client._urlsafe_b64decode oauth2client.client-module.html#_urlsafe_b64decode -oauth2client.client.REFRESH_STATUS_CODES oauth2client.client-module.html#REFRESH_STATUS_CODES -oauth2client.clientsecrets oauth2client.clientsecrets-module.html -oauth2client.clientsecrets.load oauth2client.clientsecrets-module.html#load -oauth2client.clientsecrets.TYPE_INSTALLED oauth2client.clientsecrets-module.html#TYPE_INSTALLED -oauth2client.clientsecrets._validate_clientsecrets oauth2client.clientsecrets-module.html#_validate_clientsecrets -oauth2client.clientsecrets.TYPE_WEB oauth2client.clientsecrets-module.html#TYPE_WEB -oauth2client.clientsecrets.VALID_CLIENT oauth2client.clientsecrets-module.html#VALID_CLIENT -oauth2client.clientsecrets.loadfile oauth2client.clientsecrets-module.html#loadfile -oauth2client.clientsecrets._loadfile oauth2client.clientsecrets-module.html#_loadfile -oauth2client.clientsecrets.loads oauth2client.clientsecrets-module.html#loads -oauth2client.crypt oauth2client.crypt-module.html -oauth2client.crypt.AUTH_TOKEN_LIFETIME_SECS oauth2client.crypt-module.html#AUTH_TOKEN_LIFETIME_SECS -oauth2client.crypt.PyCryptoVerifier oauth2client.crypt-module.html#PyCryptoVerifier -oauth2client.crypt.Verifier oauth2client.crypt-module.html#Verifier -oauth2client.crypt.PyCryptoSigner oauth2client.crypt-module.html#PyCryptoSigner -oauth2client.crypt.OpenSSLSigner oauth2client.crypt-module.html#OpenSSLSigner -oauth2client.crypt.MAX_TOKEN_LIFETIME_SECS oauth2client.crypt-module.html#MAX_TOKEN_LIFETIME_SECS -oauth2client.crypt.logger oauth2client.crypt-module.html#logger -oauth2client.crypt._parse_pem_key oauth2client.crypt-module.html#_parse_pem_key -oauth2client.crypt.OpenSSLVerifier oauth2client.crypt-module.html#OpenSSLVerifier -oauth2client.crypt._urlsafe_b64encode oauth2client.crypt-module.html#_urlsafe_b64encode -oauth2client.crypt.Signer oauth2client.crypt-module.html#Signer -oauth2client.crypt._urlsafe_b64decode oauth2client.crypt-module.html#_urlsafe_b64decode -oauth2client.crypt.verify_signed_jwt_with_certs oauth2client.crypt-module.html#verify_signed_jwt_with_certs -oauth2client.crypt.CLOCK_SKEW_SECS oauth2client.crypt-module.html#CLOCK_SKEW_SECS -oauth2client.crypt._json_encode oauth2client.crypt-module.html#_json_encode -oauth2client.crypt.make_signed_jwt oauth2client.crypt-module.html#make_signed_jwt -oauth2client.django_orm oauth2client.django_orm-module.html -oauth2client.file oauth2client.file-module.html -oauth2client.gce oauth2client.gce-module.html -oauth2client.gce.META oauth2client.gce-module.html#META -oauth2client.gce.logger oauth2client.gce-module.html#logger -oauth2client.keyring_storage oauth2client.keyring_storage-module.html -oauth2client.locked_file oauth2client.locked_file-module.html -oauth2client.locked_file._FcntlOpener oauth2client.locked_file-module.html#_FcntlOpener -oauth2client.locked_file._Win32Opener oauth2client.locked_file-module.html#_Win32Opener -oauth2client.locked_file.validate_file oauth2client.locked_file-module.html#validate_file -oauth2client.locked_file.logger oauth2client.locked_file-module.html#logger -oauth2client.multistore_file oauth2client.multistore_file-module.html -oauth2client.multistore_file.get_credential_storage oauth2client.multistore_file-module.html#get_credential_storage -oauth2client.multistore_file._get_multistore oauth2client.multistore_file-module.html#_get_multistore -oauth2client.multistore_file.get_all_credential_keys oauth2client.multistore_file-module.html#get_all_credential_keys -oauth2client.multistore_file._multistores_lock oauth2client.multistore_file-module.html#_multistores_lock -oauth2client.multistore_file.get_credential_storage_custom_key oauth2client.multistore_file-module.html#get_credential_storage_custom_key -oauth2client.multistore_file._multistores oauth2client.multistore_file-module.html#_multistores -oauth2client.multistore_file.get_credential_storage_custom_string_key oauth2client.multistore_file-module.html#get_credential_storage_custom_string_key -oauth2client.multistore_file.logger oauth2client.multistore_file-module.html#logger -oauth2client.old_run oauth2client.old_run-module.html -oauth2client.old_run.run oauth2client.old_run-module.html#run -oauth2client.old_run.FLAGS oauth2client.old_run-module.html#FLAGS -oauth2client.service_account oauth2client.service_account-module.html -oauth2client.service_account._urlsafe_b64encode oauth2client.service_account-module.html#_urlsafe_b64encode -oauth2client.service_account._get_private_key oauth2client.service_account-module.html#_get_private_key -oauth2client.tools oauth2client.tools-module.html -oauth2client.tools.argparser oauth2client.tools-module.html#argparser -oauth2client.tools._CLIENT_SECRETS_MESSAGE oauth2client.tools-module.html#_CLIENT_SECRETS_MESSAGE -oauth2client.tools.message_if_missing oauth2client.tools-module.html#message_if_missing -oauth2client.tools._CreateArgumentParser oauth2client.tools-module.html#_CreateArgumentParser -oauth2client.tools.run oauth2client.tools-module.html#run -oauth2client.tools.run_flow oauth2client.tools-module.html#run_flow -oauth2client.util oauth2client.util-module.html -oauth2client.util.POSITIONAL_EXCEPTION oauth2client.util-module.html#POSITIONAL_EXCEPTION -oauth2client.util._add_query_parameter oauth2client.util-module.html#_add_query_parameter -oauth2client.util.scopes_to_string oauth2client.util-module.html#scopes_to_string -oauth2client.util.dict_to_tuple_key oauth2client.util-module.html#dict_to_tuple_key -oauth2client.util.POSITIONAL_IGNORE oauth2client.util-module.html#POSITIONAL_IGNORE -oauth2client.util.positional oauth2client.util-module.html#positional -oauth2client.util.POSITIONAL_WARNING oauth2client.util-module.html#POSITIONAL_WARNING -oauth2client.util.logger oauth2client.util-module.html#logger -oauth2client.util.positional_parameters_enforcement oauth2client.util-module.html#positional_parameters_enforcement -oauth2client.util.POSITIONAL_SET oauth2client.util-module.html#POSITIONAL_SET -oauth2client.xsrfutil oauth2client.xsrfutil-module.html -oauth2client.xsrfutil.validate_token oauth2client.xsrfutil-module.html#validate_token -oauth2client.xsrfutil._force_bytes oauth2client.xsrfutil-module.html#_force_bytes -oauth2client.xsrfutil.DEFAULT_TIMEOUT_SECS oauth2client.xsrfutil-module.html#DEFAULT_TIMEOUT_SECS -oauth2client.xsrfutil.DELIMITER oauth2client.xsrfutil-module.html#DELIMITER -oauth2client.xsrfutil.generate_token oauth2client.xsrfutil-module.html#generate_token -oauth2client.appengine.AppAssertionCredentials oauth2client.appengine.AppAssertionCredentials-class.html -oauth2client.appengine.AppAssertionCredentials.from_json oauth2client.appengine.AppAssertionCredentials-class.html#from_json -oauth2client.appengine.AppAssertionCredentials.serialization_data oauth2client.appengine.AppAssertionCredentials-class.html#serialization_data -oauth2client.client.OAuth2Credentials.revoke oauth2client.client.OAuth2Credentials-class.html#revoke -oauth2client.client.OAuth2Credentials.set_store oauth2client.client.OAuth2Credentials-class.html#set_store -oauth2client.client.OAuth2Credentials.authorize oauth2client.client.OAuth2Credentials-class.html#authorize -oauth2client.client.OAuth2Credentials.to_json oauth2client.client.OAuth2Credentials-class.html#to_json -oauth2client.client.OAuth2Credentials.apply oauth2client.client.OAuth2Credentials-class.html#apply -oauth2client.client.Credentials.new_from_json oauth2client.client.Credentials-class.html#new_from_json -oauth2client.appengine.AppAssertionCredentials.__init__ oauth2client.appengine.AppAssertionCredentials-class.html#__init__ -oauth2client.client.OAuth2Credentials._generate_refresh_request_headers oauth2client.client.OAuth2Credentials-class.html#_generate_refresh_request_headers -oauth2client.client.Credentials._to_json oauth2client.client.Credentials-class.html#_to_json -oauth2client.client.AssertionCredentials._generate_assertion oauth2client.client.AssertionCredentials-class.html#_generate_assertion -oauth2client.client.OAuth2Credentials.__getstate__ oauth2client.client.OAuth2Credentials-class.html#__getstate__ -oauth2client.client.GoogleCredentials.from_stream oauth2client.client.GoogleCredentials-class.html#from_stream -oauth2client.client.OAuth2Credentials.__setstate__ oauth2client.client.OAuth2Credentials-class.html#__setstate__ -oauth2client.client.OAuth2Credentials._expires_in oauth2client.client.OAuth2Credentials-class.html#_expires_in -oauth2client.appengine.AppAssertionCredentials._refresh oauth2client.appengine.AppAssertionCredentials-class.html#_refresh -oauth2client.client.AssertionCredentials._revoke oauth2client.client.AssertionCredentials-class.html#_revoke -oauth2client.client.Credentials.NON_SERIALIZED_MEMBERS oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS -oauth2client.appengine.AppAssertionCredentials.create_scoped oauth2client.appengine.AppAssertionCredentials-class.html#create_scoped -oauth2client.client.OAuth2Credentials._do_revoke oauth2client.client.OAuth2Credentials-class.html#_do_revoke -oauth2client.client.AssertionCredentials._generate_refresh_request_body oauth2client.client.AssertionCredentials-class.html#_generate_refresh_request_body -oauth2client.client.GoogleCredentials.get_application_default oauth2client.client.GoogleCredentials-class.html#get_application_default -oauth2client.client.OAuth2Credentials._updateFromCredential oauth2client.client.OAuth2Credentials-class.html#_updateFromCredential -oauth2client.client.OAuth2Credentials._do_refresh_request oauth2client.client.OAuth2Credentials-class.html#_do_refresh_request -oauth2client.appengine.AppAssertionCredentials.create_scoped_required oauth2client.appengine.AppAssertionCredentials-class.html#create_scoped_required -oauth2client.client.OAuth2Credentials.refresh oauth2client.client.OAuth2Credentials-class.html#refresh -oauth2client.client.OAuth2Credentials.get_access_token oauth2client.client.OAuth2Credentials-class.html#get_access_token -oauth2client.client.OAuth2Credentials.access_token_expired oauth2client.client.OAuth2Credentials-class.html#access_token_expired -oauth2client.appengine.CredentialsModel oauth2client.appengine.CredentialsModel-class.html -oauth2client.appengine.CredentialsModel.credentials oauth2client.appengine.CredentialsModel-class.html#credentials -oauth2client.appengine.CredentialsNDBModel oauth2client.appengine.CredentialsNDBModel-class.html -oauth2client.appengine.CredentialsNDBModel.credentials oauth2client.appengine.CredentialsNDBModel-class.html#credentials -oauth2client.appengine.CredentialsNDBModel._get_kind oauth2client.appengine.CredentialsNDBModel-class.html#_get_kind -oauth2client.appengine.CredentialsNDBProperty oauth2client.appengine.CredentialsNDBProperty-class.html -oauth2client.appengine.CredentialsNDBProperty._validate oauth2client.appengine.CredentialsNDBProperty-class.html#_validate -oauth2client.appengine.CredentialsNDBProperty._from_base_type oauth2client.appengine.CredentialsNDBProperty-class.html#_from_base_type -oauth2client.appengine.CredentialsNDBProperty._to_base_type oauth2client.appengine.CredentialsNDBProperty-class.html#_to_base_type -oauth2client.appengine.CredentialsProperty oauth2client.appengine.CredentialsProperty-class.html -oauth2client.appengine.CredentialsProperty.make_value_from_datastore oauth2client.appengine.CredentialsProperty-class.html#make_value_from_datastore -oauth2client.appengine.CredentialsProperty.validate oauth2client.appengine.CredentialsProperty-class.html#validate -oauth2client.appengine.CredentialsProperty.get_value_for_datastore oauth2client.appengine.CredentialsProperty-class.html#get_value_for_datastore -oauth2client.appengine.CredentialsProperty.data_type oauth2client.appengine.CredentialsProperty-class.html#data_type -oauth2client.appengine.FlowNDBProperty oauth2client.appengine.FlowNDBProperty-class.html -oauth2client.appengine.FlowNDBProperty._validate oauth2client.appengine.FlowNDBProperty-class.html#_validate -oauth2client.appengine.FlowProperty oauth2client.appengine.FlowProperty-class.html -oauth2client.appengine.FlowProperty.make_value_from_datastore oauth2client.appengine.FlowProperty-class.html#make_value_from_datastore -oauth2client.appengine.FlowProperty.validate oauth2client.appengine.FlowProperty-class.html#validate -oauth2client.appengine.FlowProperty.get_value_for_datastore oauth2client.appengine.FlowProperty-class.html#get_value_for_datastore -oauth2client.appengine.FlowProperty.empty oauth2client.appengine.FlowProperty-class.html#empty -oauth2client.appengine.FlowProperty.data_type oauth2client.appengine.FlowProperty-class.html#data_type -oauth2client.appengine.InvalidClientSecretsError oauth2client.appengine.InvalidClientSecretsError-class.html -oauth2client.appengine.InvalidXsrfTokenError oauth2client.appengine.InvalidXsrfTokenError-class.html -oauth2client.appengine.OAuth2Decorator oauth2client.appengine.OAuth2Decorator-class.html -oauth2client.appengine.OAuth2Decorator.get_flow oauth2client.appengine.OAuth2Decorator-class.html#get_flow -oauth2client.appengine.OAuth2Decorator.set_credentials oauth2client.appengine.OAuth2Decorator-class.html#set_credentials -oauth2client.appengine.OAuth2Decorator.set_flow oauth2client.appengine.OAuth2Decorator-class.html#set_flow -oauth2client.appengine.OAuth2Decorator.__init__ oauth2client.appengine.OAuth2Decorator-class.html#__init__ -oauth2client.appengine.OAuth2Decorator.authorize_url oauth2client.appengine.OAuth2Decorator-class.html#authorize_url -oauth2client.appengine.OAuth2Decorator.callback_handler oauth2client.appengine.OAuth2Decorator-class.html#callback_handler -oauth2client.appengine.OAuth2Decorator._display_error_message oauth2client.appengine.OAuth2Decorator-class.html#_display_error_message -oauth2client.appengine.OAuth2Decorator.http oauth2client.appengine.OAuth2Decorator-class.html#http -oauth2client.appengine.OAuth2Decorator._create_flow oauth2client.appengine.OAuth2Decorator-class.html#_create_flow -oauth2client.appengine.OAuth2Decorator.has_credentials oauth2client.appengine.OAuth2Decorator-class.html#has_credentials -oauth2client.appengine.OAuth2Decorator.credentials oauth2client.appengine.OAuth2Decorator-class.html#credentials -oauth2client.appengine.OAuth2Decorator.callback_application oauth2client.appengine.OAuth2Decorator-class.html#callback_application -oauth2client.appengine.OAuth2Decorator.oauth_aware oauth2client.appengine.OAuth2Decorator-class.html#oauth_aware -oauth2client.appengine.OAuth2Decorator.flow oauth2client.appengine.OAuth2Decorator-class.html#flow -oauth2client.appengine.OAuth2Decorator.get_credentials oauth2client.appengine.OAuth2Decorator-class.html#get_credentials -oauth2client.appengine.OAuth2Decorator.callback_path oauth2client.appengine.OAuth2Decorator-class.html#callback_path -oauth2client.appengine.OAuth2Decorator.oauth_required oauth2client.appengine.OAuth2Decorator-class.html#oauth_required -oauth2client.appengine.OAuth2DecoratorFromClientSecrets oauth2client.appengine.OAuth2DecoratorFromClientSecrets-class.html -oauth2client.appengine.OAuth2Decorator.get_flow oauth2client.appengine.OAuth2Decorator-class.html#get_flow -oauth2client.appengine.OAuth2Decorator.set_credentials oauth2client.appengine.OAuth2Decorator-class.html#set_credentials -oauth2client.appengine.OAuth2Decorator.set_flow oauth2client.appengine.OAuth2Decorator-class.html#set_flow -oauth2client.appengine.OAuth2DecoratorFromClientSecrets.__init__ oauth2client.appengine.OAuth2DecoratorFromClientSecrets-class.html#__init__ -oauth2client.appengine.OAuth2Decorator.authorize_url oauth2client.appengine.OAuth2Decorator-class.html#authorize_url -oauth2client.appengine.OAuth2Decorator.callback_handler oauth2client.appengine.OAuth2Decorator-class.html#callback_handler -oauth2client.appengine.OAuth2Decorator._display_error_message oauth2client.appengine.OAuth2Decorator-class.html#_display_error_message -oauth2client.appengine.OAuth2Decorator.http oauth2client.appengine.OAuth2Decorator-class.html#http -oauth2client.appengine.OAuth2Decorator._create_flow oauth2client.appengine.OAuth2Decorator-class.html#_create_flow -oauth2client.appengine.OAuth2Decorator.has_credentials oauth2client.appengine.OAuth2Decorator-class.html#has_credentials -oauth2client.appengine.OAuth2Decorator.credentials oauth2client.appengine.OAuth2Decorator-class.html#credentials -oauth2client.appengine.OAuth2Decorator.callback_application oauth2client.appengine.OAuth2Decorator-class.html#callback_application -oauth2client.appengine.OAuth2Decorator.oauth_aware oauth2client.appengine.OAuth2Decorator-class.html#oauth_aware -oauth2client.appengine.OAuth2Decorator.flow oauth2client.appengine.OAuth2Decorator-class.html#flow -oauth2client.appengine.OAuth2Decorator.get_credentials oauth2client.appengine.OAuth2Decorator-class.html#get_credentials -oauth2client.appengine.OAuth2Decorator.callback_path oauth2client.appengine.OAuth2Decorator-class.html#callback_path -oauth2client.appengine.OAuth2Decorator.oauth_required oauth2client.appengine.OAuth2Decorator-class.html#oauth_required -oauth2client.appengine.SiteXsrfSecretKey oauth2client.appengine.SiteXsrfSecretKey-class.html -oauth2client.appengine.SiteXsrfSecretKey.secret oauth2client.appengine.SiteXsrfSecretKey-class.html#secret -oauth2client.appengine.SiteXsrfSecretKeyNDB oauth2client.appengine.SiteXsrfSecretKeyNDB-class.html -oauth2client.appengine.SiteXsrfSecretKeyNDB.secret oauth2client.appengine.SiteXsrfSecretKeyNDB-class.html#secret -oauth2client.appengine.SiteXsrfSecretKeyNDB._get_kind oauth2client.appengine.SiteXsrfSecretKeyNDB-class.html#_get_kind -oauth2client.appengine.StorageByKeyName oauth2client.appengine.StorageByKeyName-class.html -oauth2client.client.Storage.acquire_lock oauth2client.client.Storage-class.html#acquire_lock -oauth2client.appengine.StorageByKeyName.locked_put oauth2client.appengine.StorageByKeyName-class.html#locked_put -oauth2client.appengine.StorageByKeyName.__init__ oauth2client.appengine.StorageByKeyName-class.html#__init__ -oauth2client.appengine.StorageByKeyName.locked_delete oauth2client.appengine.StorageByKeyName-class.html#locked_delete -oauth2client.appengine.StorageByKeyName.locked_get oauth2client.appengine.StorageByKeyName-class.html#locked_get -oauth2client.client.Storage.get oauth2client.client.Storage-class.html#get -oauth2client.client.Storage.put oauth2client.client.Storage-class.html#put -oauth2client.appengine.StorageByKeyName._is_ndb oauth2client.appengine.StorageByKeyName-class.html#_is_ndb -oauth2client.appengine.StorageByKeyName._get_entity oauth2client.appengine.StorageByKeyName-class.html#_get_entity -oauth2client.client.Storage.release_lock oauth2client.client.Storage-class.html#release_lock -oauth2client.appengine.StorageByKeyName._delete_entity oauth2client.appengine.StorageByKeyName-class.html#_delete_entity -oauth2client.client.Storage.delete oauth2client.client.Storage-class.html#delete -oauth2client.client.AccessTokenCredentials oauth2client.client.AccessTokenCredentials-class.html -oauth2client.client.AccessTokenCredentials.from_json oauth2client.client.AccessTokenCredentials-class.html#from_json -oauth2client.client.OAuth2Credentials.authorize oauth2client.client.OAuth2Credentials-class.html#authorize -oauth2client.client.OAuth2Credentials.revoke oauth2client.client.OAuth2Credentials-class.html#revoke -oauth2client.client.OAuth2Credentials.set_store oauth2client.client.OAuth2Credentials-class.html#set_store -oauth2client.client.OAuth2Credentials.to_json oauth2client.client.OAuth2Credentials-class.html#to_json -oauth2client.client.OAuth2Credentials.apply oauth2client.client.OAuth2Credentials-class.html#apply -oauth2client.client.Credentials.new_from_json oauth2client.client.Credentials-class.html#new_from_json -oauth2client.client.AccessTokenCredentials.__init__ oauth2client.client.AccessTokenCredentials-class.html#__init__ -oauth2client.client.OAuth2Credentials._generate_refresh_request_headers oauth2client.client.OAuth2Credentials-class.html#_generate_refresh_request_headers -oauth2client.client.Credentials._to_json oauth2client.client.Credentials-class.html#_to_json -oauth2client.client.Credentials.NON_SERIALIZED_MEMBERS oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS -oauth2client.client.OAuth2Credentials.__getstate__ oauth2client.client.OAuth2Credentials-class.html#__getstate__ -oauth2client.client.OAuth2Credentials.__setstate__ oauth2client.client.OAuth2Credentials-class.html#__setstate__ -oauth2client.client.OAuth2Credentials._expires_in oauth2client.client.OAuth2Credentials-class.html#_expires_in -oauth2client.client.AccessTokenCredentials._refresh oauth2client.client.AccessTokenCredentials-class.html#_refresh -oauth2client.client.AccessTokenCredentials._revoke oauth2client.client.AccessTokenCredentials-class.html#_revoke -oauth2client.client.OAuth2Credentials._do_revoke oauth2client.client.OAuth2Credentials-class.html#_do_revoke -oauth2client.client.OAuth2Credentials._generate_refresh_request_body oauth2client.client.OAuth2Credentials-class.html#_generate_refresh_request_body -oauth2client.client.OAuth2Credentials._updateFromCredential oauth2client.client.OAuth2Credentials-class.html#_updateFromCredential -oauth2client.client.OAuth2Credentials._do_refresh_request oauth2client.client.OAuth2Credentials-class.html#_do_refresh_request -oauth2client.client.OAuth2Credentials.refresh oauth2client.client.OAuth2Credentials-class.html#refresh -oauth2client.client.OAuth2Credentials.get_access_token oauth2client.client.OAuth2Credentials-class.html#get_access_token -oauth2client.client.OAuth2Credentials.access_token_expired oauth2client.client.OAuth2Credentials-class.html#access_token_expired -oauth2client.client.AccessTokenCredentialsError oauth2client.client.AccessTokenCredentialsError-class.html -oauth2client.client.AccessTokenRefreshError oauth2client.client.AccessTokenRefreshError-class.html -oauth2client.client.ApplicationDefaultCredentialsError oauth2client.client.ApplicationDefaultCredentialsError-class.html -oauth2client.client.AssertionCredentials oauth2client.client.AssertionCredentials-class.html -oauth2client.client.OAuth2Credentials.authorize oauth2client.client.OAuth2Credentials-class.html#authorize -oauth2client.client.GoogleCredentials.serialization_data oauth2client.client.GoogleCredentials-class.html#serialization_data -oauth2client.client.OAuth2Credentials.revoke oauth2client.client.OAuth2Credentials-class.html#revoke -oauth2client.client.OAuth2Credentials.set_store oauth2client.client.OAuth2Credentials-class.html#set_store -oauth2client.client.OAuth2Credentials.to_json oauth2client.client.OAuth2Credentials-class.html#to_json -oauth2client.client.OAuth2Credentials.apply oauth2client.client.OAuth2Credentials-class.html#apply -oauth2client.client.Credentials.new_from_json oauth2client.client.Credentials-class.html#new_from_json -oauth2client.client.AssertionCredentials.__init__ oauth2client.client.AssertionCredentials-class.html#__init__ -oauth2client.client.OAuth2Credentials._generate_refresh_request_headers oauth2client.client.OAuth2Credentials-class.html#_generate_refresh_request_headers -oauth2client.client.Credentials._to_json oauth2client.client.Credentials-class.html#_to_json -oauth2client.client.AssertionCredentials._generate_assertion oauth2client.client.AssertionCredentials-class.html#_generate_assertion -oauth2client.client.OAuth2Credentials.__getstate__ oauth2client.client.OAuth2Credentials-class.html#__getstate__ -oauth2client.client.GoogleCredentials.from_stream oauth2client.client.GoogleCredentials-class.html#from_stream -oauth2client.client.OAuth2Credentials.__setstate__ oauth2client.client.OAuth2Credentials-class.html#__setstate__ -oauth2client.client.OAuth2Credentials._expires_in oauth2client.client.OAuth2Credentials-class.html#_expires_in -oauth2client.client.OAuth2Credentials._refresh oauth2client.client.OAuth2Credentials-class.html#_refresh -oauth2client.client.AssertionCredentials._revoke oauth2client.client.AssertionCredentials-class.html#_revoke -oauth2client.client.Credentials.NON_SERIALIZED_MEMBERS oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS -oauth2client.client.GoogleCredentials.create_scoped oauth2client.client.GoogleCredentials-class.html#create_scoped -oauth2client.client.OAuth2Credentials._do_revoke oauth2client.client.OAuth2Credentials-class.html#_do_revoke -oauth2client.client.AssertionCredentials._generate_refresh_request_body oauth2client.client.AssertionCredentials-class.html#_generate_refresh_request_body -oauth2client.client.GoogleCredentials.get_application_default oauth2client.client.GoogleCredentials-class.html#get_application_default -oauth2client.client.OAuth2Credentials._updateFromCredential oauth2client.client.OAuth2Credentials-class.html#_updateFromCredential -oauth2client.client.OAuth2Credentials._do_refresh_request oauth2client.client.OAuth2Credentials-class.html#_do_refresh_request -oauth2client.client.GoogleCredentials.create_scoped_required oauth2client.client.GoogleCredentials-class.html#create_scoped_required -oauth2client.client.OAuth2Credentials.refresh oauth2client.client.OAuth2Credentials-class.html#refresh -oauth2client.client.OAuth2Credentials.get_access_token oauth2client.client.OAuth2Credentials-class.html#get_access_token -oauth2client.client.OAuth2Credentials.from_json oauth2client.client.OAuth2Credentials-class.html#from_json -oauth2client.client.OAuth2Credentials.access_token_expired oauth2client.client.OAuth2Credentials-class.html#access_token_expired -oauth2client.client.Credentials oauth2client.client.Credentials-class.html -oauth2client.client.Credentials.authorize oauth2client.client.Credentials-class.html#authorize -oauth2client.client.Credentials.from_json oauth2client.client.Credentials-class.html#from_json -oauth2client.client.Credentials.revoke oauth2client.client.Credentials-class.html#revoke -oauth2client.client.Credentials.to_json oauth2client.client.Credentials-class.html#to_json -oauth2client.client.Credentials.apply oauth2client.client.Credentials-class.html#apply -oauth2client.client.Credentials.new_from_json oauth2client.client.Credentials-class.html#new_from_json -oauth2client.client.Credentials._to_json oauth2client.client.Credentials-class.html#_to_json -oauth2client.client.Credentials.NON_SERIALIZED_MEMBERS oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS -oauth2client.client.Credentials.refresh oauth2client.client.Credentials-class.html#refresh -oauth2client.client.CryptoUnavailableError oauth2client.client.CryptoUnavailableError-class.html -oauth2client.client.DeviceFlowInfo oauth2client.client.DeviceFlowInfo-class.html -oauth2client.client.DeviceFlowInfo.FromResponse oauth2client.client.DeviceFlowInfo-class.html#FromResponse -oauth2client.client.Error oauth2client.client.Error-class.html -oauth2client.client.Flow oauth2client.client.Flow-class.html -oauth2client.client.FlowExchangeError oauth2client.client.FlowExchangeError-class.html -oauth2client.client.GoogleCredentials oauth2client.client.GoogleCredentials-class.html -oauth2client.client.OAuth2Credentials.authorize oauth2client.client.OAuth2Credentials-class.html#authorize -oauth2client.client.GoogleCredentials.serialization_data oauth2client.client.GoogleCredentials-class.html#serialization_data -oauth2client.client.OAuth2Credentials.revoke oauth2client.client.OAuth2Credentials-class.html#revoke -oauth2client.client.OAuth2Credentials.set_store oauth2client.client.OAuth2Credentials-class.html#set_store -oauth2client.client.OAuth2Credentials.to_json oauth2client.client.OAuth2Credentials-class.html#to_json -oauth2client.client.OAuth2Credentials.apply oauth2client.client.OAuth2Credentials-class.html#apply -oauth2client.client.Credentials.new_from_json oauth2client.client.Credentials-class.html#new_from_json -oauth2client.client.GoogleCredentials.__init__ oauth2client.client.GoogleCredentials-class.html#__init__ -oauth2client.client.OAuth2Credentials._generate_refresh_request_headers oauth2client.client.OAuth2Credentials-class.html#_generate_refresh_request_headers -oauth2client.client.Credentials._to_json oauth2client.client.Credentials-class.html#_to_json -oauth2client.client.Credentials.NON_SERIALIZED_MEMBERS oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS -oauth2client.client.OAuth2Credentials.__getstate__ oauth2client.client.OAuth2Credentials-class.html#__getstate__ -oauth2client.client.GoogleCredentials.from_stream oauth2client.client.GoogleCredentials-class.html#from_stream -oauth2client.client.OAuth2Credentials.__setstate__ oauth2client.client.OAuth2Credentials-class.html#__setstate__ -oauth2client.client.OAuth2Credentials._expires_in oauth2client.client.OAuth2Credentials-class.html#_expires_in -oauth2client.client.OAuth2Credentials._refresh oauth2client.client.OAuth2Credentials-class.html#_refresh -oauth2client.client.OAuth2Credentials._revoke oauth2client.client.OAuth2Credentials-class.html#_revoke -oauth2client.client.GoogleCredentials.create_scoped oauth2client.client.GoogleCredentials-class.html#create_scoped -oauth2client.client.OAuth2Credentials._do_revoke oauth2client.client.OAuth2Credentials-class.html#_do_revoke -oauth2client.client.OAuth2Credentials._generate_refresh_request_body oauth2client.client.OAuth2Credentials-class.html#_generate_refresh_request_body -oauth2client.client.GoogleCredentials.get_application_default oauth2client.client.GoogleCredentials-class.html#get_application_default -oauth2client.client.OAuth2Credentials._updateFromCredential oauth2client.client.OAuth2Credentials-class.html#_updateFromCredential -oauth2client.client.OAuth2Credentials._do_refresh_request oauth2client.client.OAuth2Credentials-class.html#_do_refresh_request -oauth2client.client.GoogleCredentials.create_scoped_required oauth2client.client.GoogleCredentials-class.html#create_scoped_required -oauth2client.client.OAuth2Credentials.refresh oauth2client.client.OAuth2Credentials-class.html#refresh -oauth2client.client.OAuth2Credentials.get_access_token oauth2client.client.OAuth2Credentials-class.html#get_access_token -oauth2client.client.OAuth2Credentials.from_json oauth2client.client.OAuth2Credentials-class.html#from_json -oauth2client.client.OAuth2Credentials.access_token_expired oauth2client.client.OAuth2Credentials-class.html#access_token_expired -oauth2client.client.MemoryCache oauth2client.client.MemoryCache-class.html -oauth2client.client.MemoryCache.set oauth2client.client.MemoryCache-class.html#set -oauth2client.client.MemoryCache.get oauth2client.client.MemoryCache-class.html#get -oauth2client.client.MemoryCache.__init__ oauth2client.client.MemoryCache-class.html#__init__ -oauth2client.client.MemoryCache.delete oauth2client.client.MemoryCache-class.html#delete -oauth2client.client.NonAsciiHeaderError oauth2client.client.NonAsciiHeaderError-class.html -oauth2client.client.OAuth2Credentials oauth2client.client.OAuth2Credentials-class.html -oauth2client.client.OAuth2Credentials.authorize oauth2client.client.OAuth2Credentials-class.html#authorize -oauth2client.client.OAuth2Credentials.from_json oauth2client.client.OAuth2Credentials-class.html#from_json -oauth2client.client.OAuth2Credentials.revoke oauth2client.client.OAuth2Credentials-class.html#revoke -oauth2client.client.OAuth2Credentials.set_store oauth2client.client.OAuth2Credentials-class.html#set_store -oauth2client.client.OAuth2Credentials.to_json oauth2client.client.OAuth2Credentials-class.html#to_json -oauth2client.client.OAuth2Credentials.apply oauth2client.client.OAuth2Credentials-class.html#apply -oauth2client.client.Credentials.new_from_json oauth2client.client.Credentials-class.html#new_from_json -oauth2client.client.OAuth2Credentials.__init__ oauth2client.client.OAuth2Credentials-class.html#__init__ -oauth2client.client.OAuth2Credentials._generate_refresh_request_headers oauth2client.client.OAuth2Credentials-class.html#_generate_refresh_request_headers -oauth2client.client.Credentials._to_json oauth2client.client.Credentials-class.html#_to_json -oauth2client.client.Credentials.NON_SERIALIZED_MEMBERS oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS -oauth2client.client.OAuth2Credentials.__getstate__ oauth2client.client.OAuth2Credentials-class.html#__getstate__ -oauth2client.client.OAuth2Credentials.__setstate__ oauth2client.client.OAuth2Credentials-class.html#__setstate__ -oauth2client.client.OAuth2Credentials._expires_in oauth2client.client.OAuth2Credentials-class.html#_expires_in -oauth2client.client.OAuth2Credentials._refresh oauth2client.client.OAuth2Credentials-class.html#_refresh -oauth2client.client.OAuth2Credentials._revoke oauth2client.client.OAuth2Credentials-class.html#_revoke -oauth2client.client.OAuth2Credentials._do_revoke oauth2client.client.OAuth2Credentials-class.html#_do_revoke -oauth2client.client.OAuth2Credentials._generate_refresh_request_body oauth2client.client.OAuth2Credentials-class.html#_generate_refresh_request_body -oauth2client.client.OAuth2Credentials._updateFromCredential oauth2client.client.OAuth2Credentials-class.html#_updateFromCredential -oauth2client.client.OAuth2Credentials._do_refresh_request oauth2client.client.OAuth2Credentials-class.html#_do_refresh_request -oauth2client.client.OAuth2Credentials.refresh oauth2client.client.OAuth2Credentials-class.html#refresh -oauth2client.client.OAuth2Credentials.get_access_token oauth2client.client.OAuth2Credentials-class.html#get_access_token -oauth2client.client.OAuth2Credentials.access_token_expired oauth2client.client.OAuth2Credentials-class.html#access_token_expired -oauth2client.client.OAuth2DeviceCodeError oauth2client.client.OAuth2DeviceCodeError-class.html -oauth2client.client.OAuth2WebServerFlow oauth2client.client.OAuth2WebServerFlow-class.html -oauth2client.client.OAuth2WebServerFlow.step1_get_device_and_user_codes oauth2client.client.OAuth2WebServerFlow-class.html#step1_get_device_and_user_codes -oauth2client.client.OAuth2WebServerFlow.step2_exchange oauth2client.client.OAuth2WebServerFlow-class.html#step2_exchange -oauth2client.client.OAuth2WebServerFlow.step1_get_authorize_url oauth2client.client.OAuth2WebServerFlow-class.html#step1_get_authorize_url -oauth2client.client.OAuth2WebServerFlow.__init__ oauth2client.client.OAuth2WebServerFlow-class.html#__init__ -oauth2client.client.SignedJwtAssertionCredentials oauth2client.client.SignedJwtAssertionCredentials-class.html -oauth2client.client.SignedJwtAssertionCredentials.from_json oauth2client.client.SignedJwtAssertionCredentials-class.html#from_json -oauth2client.client.GoogleCredentials.serialization_data oauth2client.client.GoogleCredentials-class.html#serialization_data -oauth2client.client.OAuth2Credentials.revoke oauth2client.client.OAuth2Credentials-class.html#revoke -oauth2client.client.OAuth2Credentials.set_store oauth2client.client.OAuth2Credentials-class.html#set_store -oauth2client.client.OAuth2Credentials.authorize oauth2client.client.OAuth2Credentials-class.html#authorize -oauth2client.client.OAuth2Credentials.to_json oauth2client.client.OAuth2Credentials-class.html#to_json -oauth2client.client.OAuth2Credentials.apply oauth2client.client.OAuth2Credentials-class.html#apply -oauth2client.client.Credentials.new_from_json oauth2client.client.Credentials-class.html#new_from_json -oauth2client.client.SignedJwtAssertionCredentials.__init__ oauth2client.client.SignedJwtAssertionCredentials-class.html#__init__ -oauth2client.client.OAuth2Credentials._generate_refresh_request_headers oauth2client.client.OAuth2Credentials-class.html#_generate_refresh_request_headers -oauth2client.client.Credentials._to_json oauth2client.client.Credentials-class.html#_to_json -oauth2client.client.SignedJwtAssertionCredentials.MAX_TOKEN_LIFETIME_SECS oauth2client.client.SignedJwtAssertionCredentials-class.html#MAX_TOKEN_LIFETIME_SECS -oauth2client.client.SignedJwtAssertionCredentials._generate_assertion oauth2client.client.SignedJwtAssertionCredentials-class.html#_generate_assertion -oauth2client.client.OAuth2Credentials.__getstate__ oauth2client.client.OAuth2Credentials-class.html#__getstate__ -oauth2client.client.GoogleCredentials.from_stream oauth2client.client.GoogleCredentials-class.html#from_stream -oauth2client.client.OAuth2Credentials.__setstate__ oauth2client.client.OAuth2Credentials-class.html#__setstate__ -oauth2client.client.OAuth2Credentials._expires_in oauth2client.client.OAuth2Credentials-class.html#_expires_in -oauth2client.client.OAuth2Credentials._refresh oauth2client.client.OAuth2Credentials-class.html#_refresh -oauth2client.client.AssertionCredentials._revoke oauth2client.client.AssertionCredentials-class.html#_revoke -oauth2client.client.Credentials.NON_SERIALIZED_MEMBERS oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS -oauth2client.client.GoogleCredentials.create_scoped oauth2client.client.GoogleCredentials-class.html#create_scoped -oauth2client.client.OAuth2Credentials._do_revoke oauth2client.client.OAuth2Credentials-class.html#_do_revoke -oauth2client.client.AssertionCredentials._generate_refresh_request_body oauth2client.client.AssertionCredentials-class.html#_generate_refresh_request_body -oauth2client.client.GoogleCredentials.get_application_default oauth2client.client.GoogleCredentials-class.html#get_application_default -oauth2client.client.OAuth2Credentials._updateFromCredential oauth2client.client.OAuth2Credentials-class.html#_updateFromCredential -oauth2client.client.OAuth2Credentials._do_refresh_request oauth2client.client.OAuth2Credentials-class.html#_do_refresh_request -oauth2client.client.GoogleCredentials.create_scoped_required oauth2client.client.GoogleCredentials-class.html#create_scoped_required -oauth2client.client.OAuth2Credentials.refresh oauth2client.client.OAuth2Credentials-class.html#refresh -oauth2client.client.OAuth2Credentials.get_access_token oauth2client.client.OAuth2Credentials-class.html#get_access_token -oauth2client.client.OAuth2Credentials.access_token_expired oauth2client.client.OAuth2Credentials-class.html#access_token_expired -oauth2client.client.Storage oauth2client.client.Storage-class.html -oauth2client.client.Storage.acquire_lock oauth2client.client.Storage-class.html#acquire_lock -oauth2client.client.Storage.locked_put oauth2client.client.Storage-class.html#locked_put -oauth2client.client.Storage.locked_delete oauth2client.client.Storage-class.html#locked_delete -oauth2client.client.Storage.locked_get oauth2client.client.Storage-class.html#locked_get -oauth2client.client.Storage.get oauth2client.client.Storage-class.html#get -oauth2client.client.Storage.put oauth2client.client.Storage-class.html#put -oauth2client.client.Storage.release_lock oauth2client.client.Storage-class.html#release_lock -oauth2client.client.Storage.delete oauth2client.client.Storage-class.html#delete -oauth2client.client.TokenRevokeError oauth2client.client.TokenRevokeError-class.html -oauth2client.client.UnknownClientSecretsFlowError oauth2client.client.UnknownClientSecretsFlowError-class.html -oauth2client.client.VerifyJwtTokenError oauth2client.client.VerifyJwtTokenError-class.html -oauth2client.clientsecrets.Error oauth2client.clientsecrets.Error-class.html -oauth2client.clientsecrets.InvalidClientSecretsError oauth2client.clientsecrets.InvalidClientSecretsError-class.html -oauth2client.crypt.AppIdentityError oauth2client.crypt.AppIdentityError-class.html -oauth2client.django_orm.CredentialsField oauth2client.django_orm.CredentialsField-class.html -oauth2client.django_orm.CredentialsField.get_internal_type oauth2client.django_orm.CredentialsField-class.html#get_internal_type -oauth2client.django_orm.CredentialsField.__metaclass__ oauth2client.django_orm.CredentialsField-class.html#__metaclass__ -oauth2client.django_orm.CredentialsField.to_python oauth2client.django_orm.CredentialsField-class.html#to_python -oauth2client.django_orm.CredentialsField.__init__ oauth2client.django_orm.CredentialsField-class.html#__init__ -oauth2client.django_orm.CredentialsField.get_db_prep_value oauth2client.django_orm.CredentialsField-class.html#get_db_prep_value -oauth2client.django_orm.FlowField oauth2client.django_orm.FlowField-class.html -oauth2client.django_orm.FlowField.get_internal_type oauth2client.django_orm.FlowField-class.html#get_internal_type -oauth2client.django_orm.FlowField.__metaclass__ oauth2client.django_orm.FlowField-class.html#__metaclass__ -oauth2client.django_orm.FlowField.to_python oauth2client.django_orm.FlowField-class.html#to_python -oauth2client.django_orm.FlowField.__init__ oauth2client.django_orm.FlowField-class.html#__init__ -oauth2client.django_orm.FlowField.get_db_prep_value oauth2client.django_orm.FlowField-class.html#get_db_prep_value -oauth2client.django_orm.Storage oauth2client.django_orm.Storage-class.html -oauth2client.client.Storage.acquire_lock oauth2client.client.Storage-class.html#acquire_lock -oauth2client.django_orm.Storage.locked_put oauth2client.django_orm.Storage-class.html#locked_put -oauth2client.django_orm.Storage.__init__ oauth2client.django_orm.Storage-class.html#__init__ -oauth2client.django_orm.Storage.locked_delete oauth2client.django_orm.Storage-class.html#locked_delete -oauth2client.django_orm.Storage.locked_get oauth2client.django_orm.Storage-class.html#locked_get -oauth2client.client.Storage.get oauth2client.client.Storage-class.html#get -oauth2client.client.Storage.put oauth2client.client.Storage-class.html#put -oauth2client.client.Storage.release_lock oauth2client.client.Storage-class.html#release_lock -oauth2client.client.Storage.delete oauth2client.client.Storage-class.html#delete -oauth2client.file.CredentialsFileSymbolicLinkError oauth2client.file.CredentialsFileSymbolicLinkError-class.html -oauth2client.file.Storage oauth2client.file.Storage-class.html -oauth2client.file.Storage.acquire_lock oauth2client.file.Storage-class.html#acquire_lock -oauth2client.file.Storage._validate_file oauth2client.file.Storage-class.html#_validate_file -oauth2client.file.Storage.locked_put oauth2client.file.Storage-class.html#locked_put -oauth2client.file.Storage.__init__ oauth2client.file.Storage-class.html#__init__ -oauth2client.file.Storage.locked_delete oauth2client.file.Storage-class.html#locked_delete -oauth2client.file.Storage.locked_get oauth2client.file.Storage-class.html#locked_get -oauth2client.client.Storage.get oauth2client.client.Storage-class.html#get -oauth2client.file.Storage._create_file_if_needed oauth2client.file.Storage-class.html#_create_file_if_needed -oauth2client.client.Storage.put oauth2client.client.Storage-class.html#put -oauth2client.file.Storage.release_lock oauth2client.file.Storage-class.html#release_lock -oauth2client.client.Storage.delete oauth2client.client.Storage-class.html#delete -oauth2client.gce.AppAssertionCredentials oauth2client.gce.AppAssertionCredentials-class.html -oauth2client.gce.AppAssertionCredentials.from_json oauth2client.gce.AppAssertionCredentials-class.html#from_json -oauth2client.gce.AppAssertionCredentials.serialization_data oauth2client.gce.AppAssertionCredentials-class.html#serialization_data -oauth2client.client.OAuth2Credentials.revoke oauth2client.client.OAuth2Credentials-class.html#revoke -oauth2client.client.OAuth2Credentials.set_store oauth2client.client.OAuth2Credentials-class.html#set_store -oauth2client.client.OAuth2Credentials.authorize oauth2client.client.OAuth2Credentials-class.html#authorize -oauth2client.client.OAuth2Credentials.to_json oauth2client.client.OAuth2Credentials-class.html#to_json -oauth2client.client.OAuth2Credentials.apply oauth2client.client.OAuth2Credentials-class.html#apply -oauth2client.client.Credentials.new_from_json oauth2client.client.Credentials-class.html#new_from_json -oauth2client.gce.AppAssertionCredentials.__init__ oauth2client.gce.AppAssertionCredentials-class.html#__init__ -oauth2client.client.OAuth2Credentials._generate_refresh_request_headers oauth2client.client.OAuth2Credentials-class.html#_generate_refresh_request_headers -oauth2client.client.Credentials._to_json oauth2client.client.Credentials-class.html#_to_json -oauth2client.client.AssertionCredentials._generate_assertion oauth2client.client.AssertionCredentials-class.html#_generate_assertion -oauth2client.client.OAuth2Credentials.__getstate__ oauth2client.client.OAuth2Credentials-class.html#__getstate__ -oauth2client.client.GoogleCredentials.from_stream oauth2client.client.GoogleCredentials-class.html#from_stream -oauth2client.client.OAuth2Credentials.__setstate__ oauth2client.client.OAuth2Credentials-class.html#__setstate__ -oauth2client.client.OAuth2Credentials._expires_in oauth2client.client.OAuth2Credentials-class.html#_expires_in -oauth2client.gce.AppAssertionCredentials._refresh oauth2client.gce.AppAssertionCredentials-class.html#_refresh -oauth2client.client.AssertionCredentials._revoke oauth2client.client.AssertionCredentials-class.html#_revoke -oauth2client.client.Credentials.NON_SERIALIZED_MEMBERS oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS -oauth2client.gce.AppAssertionCredentials.create_scoped oauth2client.gce.AppAssertionCredentials-class.html#create_scoped -oauth2client.client.OAuth2Credentials._do_revoke oauth2client.client.OAuth2Credentials-class.html#_do_revoke -oauth2client.client.AssertionCredentials._generate_refresh_request_body oauth2client.client.AssertionCredentials-class.html#_generate_refresh_request_body -oauth2client.client.GoogleCredentials.get_application_default oauth2client.client.GoogleCredentials-class.html#get_application_default -oauth2client.client.OAuth2Credentials._updateFromCredential oauth2client.client.OAuth2Credentials-class.html#_updateFromCredential -oauth2client.client.OAuth2Credentials._do_refresh_request oauth2client.client.OAuth2Credentials-class.html#_do_refresh_request -oauth2client.gce.AppAssertionCredentials.create_scoped_required oauth2client.gce.AppAssertionCredentials-class.html#create_scoped_required -oauth2client.client.OAuth2Credentials.refresh oauth2client.client.OAuth2Credentials-class.html#refresh -oauth2client.client.OAuth2Credentials.get_access_token oauth2client.client.OAuth2Credentials-class.html#get_access_token -oauth2client.client.OAuth2Credentials.access_token_expired oauth2client.client.OAuth2Credentials-class.html#access_token_expired -oauth2client.keyring_storage.Storage oauth2client.keyring_storage.Storage-class.html -oauth2client.keyring_storage.Storage.acquire_lock oauth2client.keyring_storage.Storage-class.html#acquire_lock -oauth2client.keyring_storage.Storage.locked_put oauth2client.keyring_storage.Storage-class.html#locked_put -oauth2client.keyring_storage.Storage.__init__ oauth2client.keyring_storage.Storage-class.html#__init__ -oauth2client.keyring_storage.Storage.locked_delete oauth2client.keyring_storage.Storage-class.html#locked_delete -oauth2client.keyring_storage.Storage.locked_get oauth2client.keyring_storage.Storage-class.html#locked_get -oauth2client.client.Storage.get oauth2client.client.Storage-class.html#get -oauth2client.client.Storage.put oauth2client.client.Storage-class.html#put -oauth2client.keyring_storage.Storage.release_lock oauth2client.keyring_storage.Storage-class.html#release_lock -oauth2client.client.Storage.delete oauth2client.client.Storage-class.html#delete -oauth2client.locked_file.AlreadyLockedException oauth2client.locked_file.AlreadyLockedException-class.html -oauth2client.locked_file.CredentialsFileSymbolicLinkError oauth2client.locked_file.CredentialsFileSymbolicLinkError-class.html -oauth2client.locked_file.LockedFile oauth2client.locked_file.LockedFile-class.html -oauth2client.locked_file.LockedFile.open_and_lock oauth2client.locked_file.LockedFile-class.html#open_and_lock -oauth2client.locked_file.LockedFile.file_handle oauth2client.locked_file.LockedFile-class.html#file_handle -oauth2client.locked_file.LockedFile.is_locked oauth2client.locked_file.LockedFile-class.html#is_locked -oauth2client.locked_file.LockedFile.unlock_and_close oauth2client.locked_file.LockedFile-class.html#unlock_and_close -oauth2client.locked_file.LockedFile.filename oauth2client.locked_file.LockedFile-class.html#filename -oauth2client.locked_file.LockedFile.__init__ oauth2client.locked_file.LockedFile-class.html#__init__ -oauth2client.locked_file._Opener oauth2client.locked_file._Opener-class.html -oauth2client.locked_file._Opener.open_and_lock oauth2client.locked_file._Opener-class.html#open_and_lock -oauth2client.locked_file._Opener.file_handle oauth2client.locked_file._Opener-class.html#file_handle -oauth2client.locked_file._Opener.is_locked oauth2client.locked_file._Opener-class.html#is_locked -oauth2client.locked_file._Opener.unlock_and_close oauth2client.locked_file._Opener-class.html#unlock_and_close -oauth2client.locked_file._Opener.filename oauth2client.locked_file._Opener-class.html#filename -oauth2client.locked_file._Opener.__init__ oauth2client.locked_file._Opener-class.html#__init__ -oauth2client.locked_file._PosixOpener oauth2client.locked_file._PosixOpener-class.html -oauth2client.locked_file._PosixOpener.open_and_lock oauth2client.locked_file._PosixOpener-class.html#open_and_lock -oauth2client.locked_file._Opener.file_handle oauth2client.locked_file._Opener-class.html#file_handle -oauth2client.locked_file._Opener.is_locked oauth2client.locked_file._Opener-class.html#is_locked -oauth2client.locked_file._PosixOpener._posix_lockfile oauth2client.locked_file._PosixOpener-class.html#_posix_lockfile -oauth2client.locked_file._Opener.filename oauth2client.locked_file._Opener-class.html#filename -oauth2client.locked_file._PosixOpener.unlock_and_close oauth2client.locked_file._PosixOpener-class.html#unlock_and_close -oauth2client.locked_file._Opener.__init__ oauth2client.locked_file._Opener-class.html#__init__ -oauth2client.multistore_file.Error oauth2client.multistore_file.Error-class.html -oauth2client.multistore_file.NewerCredentialStoreError oauth2client.multistore_file.NewerCredentialStoreError-class.html -oauth2client.multistore_file._MultiStore oauth2client.multistore_file._MultiStore-class.html -oauth2client.multistore_file._MultiStore._get_storage oauth2client.multistore_file._MultiStore-class.html#_get_storage -oauth2client.multistore_file._MultiStore._delete_credential oauth2client.multistore_file._MultiStore-class.html#_delete_credential -oauth2client.multistore_file._MultiStore._write oauth2client.multistore_file._MultiStore-class.html#_write -oauth2client.multistore_file._MultiStore.__init__ oauth2client.multistore_file._MultiStore-class.html#__init__ -oauth2client.multistore_file._MultiStore._locked_json_write oauth2client.multistore_file._MultiStore-class.html#_locked_json_write -oauth2client.multistore_file._MultiStore._get_credential oauth2client.multistore_file._MultiStore-class.html#_get_credential -oauth2client.multistore_file._MultiStore._lock oauth2client.multistore_file._MultiStore-class.html#_lock -oauth2client.multistore_file._MultiStore._refresh_data_cache oauth2client.multistore_file._MultiStore-class.html#_refresh_data_cache -oauth2client.multistore_file._MultiStore._unlock oauth2client.multistore_file._MultiStore-class.html#_unlock -oauth2client.multistore_file._MultiStore._create_file_if_needed oauth2client.multistore_file._MultiStore-class.html#_create_file_if_needed -oauth2client.multistore_file._MultiStore._get_all_credential_keys oauth2client.multistore_file._MultiStore-class.html#_get_all_credential_keys -oauth2client.multistore_file._MultiStore._Storage oauth2client.multistore_file._MultiStore._Storage-class.html -oauth2client.multistore_file._MultiStore._update_credential oauth2client.multistore_file._MultiStore-class.html#_update_credential -oauth2client.multistore_file._MultiStore._decode_credential_from_json oauth2client.multistore_file._MultiStore-class.html#_decode_credential_from_json -oauth2client.multistore_file._MultiStore._locked_json_read oauth2client.multistore_file._MultiStore-class.html#_locked_json_read -oauth2client.multistore_file._MultiStore._Storage oauth2client.multistore_file._MultiStore._Storage-class.html -oauth2client.multistore_file._MultiStore._Storage.acquire_lock oauth2client.multistore_file._MultiStore._Storage-class.html#acquire_lock -oauth2client.multistore_file._MultiStore._Storage.locked_put oauth2client.multistore_file._MultiStore._Storage-class.html#locked_put -oauth2client.multistore_file._MultiStore._Storage.__init__ oauth2client.multistore_file._MultiStore._Storage-class.html#__init__ -oauth2client.multistore_file._MultiStore._Storage.locked_delete oauth2client.multistore_file._MultiStore._Storage-class.html#locked_delete -oauth2client.multistore_file._MultiStore._Storage.locked_get oauth2client.multistore_file._MultiStore._Storage-class.html#locked_get -oauth2client.client.Storage.get oauth2client.client.Storage-class.html#get -oauth2client.client.Storage.put oauth2client.client.Storage-class.html#put -oauth2client.multistore_file._MultiStore._Storage.release_lock oauth2client.multistore_file._MultiStore._Storage-class.html#release_lock -oauth2client.client.Storage.delete oauth2client.client.Storage-class.html#delete -oauth2client.service_account._ServiceAccountCredentials oauth2client.service_account._ServiceAccountCredentials-class.html -oauth2client.client.OAuth2Credentials.authorize oauth2client.client.OAuth2Credentials-class.html#authorize -oauth2client.service_account._ServiceAccountCredentials.serialization_data oauth2client.service_account._ServiceAccountCredentials-class.html#serialization_data -oauth2client.client.OAuth2Credentials.revoke oauth2client.client.OAuth2Credentials-class.html#revoke -oauth2client.client.OAuth2Credentials.set_store oauth2client.client.OAuth2Credentials-class.html#set_store -oauth2client.client.OAuth2Credentials.to_json oauth2client.client.OAuth2Credentials-class.html#to_json -oauth2client.client.OAuth2Credentials.apply oauth2client.client.OAuth2Credentials-class.html#apply -oauth2client.client.Credentials.new_from_json oauth2client.client.Credentials-class.html#new_from_json -oauth2client.service_account._ServiceAccountCredentials.__init__ oauth2client.service_account._ServiceAccountCredentials-class.html#__init__ -oauth2client.client.OAuth2Credentials._generate_refresh_request_headers oauth2client.client.OAuth2Credentials-class.html#_generate_refresh_request_headers -oauth2client.client.Credentials._to_json oauth2client.client.Credentials-class.html#_to_json -oauth2client.service_account._ServiceAccountCredentials.MAX_TOKEN_LIFETIME_SECS oauth2client.service_account._ServiceAccountCredentials-class.html#MAX_TOKEN_LIFETIME_SECS -oauth2client.service_account._ServiceAccountCredentials.service_account_email oauth2client.service_account._ServiceAccountCredentials-class.html#service_account_email -oauth2client.service_account._ServiceAccountCredentials._generate_assertion oauth2client.service_account._ServiceAccountCredentials-class.html#_generate_assertion -oauth2client.client.OAuth2Credentials.__getstate__ oauth2client.client.OAuth2Credentials-class.html#__getstate__ -oauth2client.client.GoogleCredentials.from_stream oauth2client.client.GoogleCredentials-class.html#from_stream -oauth2client.client.OAuth2Credentials.__setstate__ oauth2client.client.OAuth2Credentials-class.html#__setstate__ -oauth2client.client.OAuth2Credentials._expires_in oauth2client.client.OAuth2Credentials-class.html#_expires_in -oauth2client.client.OAuth2Credentials._refresh oauth2client.client.OAuth2Credentials-class.html#_refresh -oauth2client.client.OAuth2Credentials._updateFromCredential oauth2client.client.OAuth2Credentials-class.html#_updateFromCredential -oauth2client.client.AssertionCredentials._revoke oauth2client.client.AssertionCredentials-class.html#_revoke -oauth2client.client.Credentials.NON_SERIALIZED_MEMBERS oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS -oauth2client.service_account._ServiceAccountCredentials.create_scoped oauth2client.service_account._ServiceAccountCredentials-class.html#create_scoped -oauth2client.client.OAuth2Credentials._do_revoke oauth2client.client.OAuth2Credentials-class.html#_do_revoke -oauth2client.client.AssertionCredentials._generate_refresh_request_body oauth2client.client.AssertionCredentials-class.html#_generate_refresh_request_body -oauth2client.client.GoogleCredentials.get_application_default oauth2client.client.GoogleCredentials-class.html#get_application_default -oauth2client.service_account._ServiceAccountCredentials.sign_blob oauth2client.service_account._ServiceAccountCredentials-class.html#sign_blob -oauth2client.client.OAuth2Credentials._do_refresh_request oauth2client.client.OAuth2Credentials-class.html#_do_refresh_request -oauth2client.service_account._ServiceAccountCredentials.create_scoped_required oauth2client.service_account._ServiceAccountCredentials-class.html#create_scoped_required -oauth2client.client.OAuth2Credentials.refresh oauth2client.client.OAuth2Credentials-class.html#refresh -oauth2client.client.OAuth2Credentials.get_access_token oauth2client.client.OAuth2Credentials-class.html#get_access_token -oauth2client.client.OAuth2Credentials.from_json oauth2client.client.OAuth2Credentials-class.html#from_json -oauth2client.client.OAuth2Credentials.access_token_expired oauth2client.client.OAuth2Credentials-class.html#access_token_expired -oauth2client.tools.ClientRedirectHandler oauth2client.tools.ClientRedirectHandler-class.html -oauth2client.tools.ClientRedirectHandler.do_GET oauth2client.tools.ClientRedirectHandler-class.html#do_GET -oauth2client.tools.ClientRedirectHandler.log_message oauth2client.tools.ClientRedirectHandler-class.html#log_message -oauth2client.tools.ClientRedirectServer oauth2client.tools.ClientRedirectServer-class.html -oauth2client.tools.ClientRedirectServer.query_params oauth2client.tools.ClientRedirectServer-class.html#query_params diff --git a/docs/epy/class-tree.html b/docs/epy/class-tree.html deleted file mode 100644 index a64bd64..0000000 --- a/docs/epy/class-tree.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - Class Hierarchy - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - - -
[hide private]
[frames] | no frames]
-
-
- [ Module Hierarchy - | Class Hierarchy ] -

-

Class Hierarchy

- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/crarr.png b/docs/epy/crarr.png deleted file mode 100644 index 26b43c5..0000000 Binary files a/docs/epy/crarr.png and /dev/null differ diff --git a/docs/epy/epydoc.css b/docs/epy/epydoc.css deleted file mode 100644 index 86d4170..0000000 --- a/docs/epy/epydoc.css +++ /dev/null @@ -1,322 +0,0 @@ - - -/* Epydoc CSS Stylesheet - * - * This stylesheet can be used to customize the appearance of epydoc's - * HTML output. - * - */ - -/* Default Colors & Styles - * - Set the default foreground & background color with 'body'; and - * link colors with 'a:link' and 'a:visited'. - * - Use bold for decision list terms. - * - The heading styles defined here are used for headings *within* - * docstring descriptions. All headings used by epydoc itself use - * either class='epydoc' or class='toc' (CSS styles for both - * defined below). - */ -body { background: #ffffff; color: #000000; } -p { margin-top: 0.5em; margin-bottom: 0.5em; } -a:link { color: #0000ff; } -a:visited { color: #204080; } -dt { font-weight: bold; } -h1 { font-size: +140%; font-style: italic; - font-weight: bold; } -h2 { font-size: +125%; font-style: italic; - font-weight: bold; } -h3 { font-size: +110%; font-style: italic; - font-weight: normal; } -code { font-size: 100%; } -/* N.B.: class, not pseudoclass */ -a.link { font-family: monospace; } - -/* Page Header & Footer - * - The standard page header consists of a navigation bar (with - * pointers to standard pages such as 'home' and 'trees'); a - * breadcrumbs list, which can be used to navigate to containing - * classes or modules; options links, to show/hide private - * variables and to show/hide frames; and a page title (using - *

). The page title may be followed by a link to the - * corresponding source code (using 'span.codelink'). - * - The footer consists of a navigation bar, a timestamp, and a - * pointer to epydoc's homepage. - */ -h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; } -h2.epydoc { font-size: +130%; font-weight: bold; } -h3.epydoc { font-size: +115%; font-weight: bold; - margin-top: 0.2em; } -td h3.epydoc { font-size: +115%; font-weight: bold; - margin-bottom: 0; } -table.navbar { background: #a0c0ff; color: #000000; - border: 2px groove #c0d0d0; } -table.navbar table { color: #000000; } -th.navbar-select { background: #70b0ff; - color: #000000; } -table.navbar a { text-decoration: none; } -table.navbar a:link { color: #0000ff; } -table.navbar a:visited { color: #204080; } -span.breadcrumbs { font-size: 85%; font-weight: bold; } -span.options { font-size: 70%; } -span.codelink { font-size: 85%; } -td.footer { font-size: 85%; } - -/* Table Headers - * - Each summary table and details section begins with a 'header' - * row. This row contains a section title (marked by - * 'span.table-header') as well as a show/hide private link - * (marked by 'span.options', defined above). - * - Summary tables that contain user-defined groups mark those - * groups using 'group header' rows. - */ -td.table-header { background: #70b0ff; color: #000000; - border: 1px solid #608090; } -td.table-header table { color: #000000; } -td.table-header table a:link { color: #0000ff; } -td.table-header table a:visited { color: #204080; } -span.table-header { font-size: 120%; font-weight: bold; } -th.group-header { background: #c0e0f8; color: #000000; - text-align: left; font-style: italic; - font-size: 115%; - border: 1px solid #608090; } - -/* Summary Tables (functions, variables, etc) - * - Each object is described by a single row of the table with - * two cells. The left cell gives the object's type, and is - * marked with 'code.summary-type'. The right cell gives the - * object's name and a summary description. - * - CSS styles for the table's header and group headers are - * defined above, under 'Table Headers' - */ -table.summary { border-collapse: collapse; - background: #e8f0f8; color: #000000; - border: 1px solid #608090; - margin-bottom: 0.5em; } -td.summary { border: 1px solid #608090; } -code.summary-type { font-size: 85%; } -table.summary a:link { color: #0000ff; } -table.summary a:visited { color: #204080; } - - -/* Details Tables (functions, variables, etc) - * - Each object is described in its own div. - * - A single-row summary table w/ table-header is used as - * a header for each details section (CSS style for table-header - * is defined above, under 'Table Headers'). - */ -table.details { border-collapse: collapse; - background: #e8f0f8; color: #000000; - border: 1px solid #608090; - margin: .2em 0 0 0; } -table.details table { color: #000000; } -table.details a:link { color: #0000ff; } -table.details a:visited { color: #204080; } - -/* Fields */ -dl.fields { margin-left: 2em; margin-top: 1em; - margin-bottom: 1em; } -dl.fields dd ul { margin-left: 0em; padding-left: 0em; } -dl.fields dd ul li ul { margin-left: 2em; padding-left: 0em; } -div.fields { margin-left: 2em; } -div.fields p { margin-bottom: 0.5em; } - -/* Index tables (identifier index, term index, etc) - * - link-index is used for indices containing lists of links - * (namely, the identifier index & term index). - * - index-where is used in link indices for the text indicating - * the container/source for each link. - * - metadata-index is used for indices containing metadata - * extracted from fields (namely, the bug index & todo index). - */ -table.link-index { border-collapse: collapse; - background: #e8f0f8; color: #000000; - border: 1px solid #608090; } -td.link-index { border-width: 0px; } -table.link-index a:link { color: #0000ff; } -table.link-index a:visited { color: #204080; } -span.index-where { font-size: 70%; } -table.metadata-index { border-collapse: collapse; - background: #e8f0f8; color: #000000; - border: 1px solid #608090; - margin: .2em 0 0 0; } -td.metadata-index { border-width: 1px; border-style: solid; } -table.metadata-index a:link { color: #0000ff; } -table.metadata-index a:visited { color: #204080; } - -/* Function signatures - * - sig* is used for the signature in the details section. - * - .summary-sig* is used for the signature in the summary - * table, and when listing property accessor functions. - * */ -.sig-name { color: #006080; } -.sig-arg { color: #008060; } -.sig-default { color: #602000; } -.summary-sig { font-family: monospace; } -.summary-sig-name { color: #006080; font-weight: bold; } -table.summary a.summary-sig-name:link - { color: #006080; font-weight: bold; } -table.summary a.summary-sig-name:visited - { color: #006080; font-weight: bold; } -.summary-sig-arg { color: #006040; } -.summary-sig-default { color: #501800; } - -/* Subclass list - */ -ul.subclass-list { display: inline; } -ul.subclass-list li { display: inline; } - -/* To render variables, classes etc. like functions */ -table.summary .summary-name { color: #006080; font-weight: bold; - font-family: monospace; } -table.summary - a.summary-name:link { color: #006080; font-weight: bold; - font-family: monospace; } -table.summary - a.summary-name:visited { color: #006080; font-weight: bold; - font-family: monospace; } - -/* Variable values - * - In the 'variable details' sections, each varaible's value is - * listed in a 'pre.variable' box. The width of this box is - * restricted to 80 chars; if the value's repr is longer than - * this it will be wrapped, using a backslash marked with - * class 'variable-linewrap'. If the value's repr is longer - * than 3 lines, the rest will be ellided; and an ellipsis - * marker ('...' marked with 'variable-ellipsis') will be used. - * - If the value is a string, its quote marks will be marked - * with 'variable-quote'. - * - If the variable is a regexp, it is syntax-highlighted using - * the re* CSS classes. - */ -pre.variable { padding: .5em; margin: 0; - background: #dce4ec; color: #000000; - border: 1px solid #708890; } -.variable-linewrap { color: #604000; font-weight: bold; } -.variable-ellipsis { color: #604000; font-weight: bold; } -.variable-quote { color: #604000; font-weight: bold; } -.variable-group { color: #008000; font-weight: bold; } -.variable-op { color: #604000; font-weight: bold; } -.variable-string { color: #006030; } -.variable-unknown { color: #a00000; font-weight: bold; } -.re { color: #000000; } -.re-char { color: #006030; } -.re-op { color: #600000; } -.re-group { color: #003060; } -.re-ref { color: #404040; } - -/* Base tree - * - Used by class pages to display the base class hierarchy. - */ -pre.base-tree { font-size: 80%; margin: 0; } - -/* Frames-based table of contents headers - * - Consists of two frames: one for selecting modules; and - * the other listing the contents of the selected module. - * - h1.toc is used for each frame's heading - * - h2.toc is used for subheadings within each frame. - */ -h1.toc { text-align: center; font-size: 105%; - margin: 0; font-weight: bold; - padding: 0; } -h2.toc { font-size: 100%; font-weight: bold; - margin: 0.5em 0 0 -0.3em; } - -/* Syntax Highlighting for Source Code - * - doctest examples are displayed in a 'pre.py-doctest' block. - * If the example is in a details table entry, then it will use - * the colors specified by the 'table pre.py-doctest' line. - * - Source code listings are displayed in a 'pre.py-src' block. - * Each line is marked with 'span.py-line' (used to draw a line - * down the left margin, separating the code from the line - * numbers). Line numbers are displayed with 'span.py-lineno'. - * The expand/collapse block toggle button is displayed with - * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not - * modify the font size of the text.) - * - If a source code page is opened with an anchor, then the - * corresponding code block will be highlighted. The code - * block's header is highlighted with 'py-highlight-hdr'; and - * the code block's body is highlighted with 'py-highlight'. - * - The remaining py-* classes are used to perform syntax - * highlighting (py-string for string literals, py-name for names, - * etc.) - */ -pre.py-doctest { padding: .5em; margin: 1em; - background: #e8f0f8; color: #000000; - border: 1px solid #708890; } -table pre.py-doctest { background: #dce4ec; - color: #000000; } -pre.py-src { border: 2px solid #000000; - background: #f0f0f0; color: #000000; } -.py-line { border-left: 2px solid #000000; - margin-left: .2em; padding-left: .4em; } -.py-lineno { font-style: italic; font-size: 90%; - padding-left: .5em; } -a.py-toggle { text-decoration: none; } -div.py-highlight-hdr { border-top: 2px solid #000000; - border-bottom: 2px solid #000000; - background: #d8e8e8; } -div.py-highlight { border-bottom: 2px solid #000000; - background: #d0e0e0; } -.py-prompt { color: #005050; font-weight: bold;} -.py-more { color: #005050; font-weight: bold;} -.py-string { color: #006030; } -.py-comment { color: #003060; } -.py-keyword { color: #600000; } -.py-output { color: #404040; } -.py-name { color: #000050; } -.py-name:link { color: #000050 !important; } -.py-name:visited { color: #000050 !important; } -.py-number { color: #005000; } -.py-defname { color: #000060; font-weight: bold; } -.py-def-name { color: #000060; font-weight: bold; } -.py-base-class { color: #000060; } -.py-param { color: #000060; } -.py-docstring { color: #006030; } -.py-decorator { color: #804020; } -/* Use this if you don't want links to names underlined: */ -/*a.py-name { text-decoration: none; }*/ - -/* Graphs & Diagrams - * - These CSS styles are used for graphs & diagrams generated using - * Graphviz dot. 'img.graph-without-title' is used for bare - * diagrams (to remove the border created by making the image - * clickable). - */ -img.graph-without-title { border: none; } -img.graph-with-title { border: 1px solid #000000; } -span.graph-title { font-weight: bold; } -span.graph-caption { } - -/* General-purpose classes - * - 'p.indent-wrapped-lines' defines a paragraph whose first line - * is not indented, but whose subsequent lines are. - * - The 'nomargin-top' class is used to remove the top margin (e.g. - * from lists). The 'nomargin' class is used to remove both the - * top and bottom margin (but not the left or right margin -- - * for lists, that would cause the bullets to disappear.) - */ -p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em; - margin: 0; } -.nomargin-top { margin-top: 0; } -.nomargin { margin-top: 0; margin-bottom: 0; } - -/* HTML Log */ -div.log-block { padding: 0; margin: .5em 0 .5em 0; - background: #e8f0f8; color: #000000; - border: 1px solid #000000; } -div.log-error { padding: .1em .3em .1em .3em; margin: 4px; - background: #ffb0b0; color: #000000; - border: 1px solid #000000; } -div.log-warning { padding: .1em .3em .1em .3em; margin: 4px; - background: #ffffb0; color: #000000; - border: 1px solid #000000; } -div.log-info { padding: .1em .3em .1em .3em; margin: 4px; - background: #b0ffb0; color: #000000; - border: 1px solid #000000; } -h2.log-hdr { background: #70b0ff; color: #000000; - margin: 0; padding: 0em 0.5em 0em 0.5em; - border-bottom: 1px solid #000000; font-size: 110%; } -p.log { font-weight: bold; margin: .5em 0 .5em 0; } -tr.opt-changed { color: #000000; font-weight: bold; } -tr.opt-default { color: #606060; } -pre.log { margin: 0; padding: 0; padding-left: 1em; } diff --git a/docs/epy/epydoc.js b/docs/epy/epydoc.js deleted file mode 100644 index 119e71e..0000000 --- a/docs/epy/epydoc.js +++ /dev/null @@ -1,293 +0,0 @@ -function toggle_private() { - // Search for any private/public links on this page. Store - // their old text in "cmd," so we will know what action to - // take; and change their text to the opposite action. - var cmd = "?"; - var elts = document.getElementsByTagName("a"); - for(var i=0; i...
"; - elt.innerHTML = s; - } -} - -function toggle(id) { - elt = document.getElementById(id+"-toggle"); - if (elt.innerHTML == "-") - collapse(id); - else - expand(id); - return false; -} - -function highlight(id) { - var elt = document.getElementById(id+"-def"); - if (elt) elt.className = "py-highlight-hdr"; - var elt = document.getElementById(id+"-expanded"); - if (elt) elt.className = "py-highlight"; - var elt = document.getElementById(id+"-collapsed"); - if (elt) elt.className = "py-highlight"; -} - -function num_lines(s) { - var n = 1; - var pos = s.indexOf("\n"); - while ( pos > 0) { - n += 1; - pos = s.indexOf("\n", pos+1); - } - return n; -} - -// Collapse all blocks that mave more than `min_lines` lines. -function collapse_all(min_lines) { - var elts = document.getElementsByTagName("div"); - for (var i=0; i 0) - if (elt.id.substring(split, elt.id.length) == "-expanded") - if (num_lines(elt.innerHTML) > min_lines) - collapse(elt.id.substring(0, split)); - } -} - -function expandto(href) { - var start = href.indexOf("#")+1; - if (start != 0 && start != href.length) { - if (href.substring(start, href.length) != "-") { - collapse_all(4); - pos = href.indexOf(".", start); - while (pos != -1) { - var id = href.substring(start, pos); - expand(id); - pos = href.indexOf(".", pos+1); - } - var id = href.substring(start, href.length); - expand(id); - highlight(id); - } - } -} - -function kill_doclink(id) { - var parent = document.getElementById(id); - parent.removeChild(parent.childNodes.item(0)); -} -function auto_kill_doclink(ev) { - if (!ev) var ev = window.event; - if (!this.contains(ev.toElement)) { - var parent = document.getElementById(this.parentID); - parent.removeChild(parent.childNodes.item(0)); - } -} - -function doclink(id, name, targets_id) { - var elt = document.getElementById(id); - - // If we already opened the box, then destroy it. - // (This case should never occur, but leave it in just in case.) - if (elt.childNodes.length > 1) { - elt.removeChild(elt.childNodes.item(0)); - } - else { - // The outer box: relative + inline positioning. - var box1 = document.createElement("div"); - box1.style.position = "relative"; - box1.style.display = "inline"; - box1.style.top = 0; - box1.style.left = 0; - - // A shadow for fun - var shadow = document.createElement("div"); - shadow.style.position = "absolute"; - shadow.style.left = "-1.3em"; - shadow.style.top = "-1.3em"; - shadow.style.background = "#404040"; - - // The inner box: absolute positioning. - var box2 = document.createElement("div"); - box2.style.position = "relative"; - box2.style.border = "1px solid #a0a0a0"; - box2.style.left = "-.2em"; - box2.style.top = "-.2em"; - box2.style.background = "white"; - box2.style.padding = ".3em .4em .3em .4em"; - box2.style.fontStyle = "normal"; - box2.onmouseout=auto_kill_doclink; - box2.parentID = id; - - // Get the targets - var targets_elt = document.getElementById(targets_id); - var targets = targets_elt.getAttribute("targets"); - var links = ""; - target_list = targets.split(","); - for (var i=0; i" + - target[0] + ""; - } - - // Put it all together. - elt.insertBefore(box1, elt.childNodes.item(0)); - //box1.appendChild(box2); - box1.appendChild(shadow); - shadow.appendChild(box2); - box2.innerHTML = - "Which "+name+" do you want to see documentation for?" + - ""; - } - return false; -} - -function get_anchor() { - var href = location.href; - var start = href.indexOf("#")+1; - if ((start != 0) && (start != href.length)) - return href.substring(start, href.length); - } -function redirect_url(dottedName) { - // Scan through each element of the "pages" list, and check - // if "name" matches with any of them. - for (var i=0; i-m" or "-c"; - // extract the portion & compare it to dottedName. - var pagename = pages[i].substring(0, pages[i].length-2); - if (pagename == dottedName.substring(0,pagename.length)) { - - // We've found a page that matches `dottedName`; - // construct its URL, using leftover `dottedName` - // content to form an anchor. - var pagetype = pages[i].charAt(pages[i].length-1); - var url = pagename + ((pagetype=="m")?"-module.html": - "-class.html"); - if (dottedName.length > pagename.length) - url += "#" + dottedName.substring(pagename.length+1, - dottedName.length); - return url; - } - } - } diff --git a/docs/epy/frames.html b/docs/epy/frames.html deleted file mode 100644 index ea17d6d..0000000 --- a/docs/epy/frames.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - API Documentation - - - - - - - - - diff --git a/docs/epy/help.html b/docs/epy/help.html deleted file mode 100644 index 7aec3b8..0000000 --- a/docs/epy/help.html +++ /dev/null @@ -1,268 +0,0 @@ - - - - - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - - -
[hide private]
[frames] | no frames]
-
- -

API Documentation

- -

This document contains the API (Application Programming Interface) -documentation for this project. Documentation for the Python -objects defined by the project is divided into separate pages for each -package, module, and class. The API documentation also includes two -pages containing information about the project as a whole: a trees -page, and an index page.

- -

Object Documentation

- -

Each Package Documentation page contains:

-
    -
  • A description of the package.
  • -
  • A list of the modules and sub-packages contained by the - package.
  • -
  • A summary of the classes defined by the package.
  • -
  • A summary of the functions defined by the package.
  • -
  • A summary of the variables defined by the package.
  • -
  • A detailed description of each function defined by the - package.
  • -
  • A detailed description of each variable defined by the - package.
  • -
- -

Each Module Documentation page contains:

-
    -
  • A description of the module.
  • -
  • A summary of the classes defined by the module.
  • -
  • A summary of the functions defined by the module.
  • -
  • A summary of the variables defined by the module.
  • -
  • A detailed description of each function defined by the - module.
  • -
  • A detailed description of each variable defined by the - module.
  • -
- -

Each Class Documentation page contains:

-
    -
  • A class inheritance diagram.
  • -
  • A list of known subclasses.
  • -
  • A description of the class.
  • -
  • A summary of the methods defined by the class.
  • -
  • A summary of the instance variables defined by the class.
  • -
  • A summary of the class (static) variables defined by the - class.
  • -
  • A detailed description of each method defined by the - class.
  • -
  • A detailed description of each instance variable defined by the - class.
  • -
  • A detailed description of each class (static) variable defined - by the class.
  • -
- -

Project Documentation

- -

The Trees page contains the module and class hierarchies:

-
    -
  • The module hierarchy lists every package and module, with - modules grouped into packages. At the top level, and within each - package, modules and sub-packages are listed alphabetically.
  • -
  • The class hierarchy lists every class, grouped by base - class. If a class has more than one base class, then it will be - listed under each base class. At the top level, and under each base - class, classes are listed alphabetically.
  • -
- -

The Index page contains indices of terms and - identifiers:

-
    -
  • The term index lists every term indexed by any object's - documentation. For each term, the index provides links to each - place where the term is indexed.
  • -
  • The identifier index lists the (short) name of every package, - module, class, method, function, variable, and parameter. For each - identifier, the index provides a short description, and a link to - its documentation.
  • -
- -

The Table of Contents

- -

The table of contents occupies the two frames on the left side of -the window. The upper-left frame displays the project -contents, and the lower-left frame displays the module -contents:

- - - - - - - - - -
- Project
Contents
...
- API
Documentation
Frame


-
- Module
Contents
 
...
  -

- -

The project contents frame contains a list of all packages -and modules that are defined by the project. Clicking on an entry -will display its contents in the module contents frame. Clicking on a -special entry, labeled "Everything," will display the contents of -the entire project.

- -

The module contents frame contains a list of every -submodule, class, type, exception, function, and variable defined by a -module or package. Clicking on an entry will display its -documentation in the API documentation frame. Clicking on the name of -the module, at the top of the frame, will display the documentation -for the module itself.

- -

The "frames" and "no frames" buttons below the top -navigation bar can be used to control whether the table of contents is -displayed or not.

- -

The Navigation Bar

- -

A navigation bar is located at the top and bottom of every page. -It indicates what type of page you are currently viewing, and allows -you to go to related pages. The following table describes the labels -on the navigation bar. Note that not some labels (such as -[Parent]) are not displayed on all pages.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LabelHighlighted when...Links to...
[Parent](never highlighted) the parent of the current package
[Package]viewing a packagethe package containing the current object -
[Module]viewing a modulethe module containing the current object -
[Class]viewing a class the class containing the current object
[Trees]viewing the trees page the trees page
[Index]viewing the index page the index page
[Help]viewing the help page the help page
- -

The "show private" and "hide private" buttons below -the top navigation bar can be used to control whether documentation -for private objects is displayed. Private objects are usually defined -as objects whose (short) names begin with a single underscore, but do -not end with an underscore. For example, "_x", -"__pprint", and "epydoc.epytext._tokenize" -are private objects; but "re.sub", -"__init__", and "type_" are not. However, -if a module defines the "__all__" variable, then its -contents are used to decide which objects are private.

- -

A timestamp below the bottom navigation bar indicates when each -page was last updated.

- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/identifier-index.html b/docs/epy/identifier-index.html deleted file mode 100644 index 3ccb743..0000000 --- a/docs/epy/identifier-index.html +++ /dev/null @@ -1,1293 +0,0 @@ - - - - - Identifier Index - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - - -
[hide private]
[frames] | no frames]
-
- -
-

Identifier Index

-
-[ - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - _ -] -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

C

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

D

- - - - - - - - - - - - - - - - - - - - - - -

E

- - - - - - - - - - - - -

F

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

G

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

H

- - - - - - - - - - - - -

I

- - - - - - - - - - - - - - - - - -

K

- - - - - - - - -

L

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

M

- - - - - - - - - - - - - - - - - - - - - - -

N

- - - - - - - - - - - - -

O

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

P

- - - - - - - - - - - - - - - - - -

Q

- - - - - - - - -

R

- - - - - - - - - - - - - - - - - - - - - - -

S

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

T

- - - - - - - - - - - - - - - - - -

U

- - - - - - - - - - - - -

V

- - - - - - - - - - - - - - - - - -

X

- - - - - - - - -

_

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/index.html b/docs/epy/index.html deleted file mode 100644 index ea17d6d..0000000 --- a/docs/epy/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - API Documentation - - - - - - - - - diff --git a/docs/epy/module-tree.html b/docs/epy/module-tree.html deleted file mode 100644 index a53a8b9..0000000 --- a/docs/epy/module-tree.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Module Hierarchy - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - - -
[hide private]
[frames] | no frames]
-
-
- [ Module Hierarchy - | Class Hierarchy ] -

-

Module Hierarchy

- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client-module.html b/docs/epy/oauth2client-module.html deleted file mode 100644 index bd7d5a2..0000000 --- a/docs/epy/oauth2client-module.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - oauth2client - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Package oauth2client

source code

-
-Client library for using OAuth2, especially with Google APIs.
-
-
- -
-

Version: - 1.4.2 -

-
- - - - - - -
- - - - - -
Submodules[hide private]
-
-
- -
- - - - - - - - - - - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - GOOGLE_AUTH_URI = 'https://accounts.google.com/o/oauth2/auth' -
-   - - GOOGLE_DEVICE_URI = 'https://accounts.google.com/o/oauth2/devi... -
-   - - GOOGLE_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke' -
-   - - GOOGLE_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token' -
- - - - - - -
- - - - - -
Variables Details[hide private]
-
- -
- -
-

GOOGLE_DEVICE_URI

- -
-
-
-
Value:
-
-'https://accounts.google.com/o/oauth2/device/code'
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client-pysrc.html b/docs/epy/oauth2client-pysrc.html deleted file mode 100644 index a2eda66..0000000 --- a/docs/epy/oauth2client-pysrc.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - oauth2client - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Package oauth2client

-
- 1  """Client library for using OAuth2, especially with Google APIs.""" 
- 2   
- 3  __version__ = '1.4.2' 
- 4   
- 5  GOOGLE_AUTH_URI = 'https://accounts.google.com/o/oauth2/auth' 
- 6  GOOGLE_DEVICE_URI = 'https://accounts.google.com/o/oauth2/device/code' 
- 7  GOOGLE_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke' 
- 8  GOOGLE_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token' 
- 9   
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.anyjson-module.html b/docs/epy/oauth2client.anyjson-module.html deleted file mode 100644 index 942e155..0000000 --- a/docs/epy/oauth2client.anyjson-module.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - oauth2client.anyjson - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module anyjson - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module anyjson

source code

-
-Utility module to import a JSON module
-
-Hides all the messy details of exactly where
-we get a simplejson module from.
-
-
- -
-

Author: - jcgregorio@google.com (Joe Gregorio) -

-
- - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.anyjson-pysrc.html b/docs/epy/oauth2client.anyjson-pysrc.html deleted file mode 100644 index f599941..0000000 --- a/docs/epy/oauth2client.anyjson-pysrc.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - oauth2client.anyjson - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module anyjson - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.anyjson

-
- 1  # Copyright 2014 Google Inc. All rights reserved. 
- 2  # 
- 3  # Licensed under the Apache License, Version 2.0 (the "License"); 
- 4  # you may not use this file except in compliance with the License. 
- 5  # You may obtain a copy of the License at 
- 6  # 
- 7  #      http://www.apache.org/licenses/LICENSE-2.0 
- 8  # 
- 9  # Unless required by applicable law or agreed to in writing, software 
-10  # distributed under the License is distributed on an "AS IS" BASIS, 
-11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-12  # See the License for the specific language governing permissions and 
-13  # limitations under the License. 
-14   
-15  """Utility module to import a JSON module 
-16   
-17  Hides all the messy details of exactly where 
-18  we get a simplejson module from. 
-19  """ 
-20   
-21  __author__ = 'jcgregorio@google.com (Joe Gregorio)' 
-22   
-23   
-24  try: # pragma: no cover 
-25    # Should work for Python2.6 and higher. 
-26    import json as simplejson 
-27  except ImportError: # pragma: no cover 
-28    try: 
-29      import simplejson 
-30    except ImportError: 
-31      # Try to import from django, should work on App Engine 
-32      from django.utils import simplejson 
-33   
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine-module.html b/docs/epy/oauth2client.appengine-module.html deleted file mode 100644 index c731c5c..0000000 --- a/docs/epy/oauth2client.appengine-module.html +++ /dev/null @@ -1,601 +0,0 @@ - - - - - oauth2client.appengine - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module appengine

source code

-
-Utilities for Google App Engine
-
-Utilities for making it easier to use OAuth 2.0 on Google App Engine.
-
-
- -
-

Author: - jcgregorio@google.com (Joe Gregorio) -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - InvalidClientSecretsError
- The client_secrets.json file is malformed or missing required fields. -
-   - - InvalidXsrfTokenError
- The XSRF token is invalid or expired. -
-   - - SiteXsrfSecretKey
- Storage for the sites XSRF secret key. -
-   - - SiteXsrfSecretKeyNDB
- NDB Model for storage for the sites XSRF secret key. -
-   - - AppAssertionCredentials
- Credentials object for App Engine Assertion Grants -
-   - - FlowProperty
- App Engine datastore Property for Flow. -
-   - - FlowNDBProperty
- App Engine NDB datastore Property for Flow. -
-   - - CredentialsProperty
- App Engine datastore Property for Credentials. -
-   - - CredentialsNDBProperty
- App Engine NDB datastore Property for Credentials. -
-   - - StorageByKeyName
- Store and retrieve a credential to and from the App Engine datastore. -
-   - - CredentialsModel
- Storage for OAuth 2.0 Credentials -
-   - - CredentialsNDBModel
- NDB Model for storage of OAuth 2.0 Credentials -
-   - - OAuth2Decorator
- Utility for making OAuth 2.0 easier. -
-   - - OAuth2DecoratorFromClientSecrets
- An OAuth2Decorator that builds from a clientsecrets file. -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Functions[hide private]
-
-   - - - - - - -
_safe_html(s)
- Escape text to make it safe to display.
- source code - -
- -
-   - - - - - - -
_generate_new_xsrf_secret_key()
- Returns a random XSRF secret key.
- source code - -
- -
-   - - - - - - -
xsrf_secret_key()
- Return the secret key for use for XSRF protection.
- source code - -
- -
-   - - - - - - -
_build_state_value(request_handler, - user)
- Composes the value for the 'state' parameter.
- source code - -
- -
-   - - - - - - -
_parse_state_value(state, - user)
- Parse the value of the 'state' parameter.
- source code - -
- -
-   - - - - - - -
oauth2decorator_from_clientsecrets(filename, - scope, - message=None, - cache=None)
- Creates an OAuth2Decorator populated from a clientsecrets file.
- source code - -
- -
- - - - - - - - - - - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - ndb = None -
-   - - logger = logging.getLogger(__name__) -
-   - - OAUTH2CLIENT_NAMESPACE = 'oauth2client#ns' -
-   - - XSRF_MEMCACHE_ID = 'xsrf_secret_key' -
- - - - - - -
- - - - - -
Function Details[hide private]
-
- -
- -
- - -
-

_safe_html(s) -

-
source code  -
- -
-Escape text to make it safe to display.
-
-Args:
-  s: string, The text to escape.
-
-Returns:
-  The escaped text as a string.
-
-
-
-
-
-
- -
- -
- - -
-

xsrf_secret_key() -

-
source code  -
- -
-Return the secret key for use for XSRF protection.
-
-If the Site entity does not have a secret key, this method will also create
-one and persist it.
-
-Returns:
-  The secret key.
-
-
-
-
-
-
- -
- -
- - -
-

_build_state_value(request_handler, - user) -

-
source code  -
- -
-Composes the value for the 'state' parameter.
-
-Packs the current request URI and an XSRF token into an opaque string that
-can be passed to the authentication server via the 'state' parameter.
-
-Args:
-  request_handler: webapp.RequestHandler, The request.
-  user: google.appengine.api.users.User, The current user.
-
-Returns:
-  The state value as a string.
-
-
-
-
-
-
- -
- -
- - -
-

_parse_state_value(state, - user) -

-
source code  -
- -
-Parse the value of the 'state' parameter.
-
-Parses the value and validates the XSRF token in the state parameter.
-
-Args:
-  state: string, The value of the state parameter.
-  user: google.appengine.api.users.User, The current user.
-
-Raises:
-  InvalidXsrfTokenError: if the XSRF token is invalid.
-
-Returns:
-  The redirect URI.
-
-
-
-
-
-
- -
- -
- - -
-

oauth2decorator_from_clientsecrets(filename, - scope, - message=None, - cache=None) -

-
source code  -
- -
-Creates an OAuth2Decorator populated from a clientsecrets file.
-
-Args:
-  filename: string, File name of client secrets.
-  scope: string or list of strings, scope(s) of the credentials being
-    requested.
-  message: string, A friendly string to display to the user if the
-    clientsecrets file is missing or invalid. The message may contain HTML and
-    will be presented on the web interface for any method that uses the
-    decorator.
-  cache: An optional cache service client that implements get() and set()
-    methods. See clientsecrets.loadfile() for details.
-
-Returns: An OAuth2Decorator
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine-pysrc.html b/docs/epy/oauth2client.appengine-pysrc.html deleted file mode 100644 index 7202b62..0000000 --- a/docs/epy/oauth2client.appengine-pysrc.html +++ /dev/null @@ -1,1290 +0,0 @@ - - - - - oauth2client.appengine - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.appengine

-
-  1  # Copyright 2014 Google Inc. All rights reserved. 
-  2  # 
-  3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  4  # you may not use this file except in compliance with the License. 
-  5  # You may obtain a copy of the License at 
-  6  # 
-  7  #      http://www.apache.org/licenses/LICENSE-2.0 
-  8  # 
-  9  # Unless required by applicable law or agreed to in writing, software 
- 10  # distributed under the License is distributed on an "AS IS" BASIS, 
- 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 12  # See the License for the specific language governing permissions and 
- 13  # limitations under the License. 
- 14   
- 15  """Utilities for Google App Engine 
- 16   
- 17  Utilities for making it easier to use OAuth 2.0 on Google App Engine. 
- 18  """ 
- 19   
- 20  __author__ = 'jcgregorio@google.com (Joe Gregorio)' 
- 21   
- 22  import cgi 
- 23  import json 
- 24  import logging 
- 25  import os 
- 26  import pickle 
- 27  import threading 
- 28   
- 29  import httplib2 
- 30   
- 31  from google.appengine.api import app_identity 
- 32  from google.appengine.api import memcache 
- 33  from google.appengine.api import users 
- 34  from google.appengine.ext import db 
- 35  from google.appengine.ext import webapp 
- 36  from google.appengine.ext.webapp.util import login_required 
- 37  from google.appengine.ext.webapp.util import run_wsgi_app 
- 38  from oauth2client import GOOGLE_AUTH_URI 
- 39  from oauth2client import GOOGLE_REVOKE_URI 
- 40  from oauth2client import GOOGLE_TOKEN_URI 
- 41  from oauth2client import clientsecrets 
- 42  from oauth2client import util 
- 43  from oauth2client import xsrfutil 
- 44  from oauth2client.client import AccessTokenRefreshError 
- 45  from oauth2client.client import AssertionCredentials 
- 46  from oauth2client.client import Credentials 
- 47  from oauth2client.client import Flow 
- 48  from oauth2client.client import OAuth2WebServerFlow 
- 49  from oauth2client.client import Storage 
- 50   
- 51  # TODO(dhermes): Resolve import issue. 
- 52  # This is a temporary fix for a Google internal issue. 
- 53  try: 
- 54    from google.appengine.ext import ndb 
- 55  except ImportError: 
- 56    ndb = None 
- 57   
- 58   
- 59  logger = logging.getLogger(__name__) 
- 60   
- 61  OAUTH2CLIENT_NAMESPACE = 'oauth2client#ns' 
- 62   
- 63  XSRF_MEMCACHE_ID = 'xsrf_secret_key' 
-
64 - 65 - 66 -def _safe_html(s): -
67 """Escape text to make it safe to display. - 68 - 69 Args: - 70 s: string, The text to escape. - 71 - 72 Returns: - 73 The escaped text as a string. - 74 """ - 75 return cgi.escape(s, quote=1).replace("'", ''') -
76 -
77 - 78 -class InvalidClientSecretsError(Exception): -
79 """The client_secrets.json file is malformed or missing required fields.""" -
80 -
81 - 82 -class InvalidXsrfTokenError(Exception): -
83 """The XSRF token is invalid or expired.""" -
84 -
85 - 86 -class SiteXsrfSecretKey(db.Model): -
87 """Storage for the sites XSRF secret key. - 88 - 89 There will only be one instance stored of this model, the one used for the - 90 site. - 91 """ - 92 secret = db.StringProperty() -
93 - 94 if ndb is not None: -
95 - class SiteXsrfSecretKeyNDB(ndb.Model): -
96 """NDB Model for storage for the sites XSRF secret key. - 97 - 98 Since this model uses the same kind as SiteXsrfSecretKey, it can be used - 99 interchangeably. This simply provides an NDB model for interacting with the -100 same data the DB model interacts with. -101 -102 There should only be one instance stored of this model, the one used for the -103 site. -104 """ -105 secret = ndb.StringProperty() -106 -107 @classmethod -
108 - def _get_kind(cls): -
109 """Return the kind name for this class.""" -110 return 'SiteXsrfSecretKey' -
111 -
114 """Returns a random XSRF secret key. -115 """ -116 return os.urandom(16).encode("hex") -
117 -
118 -119 -def xsrf_secret_key(): -
120 """Return the secret key for use for XSRF protection. -121 -122 If the Site entity does not have a secret key, this method will also create -123 one and persist it. -124 -125 Returns: -126 The secret key. -127 """ -128 secret = memcache.get(XSRF_MEMCACHE_ID, namespace=OAUTH2CLIENT_NAMESPACE) -129 if not secret: -130 # Load the one and only instance of SiteXsrfSecretKey. -131 model = SiteXsrfSecretKey.get_or_insert(key_name='site') -132 if not model.secret: -133 model.secret = _generate_new_xsrf_secret_key() -134 model.put() -135 secret = model.secret -136 memcache.add(XSRF_MEMCACHE_ID, secret, namespace=OAUTH2CLIENT_NAMESPACE) -137 -138 return str(secret) -
139 -
140 -141 -class AppAssertionCredentials(AssertionCredentials): -
142 """Credentials object for App Engine Assertion Grants -143 -144 This object will allow an App Engine application to identify itself to Google -145 and other OAuth 2.0 servers that can verify assertions. It can be used for the -146 purpose of accessing data stored under an account assigned to the App Engine -147 application itself. -148 -149 This credential does not require a flow to instantiate because it represents -150 a two legged flow, and therefore has all of the required information to -151 generate and refresh its own access tokens. -152 """ -153 -154 @util.positional(2) -
155 - def __init__(self, scope, **kwargs): -
156 """Constructor for AppAssertionCredentials -157 -158 Args: -159 scope: string or iterable of strings, scope(s) of the credentials being -160 requested. -161 **kwargs: optional keyword args, including: -162 service_account_id: service account id of the application. If None or -163 unspecified, the default service account for the app is used. -164 """ -165 self.scope = util.scopes_to_string(scope) -166 self._kwargs = kwargs -167 self.service_account_id = kwargs.get('service_account_id', None) -168 -169 # Assertion type is no longer used, but still in the parent class signature. -170 super(AppAssertionCredentials, self).__init__(None) -
171 -172 @classmethod -
173 - def from_json(cls, json_data): -
174 data = json.loads(json_data) -175 return AppAssertionCredentials(data['scope']) -
176 -
177 - def _refresh(self, http_request): -
178 """Refreshes the access_token. -179 -180 Since the underlying App Engine app_identity implementation does its own -181 caching we can skip all the storage hoops and just to a refresh using the -182 API. -183 -184 Args: -185 http_request: callable, a callable that matches the method signature of -186 httplib2.Http.request, used to make the refresh request. -187 -188 Raises: -189 AccessTokenRefreshError: When the refresh fails. -190 """ -191 try: -192 scopes = self.scope.split() -193 (token, _) = app_identity.get_access_token( -194 scopes, service_account_id=self.service_account_id) -195 except app_identity.Error as e: -196 raise AccessTokenRefreshError(str(e)) -197 self.access_token = token -
198 -199 @property -
200 - def serialization_data(self): -
201 raise NotImplementedError('Cannot serialize credentials for AppEngine.') -
202 -
203 - def create_scoped_required(self): -
204 return not self.scope -
205 -
206 - def create_scoped(self, scopes): -
207 return AppAssertionCredentials(scopes, **self._kwargs) -
208 -
209 -210 -class FlowProperty(db.Property): -
211 """App Engine datastore Property for Flow. -212 -213 Utility property that allows easy storage and retrieval of an -214 oauth2client.Flow""" -215 -216 # Tell what the user type is. -217 data_type = Flow -218 -219 # For writing to datastore. -
220 - def get_value_for_datastore(self, model_instance): -
221 flow = super(FlowProperty, -222 self).get_value_for_datastore(model_instance) -223 return db.Blob(pickle.dumps(flow)) -
224 -225 # For reading from datastore. -
226 - def make_value_from_datastore(self, value): -
227 if value is None: -228 return None -229 return pickle.loads(value) -
230 -
231 - def validate(self, value): -
232 if value is not None and not isinstance(value, Flow): -233 raise db.BadValueError('Property %s must be convertible ' -234 'to a FlowThreeLegged instance (%s)' % -235 (self.name, value)) -236 return super(FlowProperty, self).validate(value) -
237 -
238 - def empty(self, value): -
239 return not value -
240 -241 -242 if ndb is not None: -
243 - class FlowNDBProperty(ndb.PickleProperty): -
244 """App Engine NDB datastore Property for Flow. -245 -246 Serves the same purpose as the DB FlowProperty, but for NDB models. Since -247 PickleProperty inherits from BlobProperty, the underlying representation of -248 the data in the datastore will be the same as in the DB case. -249 -250 Utility property that allows easy storage and retrieval of an -251 oauth2client.Flow -252 """ -253 -
254 - def _validate(self, value): -
255 """Validates a value as a proper Flow object. -256 -257 Args: -258 value: A value to be set on the property. -259 -260 Raises: -261 TypeError if the value is not an instance of Flow. -262 """ -263 logger.info('validate: Got type %s', type(value)) -264 if value is not None and not isinstance(value, Flow): -265 raise TypeError('Property %s must be convertible to a flow ' -266 'instance; received: %s.' % (self._name, value)) -
267 -
268 -269 -class CredentialsProperty(db.Property): -
270 """App Engine datastore Property for Credentials. -271 -272 Utility property that allows easy storage and retrieval of -273 oath2client.Credentials -274 """ -275 -276 # Tell what the user type is. -277 data_type = Credentials -278 -279 # For writing to datastore. -
280 - def get_value_for_datastore(self, model_instance): -
281 logger.info("get: Got type " + str(type(model_instance))) -282 cred = super(CredentialsProperty, -283 self).get_value_for_datastore(model_instance) -284 if cred is None: -285 cred = '' -286 else: -287 cred = cred.to_json() -288 return db.Blob(cred) -
289 -290 # For reading from datastore. -
291 - def make_value_from_datastore(self, value): -
292 logger.info("make: Got type " + str(type(value))) -293 if value is None: -294 return None -295 if len(value) == 0: -296 return None -297 try: -298 credentials = Credentials.new_from_json(value) -299 except ValueError: -300 credentials = None -301 return credentials -
302 -
303 - def validate(self, value): -
304 value = super(CredentialsProperty, self).validate(value) -305 logger.info("validate: Got type " + str(type(value))) -306 if value is not None and not isinstance(value, Credentials): -307 raise db.BadValueError('Property %s must be convertible ' -308 'to a Credentials instance (%s)' % -309 (self.name, value)) -310 #if value is not None and not isinstance(value, Credentials): -311 # return None -312 return value -
313 -314 -315 if ndb is not None: -
316 # TODO(dhermes): Turn this into a JsonProperty and overhaul the Credentials -317 # and subclass mechanics to use new_from_dict, to_dict, -318 # from_dict, etc. -319 - class CredentialsNDBProperty(ndb.BlobProperty): -
320 """App Engine NDB datastore Property for Credentials. -321 -322 Serves the same purpose as the DB CredentialsProperty, but for NDB models. -323 Since CredentialsProperty stores data as a blob and this inherits from -324 BlobProperty, the data in the datastore will be the same as in the DB case. -325 -326 Utility property that allows easy storage and retrieval of Credentials and -327 subclasses. -328 """ -
329 - def _validate(self, value): -
330 """Validates a value as a proper credentials object. -331 -332 Args: -333 value: A value to be set on the property. -334 -335 Raises: -336 TypeError if the value is not an instance of Credentials. -337 """ -338 logger.info('validate: Got type %s', type(value)) -339 if value is not None and not isinstance(value, Credentials): -340 raise TypeError('Property %s must be convertible to a credentials ' -341 'instance; received: %s.' % (self._name, value)) -
342 -
343 - def _to_base_type(self, value): -
344 """Converts our validated value to a JSON serialized string. -345 -346 Args: -347 value: A value to be set in the datastore. -348 -349 Returns: -350 A JSON serialized version of the credential, else '' if value is None. -351 """ -352 if value is None: -353 return '' -354 else: -355 return value.to_json() -
356 -
357 - def _from_base_type(self, value): -
358 """Converts our stored JSON string back to the desired type. -359 -360 Args: -361 value: A value from the datastore to be converted to the desired type. -362 -363 Returns: -364 A deserialized Credentials (or subclass) object, else None if the -365 value can't be parsed. -366 """ -367 if not value: -368 return None -369 try: -370 # Uses the from_json method of the implied class of value -371 credentials = Credentials.new_from_json(value) -372 except ValueError: -373 credentials = None -374 return credentials -
375 -
376 -377 -class StorageByKeyName(Storage): -
378 """Store and retrieve a credential to and from the App Engine datastore. -379 -380 This Storage helper presumes the Credentials have been stored as a -381 CredentialsProperty or CredentialsNDBProperty on a datastore model class, and -382 that entities are stored by key_name. -383 """ -384 -385 @util.positional(4) -
386 - def __init__(self, model, key_name, property_name, cache=None, user=None): -
387 """Constructor for Storage. -388 -389 Args: -390 model: db.Model or ndb.Model, model class -391 key_name: string, key name for the entity that has the credentials -392 property_name: string, name of the property that is a CredentialsProperty -393 or CredentialsNDBProperty. -394 cache: memcache, a write-through cache to put in front of the datastore. -395 If the model you are using is an NDB model, using a cache will be -396 redundant since the model uses an instance cache and memcache for you. -397 user: users.User object, optional. Can be used to grab user ID as a -398 key_name if no key name is specified. -399 """ -400 if key_name is None: -401 if user is None: -402 raise ValueError('StorageByKeyName called with no key name or user.') -403 key_name = user.user_id() -404 -405 self._model = model -406 self._key_name = key_name -407 self._property_name = property_name -408 self._cache = cache -
409 -
410 - def _is_ndb(self): -
411 """Determine whether the model of the instance is an NDB model. -412 -413 Returns: -414 Boolean indicating whether or not the model is an NDB or DB model. -415 """ -416 # issubclass will fail if one of the arguments is not a class, only need -417 # worry about new-style classes since ndb and db models are new-style -418 if isinstance(self._model, type): -419 if ndb is not None and issubclass(self._model, ndb.Model): -420 return True -421 elif issubclass(self._model, db.Model): -422 return False -423 -424 raise TypeError('Model class not an NDB or DB model: %s.' % (self._model,)) -
425 -
426 - def _get_entity(self): -
427 """Retrieve entity from datastore. -428 -429 Uses a different model method for db or ndb models. -430 -431 Returns: -432 Instance of the model corresponding to the current storage object -433 and stored using the key name of the storage object. -434 """ -435 if self._is_ndb(): -436 return self._model.get_by_id(self._key_name) -437 else: -438 return self._model.get_by_key_name(self._key_name) -
439 -
440 - def _delete_entity(self): -
441 """Delete entity from datastore. -442 -443 Attempts to delete using the key_name stored on the object, whether or not -444 the given key is in the datastore. -445 """ -446 if self._is_ndb(): -447 ndb.Key(self._model, self._key_name).delete() -448 else: -449 entity_key = db.Key.from_path(self._model.kind(), self._key_name) -450 db.delete(entity_key) -
451 -452 @db.non_transactional(allow_existing=True) -
453 - def locked_get(self): -
454 """Retrieve Credential from datastore. -455 -456 Returns: -457 oauth2client.Credentials -458 """ -459 credentials = None -460 if self._cache: -461 json = self._cache.get(self._key_name) -462 if json: -463 credentials = Credentials.new_from_json(json) -464 if credentials is None: -465 entity = self._get_entity() -466 if entity is not None: -467 credentials = getattr(entity, self._property_name) -468 if self._cache: -469 self._cache.set(self._key_name, credentials.to_json()) -470 -471 if credentials and hasattr(credentials, 'set_store'): -472 credentials.set_store(self) -473 return credentials -
474 -475 @db.non_transactional(allow_existing=True) -
476 - def locked_put(self, credentials): -
477 """Write a Credentials to the datastore. -478 -479 Args: -480 credentials: Credentials, the credentials to store. -481 """ -482 entity = self._model.get_or_insert(self._key_name) -483 setattr(entity, self._property_name, credentials) -484 entity.put() -485 if self._cache: -486 self._cache.set(self._key_name, credentials.to_json()) -
487 -488 @db.non_transactional(allow_existing=True) -
489 - def locked_delete(self): -
490 """Delete Credential from datastore.""" -491 -492 if self._cache: -493 self._cache.delete(self._key_name) -494 -495 self._delete_entity() -
496 -
497 -498 -class CredentialsModel(db.Model): -
499 """Storage for OAuth 2.0 Credentials -500 -501 Storage of the model is keyed by the user.user_id(). -502 """ -503 credentials = CredentialsProperty() -
504 -505 -506 if ndb is not None: -
507 - class CredentialsNDBModel(ndb.Model): -
508 """NDB Model for storage of OAuth 2.0 Credentials -509 -510 Since this model uses the same kind as CredentialsModel and has a property -511 which can serialize and deserialize Credentials correctly, it can be used -512 interchangeably with a CredentialsModel to access, insert and delete the -513 same entities. This simply provides an NDB model for interacting with the -514 same data the DB model interacts with. -515 -516 Storage of the model is keyed by the user.user_id(). -517 """ -518 credentials = CredentialsNDBProperty() -519 -520 @classmethod -
521 - def _get_kind(cls): -
522 """Return the kind name for this class.""" -523 return 'CredentialsModel' -
524 -
525 -526 -def _build_state_value(request_handler, user): -
527 """Composes the value for the 'state' parameter. -528 -529 Packs the current request URI and an XSRF token into an opaque string that -530 can be passed to the authentication server via the 'state' parameter. -531 -532 Args: -533 request_handler: webapp.RequestHandler, The request. -534 user: google.appengine.api.users.User, The current user. -535 -536 Returns: -537 The state value as a string. -538 """ -539 uri = request_handler.request.url -540 token = xsrfutil.generate_token(xsrf_secret_key(), user.user_id(), -541 action_id=str(uri)) -542 return uri + ':' + token -
543 -
544 -545 -def _parse_state_value(state, user): -
546 """Parse the value of the 'state' parameter. -547 -548 Parses the value and validates the XSRF token in the state parameter. -549 -550 Args: -551 state: string, The value of the state parameter. -552 user: google.appengine.api.users.User, The current user. -553 -554 Raises: -555 InvalidXsrfTokenError: if the XSRF token is invalid. -556 -557 Returns: -558 The redirect URI. -559 """ -560 uri, token = state.rsplit(':', 1) -561 if not xsrfutil.validate_token(xsrf_secret_key(), token, user.user_id(), -562 action_id=uri): -563 raise InvalidXsrfTokenError() -564 -565 return uri -
566 -
567 -568 -class OAuth2Decorator(object): -
569 """Utility for making OAuth 2.0 easier. -570 -571 Instantiate and then use with oauth_required or oauth_aware -572 as decorators on webapp.RequestHandler methods. -573 -574 Example: -575 -576 decorator = OAuth2Decorator( -577 client_id='837...ent.com', -578 client_secret='Qh...wwI', -579 scope='https://www.googleapis.com/auth/plus') -580 -581 -582 class MainHandler(webapp.RequestHandler): -583 -584 @decorator.oauth_required -585 def get(self): -586 http = decorator.http() -587 # http is authorized with the user's Credentials and can be used -588 # in API calls -589 -590 """ -591 -
592 - def set_credentials(self, credentials): -
593 self._tls.credentials = credentials -
594 -
595 - def get_credentials(self): -
596 """A thread local Credentials object. -597 -598 Returns: -599 A client.Credentials object, or None if credentials hasn't been set in -600 this thread yet, which may happen when calling has_credentials inside -601 oauth_aware. -602 """ -603 return getattr(self._tls, 'credentials', None) -
604 -605 credentials = property(get_credentials, set_credentials) -606 -
607 - def set_flow(self, flow): -
608 self._tls.flow = flow -
609 -
610 - def get_flow(self): -
611 """A thread local Flow object. -612 -613 Returns: -614 A credentials.Flow object, or None if the flow hasn't been set in this -615 thread yet, which happens in _create_flow() since Flows are created -616 lazily. -617 """ -618 return getattr(self._tls, 'flow', None) -
619 -620 flow = property(get_flow, set_flow) -621 -622 -623 @util.positional(4) -
624 - def __init__(self, client_id, client_secret, scope, -625 auth_uri=GOOGLE_AUTH_URI, -626 token_uri=GOOGLE_TOKEN_URI, -627 revoke_uri=GOOGLE_REVOKE_URI, -628 user_agent=None, -629 message=None, -630 callback_path='/oauth2callback', -631 token_response_param=None, -632 _storage_class=StorageByKeyName, -633 _credentials_class=CredentialsModel, -634 _credentials_property_name='credentials', -635 **kwargs): -
636 -637 """Constructor for OAuth2Decorator -638 -639 Args: -640 client_id: string, client identifier. -641 client_secret: string client secret. -642 scope: string or iterable of strings, scope(s) of the credentials being -643 requested. -644 auth_uri: string, URI for authorization endpoint. For convenience -645 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -646 token_uri: string, URI for token endpoint. For convenience -647 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -648 revoke_uri: string, URI for revoke endpoint. For convenience -649 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -650 user_agent: string, User agent of your application, default to None. -651 message: Message to display if there are problems with the OAuth 2.0 -652 configuration. The message may contain HTML and will be presented on the -653 web interface for any method that uses the decorator. -654 callback_path: string, The absolute path to use as the callback URI. Note -655 that this must match up with the URI given when registering the -656 application in the APIs Console. -657 token_response_param: string. If provided, the full JSON response -658 to the access token request will be encoded and included in this query -659 parameter in the callback URI. This is useful with providers (e.g. -660 wordpress.com) that include extra fields that the client may want. -661 _storage_class: "Protected" keyword argument not typically provided to -662 this constructor. A storage class to aid in storing a Credentials object -663 for a user in the datastore. Defaults to StorageByKeyName. -664 _credentials_class: "Protected" keyword argument not typically provided to -665 this constructor. A db or ndb Model class to hold credentials. Defaults -666 to CredentialsModel. -667 _credentials_property_name: "Protected" keyword argument not typically -668 provided to this constructor. A string indicating the name of the field -669 on the _credentials_class where a Credentials object will be stored. -670 Defaults to 'credentials'. -671 **kwargs: dict, Keyword arguments are passed along as kwargs to -672 the OAuth2WebServerFlow constructor. -673 -674 """ -675 self._tls = threading.local() -676 self.flow = None -677 self.credentials = None -678 self._client_id = client_id -679 self._client_secret = client_secret -680 self._scope = util.scopes_to_string(scope) -681 self._auth_uri = auth_uri -682 self._token_uri = token_uri -683 self._revoke_uri = revoke_uri -684 self._user_agent = user_agent -685 self._kwargs = kwargs -686 self._message = message -687 self._in_error = False -688 self._callback_path = callback_path -689 self._token_response_param = token_response_param -690 self._storage_class = _storage_class -691 self._credentials_class = _credentials_class -692 self._credentials_property_name = _credentials_property_name -
693 -
694 - def _display_error_message(self, request_handler): -
695 request_handler.response.out.write('<html><body>') -696 request_handler.response.out.write(_safe_html(self._message)) -697 request_handler.response.out.write('</body></html>') -
698 -
699 - def oauth_required(self, method): -
700 """Decorator that starts the OAuth 2.0 dance. -701 -702 Starts the OAuth dance for the logged in user if they haven't already -703 granted access for this application. -704 -705 Args: -706 method: callable, to be decorated method of a webapp.RequestHandler -707 instance. -708 """ -709 -710 def check_oauth(request_handler, *args, **kwargs): -711 if self._in_error: -712 self._display_error_message(request_handler) -713 return -714 -715 user = users.get_current_user() -716 # Don't use @login_decorator as this could be used in a POST request. -717 if not user: -718 request_handler.redirect(users.create_login_url( -719 request_handler.request.uri)) -720 return -721 -722 self._create_flow(request_handler) -723 -724 # Store the request URI in 'state' so we can use it later -725 self.flow.params['state'] = _build_state_value(request_handler, user) -726 self.credentials = self._storage_class( -727 self._credentials_class, None, -728 self._credentials_property_name, user=user).get() -729 -730 if not self.has_credentials(): -731 return request_handler.redirect(self.authorize_url()) -732 try: -733 resp = method(request_handler, *args, **kwargs) -734 except AccessTokenRefreshError: -735 return request_handler.redirect(self.authorize_url()) -736 finally: -737 self.credentials = None -738 return resp -
739 -740 return check_oauth -
741 -
742 - def _create_flow(self, request_handler): -
743 """Create the Flow object. -744 -745 The Flow is calculated lazily since we don't know where this app is -746 running until it receives a request, at which point redirect_uri can be -747 calculated and then the Flow object can be constructed. -748 -749 Args: -750 request_handler: webapp.RequestHandler, the request handler. -751 """ -752 if self.flow is None: -753 redirect_uri = request_handler.request.relative_url( -754 self._callback_path) # Usually /oauth2callback -755 self.flow = OAuth2WebServerFlow(self._client_id, self._client_secret, -756 self._scope, redirect_uri=redirect_uri, -757 user_agent=self._user_agent, -758 auth_uri=self._auth_uri, -759 token_uri=self._token_uri, -760 revoke_uri=self._revoke_uri, -761 **self._kwargs) -
762 -
763 - def oauth_aware(self, method): -
764 """Decorator that sets up for OAuth 2.0 dance, but doesn't do it. -765 -766 Does all the setup for the OAuth dance, but doesn't initiate it. -767 This decorator is useful if you want to create a page that knows -768 whether or not the user has granted access to this application. -769 From within a method decorated with @oauth_aware the has_credentials() -770 and authorize_url() methods can be called. -771 -772 Args: -773 method: callable, to be decorated method of a webapp.RequestHandler -774 instance. -775 """ -776 -777 def setup_oauth(request_handler, *args, **kwargs): -778 if self._in_error: -779 self._display_error_message(request_handler) -780 return -781 -782 user = users.get_current_user() -783 # Don't use @login_decorator as this could be used in a POST request. -784 if not user: -785 request_handler.redirect(users.create_login_url( -786 request_handler.request.uri)) -787 return -788 -789 self._create_flow(request_handler) -790 -791 self.flow.params['state'] = _build_state_value(request_handler, user) -792 self.credentials = self._storage_class( -793 self._credentials_class, None, -794 self._credentials_property_name, user=user).get() -795 try: -796 resp = method(request_handler, *args, **kwargs) -797 finally: -798 self.credentials = None -799 return resp -
800 return setup_oauth -801 -802 -
803 - def has_credentials(self): -
804 """True if for the logged in user there are valid access Credentials. -805 -806 Must only be called from with a webapp.RequestHandler subclassed method -807 that had been decorated with either @oauth_required or @oauth_aware. -808 """ -809 return self.credentials is not None and not self.credentials.invalid -
810 -
811 - def authorize_url(self): -
812 """Returns the URL to start the OAuth dance. -813 -814 Must only be called from with a webapp.RequestHandler subclassed method -815 that had been decorated with either @oauth_required or @oauth_aware. -816 """ -817 url = self.flow.step1_get_authorize_url() -818 return str(url) -
819 -
820 - def http(self, *args, **kwargs): -
821 """Returns an authorized http instance. -822 -823 Must only be called from within an @oauth_required decorated method, or -824 from within an @oauth_aware decorated method where has_credentials() -825 returns True. -826 -827 Args: -828 *args: Positional arguments passed to httplib2.Http constructor. -829 **kwargs: Positional arguments passed to httplib2.Http constructor. -830 """ -831 return self.credentials.authorize(httplib2.Http(*args, **kwargs)) -
832 -833 @property -
834 - def callback_path(self): -
835 """The absolute path where the callback will occur. -836 -837 Note this is the absolute path, not the absolute URI, that will be -838 calculated by the decorator at runtime. See callback_handler() for how this -839 should be used. -840 -841 Returns: -842 The callback path as a string. -843 """ -844 return self._callback_path -
845 -846 -
847 - def callback_handler(self): -
848 """RequestHandler for the OAuth 2.0 redirect callback. -849 -850 Usage: -851 app = webapp.WSGIApplication([ -852 ('/index', MyIndexHandler), -853 ..., -854 (decorator.callback_path, decorator.callback_handler()) -855 ]) -856 -857 Returns: -858 A webapp.RequestHandler that handles the redirect back from the -859 server during the OAuth 2.0 dance. -860 """ -861 decorator = self -862 -863 class OAuth2Handler(webapp.RequestHandler): -864 """Handler for the redirect_uri of the OAuth 2.0 dance.""" -865 -866 @login_required -867 def get(self): -868 error = self.request.get('error') -869 if error: -870 errormsg = self.request.get('error_description', error) -871 self.response.out.write( -872 'The authorization request failed: %s' % _safe_html(errormsg)) -873 else: -874 user = users.get_current_user() -875 decorator._create_flow(self) -876 credentials = decorator.flow.step2_exchange(self.request.params) -877 decorator._storage_class( -878 decorator._credentials_class, None, -879 decorator._credentials_property_name, user=user).put(credentials) -880 redirect_uri = _parse_state_value(str(self.request.get('state')), -881 user) -882 -883 if decorator._token_response_param and credentials.token_response: -884 resp_json = json.dumps(credentials.token_response) -885 redirect_uri = util._add_query_parameter( -886 redirect_uri, decorator._token_response_param, resp_json) -887 -888 self.redirect(redirect_uri) -
889 -890 return OAuth2Handler -891 -
892 - def callback_application(self): -
893 """WSGI application for handling the OAuth 2.0 redirect callback. -894 -895 If you need finer grained control use `callback_handler` which returns just -896 the webapp.RequestHandler. -897 -898 Returns: -899 A webapp.WSGIApplication that handles the redirect back from the -900 server during the OAuth 2.0 dance. -901 """ -902 return webapp.WSGIApplication([ -903 (self.callback_path, self.callback_handler()) -904 ]) -
905 -
906 -907 -class OAuth2DecoratorFromClientSecrets(OAuth2Decorator): -
908 """An OAuth2Decorator that builds from a clientsecrets file. -909 -910 Uses a clientsecrets file as the source for all the information when -911 constructing an OAuth2Decorator. -912 -913 Example: -914 -915 decorator = OAuth2DecoratorFromClientSecrets( -916 os.path.join(os.path.dirname(__file__), 'client_secrets.json') -917 scope='https://www.googleapis.com/auth/plus') -918 -919 -920 class MainHandler(webapp.RequestHandler): -921 -922 @decorator.oauth_required -923 def get(self): -924 http = decorator.http() -925 # http is authorized with the user's Credentials and can be used -926 # in API calls -927 """ -928 -929 @util.positional(3) -
930 - def __init__(self, filename, scope, message=None, cache=None, **kwargs): -
931 """Constructor -932 -933 Args: -934 filename: string, File name of client secrets. -935 scope: string or iterable of strings, scope(s) of the credentials being -936 requested. -937 message: string, A friendly string to display to the user if the -938 clientsecrets file is missing or invalid. The message may contain HTML -939 and will be presented on the web interface for any method that uses the -940 decorator. -941 cache: An optional cache service client that implements get() and set() -942 methods. See clientsecrets.loadfile() for details. -943 **kwargs: dict, Keyword arguments are passed along as kwargs to -944 the OAuth2WebServerFlow constructor. -945 """ -946 client_type, client_info = clientsecrets.loadfile(filename, cache=cache) -947 if client_type not in [ -948 clientsecrets.TYPE_WEB, clientsecrets.TYPE_INSTALLED]: -949 raise InvalidClientSecretsError( -950 "OAuth2Decorator doesn't support this OAuth 2.0 flow.") -951 constructor_kwargs = dict(kwargs) -952 constructor_kwargs.update({ -953 'auth_uri': client_info['auth_uri'], -954 'token_uri': client_info['token_uri'], -955 'message': message, -956 }) -957 revoke_uri = client_info.get('revoke_uri') -958 if revoke_uri is not None: -959 constructor_kwargs['revoke_uri'] = revoke_uri -960 super(OAuth2DecoratorFromClientSecrets, self).__init__( -961 client_info['client_id'], client_info['client_secret'], -962 scope, **constructor_kwargs) -963 if message is not None: -964 self._message = message -965 else: -966 self._message = 'Please configure your application for OAuth 2.0.' -
967 -
968 -969 @util.positional(2) -970 -def oauth2decorator_from_clientsecrets(filename, scope, -971 message=None, cache=None): -
972 """Creates an OAuth2Decorator populated from a clientsecrets file. -973 -974 Args: -975 filename: string, File name of client secrets. -976 scope: string or list of strings, scope(s) of the credentials being -977 requested. -978 message: string, A friendly string to display to the user if the -979 clientsecrets file is missing or invalid. The message may contain HTML and -980 will be presented on the web interface for any method that uses the -981 decorator. -982 cache: An optional cache service client that implements get() and set() -983 methods. See clientsecrets.loadfile() for details. -984 -985 Returns: An OAuth2Decorator -986 -987 """ -988 return OAuth2DecoratorFromClientSecrets(filename, scope, -989 message=message, cache=cache) -
990 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.AppAssertionCredentials-class.html b/docs/epy/oauth2client.appengine.AppAssertionCredentials-class.html deleted file mode 100644 index d86d523..0000000 --- a/docs/epy/oauth2client.appengine.AppAssertionCredentials-class.html +++ /dev/null @@ -1,639 +0,0 @@ - - - - - oauth2client.appengine.AppAssertionCredentials - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class AppAssertionCredentials - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class AppAssertionCredentials

source code

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-Credentials object for App Engine Assertion Grants
-
-This object will allow an App Engine application to identify itself to Google
-and other OAuth 2.0 servers that can verify assertions. It can be used for the
-purpose of accessing data stored under an account assigned to the App Engine
-application itself.
-
-This credential does not require a flow to instantiate because it represents
-a two legged flow, and therefore has all of the required information to
-generate and refresh its own access tokens.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - scope, - **kwargs)
- Constructor for AppAssertionCredentials
- source code - -
- -
-   - - - - - - -
_refresh(self, - http_request)
- Refreshes the access_token.
- source code - -
- -
-   - - - - - - -
serialization_data(self)
- Get the fields and their values identifying the current credentials.
- source code - -
- -
-   - - - - - - -
create_scoped_required(self)
- Whether this Credentials object is scopeless.
- source code - -
- -
-   - - - - - - -
create_scoped(self, - scopes)
- Create a Credentials object for the given scopes.
- source code - -
- -
- -

Inherited from client.OAuth2Credentials: - __getstate__, - __setstate__, - access_token_expired, - apply, - authorize, - get_access_token, - refresh, - revoke, - set_store, - to_json -

- -

Inherited from client.Credentials (private): - _to_json -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-   - - - - - - -
from_json(cls, - json_data)
- Instantiate a Credentials object from a JSON description of it.
- source code - -
- -
-

Inherited from client.Credentials: - new_from_json -

-
- - - - - - - - - -
- - - - - -
Static Methods[hide private]
-
-

Inherited from client.GoogleCredentials: - from_stream, - get_application_default -

-
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-

Inherited from client.Credentials: - NON_SERIALIZED_MEMBERS -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - scope, - **kwargs) -
(Constructor) -

-
source code  -
- -
-Constructor for AppAssertionCredentials
-
-Args:
-  scope: string or iterable of strings, scope(s) of the credentials being
-    requested.
-  **kwargs: optional keyword args, including:
-    service_account_id: service account id of the application. If None or
-      unspecified, the default service account for the app is used.
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

from_json(cls, - json_data) -
Class Method -

-
source code  -
- -
-Instantiate a Credentials object from a JSON description of it. The JSON
-should have been produced by calling .to_json() on the object.
-
-Args:
-  data: dict, A deserialized JSON object.
-
-Returns:
-  An instance of a Credentials subclass.
-
-
-
-
Overrides: - client.Credentials.from_json -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

_refresh(self, - http_request) -

-
source code  -
- -
-Refreshes the access_token.
-
-Since the underlying App Engine app_identity implementation does its own
-caching we can skip all the storage hoops and just to a refresh using the
-API.
-
-Args:
-  http_request: callable, a callable that matches the method signature of
-    httplib2.Http.request, used to make the refresh request.
-
-Raises:
-  AccessTokenRefreshError: When the refresh fails.
-
-
-
-
Overrides: - client.OAuth2Credentials._refresh -
-
-
-
- -
- -
- - -
-

serialization_data(self) -

-
source code  -
- -
-Get the fields and their values identifying the current credentials.
-
-
-
-
Decorators:
-
    -
  • @property
  • -
-
Overrides: - client.GoogleCredentials.serialization_data -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

create_scoped_required(self) -

-
source code  -
- -
-Whether this Credentials object is scopeless.
-
-create_scoped(scopes) method needs to be called in order to create
-a Credentials object for API calls.
-
-
-
-
Overrides: - client.GoogleCredentials.create_scoped_required -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

create_scoped(self, - scopes) -

-
source code  -
- -
-Create a Credentials object for the given scopes.
-
-The Credentials type is preserved.
-
-
-
-
Overrides: - client.GoogleCredentials.create_scoped -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.CredentialsModel-class.html b/docs/epy/oauth2client.appengine.CredentialsModel-class.html deleted file mode 100644 index f7d491e..0000000 --- a/docs/epy/oauth2client.appengine.CredentialsModel-class.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - oauth2client.appengine.CredentialsModel - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class CredentialsModel - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class CredentialsModel

source code

-
-
- - - - -
-
-
-
-Storage for OAuth 2.0 Credentials
-
-Storage of the model is keyed by the user.user_id().
-
-
- - - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - credentials = CredentialsProperty() -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.CredentialsNDBModel-class.html b/docs/epy/oauth2client.appengine.CredentialsNDBModel-class.html deleted file mode 100644 index a49f521..0000000 --- a/docs/epy/oauth2client.appengine.CredentialsNDBModel-class.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - oauth2client.appengine.CredentialsNDBModel - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class CredentialsNDBModel - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class CredentialsNDBModel

source code

-
-
- - - - - -
-
-
-
-NDB Model for storage of OAuth 2.0 Credentials
-
-Since this model uses the same kind as CredentialsModel and has a property
-which can serialize and deserialize Credentials correctly, it can be used
-interchangeably with a CredentialsModel to access, insert and delete the
-same entities. This simply provides an NDB model for interacting with the
-same data the DB model interacts with.
-
-Storage of the model is keyed by the user.user_id().
-
-
- - - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-   - - - - - - -
_get_kind(cls)
- Return the kind name for this class.
- source code - -
- -
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - credentials = CredentialsNDBProperty() -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.CredentialsNDBProperty-class.html b/docs/epy/oauth2client.appengine.CredentialsNDBProperty-class.html deleted file mode 100644 index ad9dd45..0000000 --- a/docs/epy/oauth2client.appengine.CredentialsNDBProperty-class.html +++ /dev/null @@ -1,305 +0,0 @@ - - - - - oauth2client.appengine.CredentialsNDBProperty - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class CredentialsNDBProperty - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class CredentialsNDBProperty

source code

-
-
- - - - -
-
-
-
-App Engine NDB datastore Property for Credentials.
-
-Serves the same purpose as the DB CredentialsProperty, but for NDB models.
-Since CredentialsProperty stores data as a blob and this inherits from
-BlobProperty, the data in the datastore will be the same as in the DB case.
-
-Utility property that allows easy storage and retrieval of Credentials and
-subclasses.
-
-
- - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
_validate(self, - value)
- Validates a value as a proper credentials object.
- source code - -
- -
-   - - - - - - -
_to_base_type(self, - value)
- Converts our validated value to a JSON serialized string.
- source code - -
- -
-   - - - - - - -
_from_base_type(self, - value)
- Converts our stored JSON string back to the desired type.
- source code - -
- -
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

_validate(self, - value) -

-
source code  -
- -
-Validates a value as a proper credentials object.
-
-Args:
-  value: A value to be set on the property.
-
-Raises:
-  TypeError if the value is not an instance of Credentials.
-
-
-
-
-
-
- -
- -
- - -
-

_to_base_type(self, - value) -

-
source code  -
- -
-Converts our validated value to a JSON serialized string.
-
-Args:
-  value: A value to be set in the datastore.
-
-Returns:
-  A JSON serialized version of the credential, else '' if value is None.
-
-
-
-
-
-
- -
- -
- - -
-

_from_base_type(self, - value) -

-
source code  -
- -
-Converts our stored JSON string back to the desired type.
-
-Args:
-  value: A value from the datastore to be converted to the desired type.
-
-Returns:
-  A deserialized Credentials (or subclass) object, else None if the
-      value can't be parsed.
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.CredentialsProperty-class.html b/docs/epy/oauth2client.appengine.CredentialsProperty-class.html deleted file mode 100644 index f4a97c7..0000000 --- a/docs/epy/oauth2client.appengine.CredentialsProperty-class.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - oauth2client.appengine.CredentialsProperty - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class CredentialsProperty - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class CredentialsProperty

source code

-
-
- - - - - - - -
-
-
-
-App Engine datastore Property for Credentials.
-
-Utility property that allows easy storage and retrieval of
-oath2client.Credentials
-
-
- - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
get_value_for_datastore(self, - model_instance) - source code - -
- -
-   - - - - - - -
make_value_from_datastore(self, - value) - source code - -
- -
-   - - - - - - -
validate(self, - value) - source code - -
- -
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - data_type = Credentials -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.FlowNDBProperty-class.html b/docs/epy/oauth2client.appengine.FlowNDBProperty-class.html deleted file mode 100644 index 6d872b4..0000000 --- a/docs/epy/oauth2client.appengine.FlowNDBProperty-class.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - oauth2client.appengine.FlowNDBProperty - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class FlowNDBProperty - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class FlowNDBProperty

source code

-
-
- - - - -
-
-
-
-App Engine NDB datastore Property for Flow.
-
-Serves the same purpose as the DB FlowProperty, but for NDB models. Since
-PickleProperty inherits from BlobProperty, the underlying representation of
-the data in the datastore will be the same as in the DB case.
-
-Utility property that allows easy storage and retrieval of an
-oauth2client.Flow
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
_validate(self, - value)
- Validates a value as a proper Flow object.
- source code - -
- -
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

_validate(self, - value) -

-
source code  -
- -
-Validates a value as a proper Flow object.
-
-Args:
-  value: A value to be set on the property.
-
-Raises:
-  TypeError if the value is not an instance of Flow.
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.FlowProperty-class.html b/docs/epy/oauth2client.appengine.FlowProperty-class.html deleted file mode 100644 index 2fd558a..0000000 --- a/docs/epy/oauth2client.appengine.FlowProperty-class.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - - oauth2client.appengine.FlowProperty - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class FlowProperty - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class FlowProperty

source code

-
-
- - - - - - - - -
-
-
-
-App Engine datastore Property for Flow.
-
-Utility property that allows easy storage and retrieval of an
-oauth2client.Flow
-
-
- - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
get_value_for_datastore(self, - model_instance) - source code - -
- -
-   - - - - - - -
make_value_from_datastore(self, - value) - source code - -
- -
-   - - - - - - -
validate(self, - value) - source code - -
- -
-   - - - - - - -
empty(self, - value) - source code - -
- -
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - data_type = Flow -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.InvalidClientSecretsError-class.html b/docs/epy/oauth2client.appengine.InvalidClientSecretsError-class.html deleted file mode 100644 index bfc3cb3..0000000 --- a/docs/epy/oauth2client.appengine.InvalidClientSecretsError-class.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - oauth2client.appengine.InvalidClientSecretsError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class InvalidClientSecretsError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class InvalidClientSecretsError

source code

-
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-The client_secrets.json file is malformed or missing required fields.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.InvalidXsrfTokenError-class.html b/docs/epy/oauth2client.appengine.InvalidXsrfTokenError-class.html deleted file mode 100644 index d8f5ca9..0000000 --- a/docs/epy/oauth2client.appengine.InvalidXsrfTokenError-class.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - oauth2client.appengine.InvalidXsrfTokenError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class InvalidXsrfTokenError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class InvalidXsrfTokenError

source code

-
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-The XSRF token is invalid or expired.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.OAuth2Decorator-class.html b/docs/epy/oauth2client.appengine.OAuth2Decorator-class.html deleted file mode 100644 index 9e2ca70..0000000 --- a/docs/epy/oauth2client.appengine.OAuth2Decorator-class.html +++ /dev/null @@ -1,941 +0,0 @@ - - - - - oauth2client.appengine.OAuth2Decorator - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class OAuth2Decorator - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class OAuth2Decorator

source code

-
-
- - - - - - - - - - - - - - - - - - -
-
-
-
-Utility for making OAuth 2.0 easier.
-
-Instantiate and then use with oauth_required or oauth_aware
-as decorators on webapp.RequestHandler methods.
-
-Example:
-
-  decorator = OAuth2Decorator(
-      client_id='837...ent.com',
-      client_secret='Qh...wwI',
-      scope='https://www.googleapis.com/auth/plus')
-
-
-  class MainHandler(webapp.RequestHandler):
-
-    @decorator.oauth_required
-    def get(self):
-      http = decorator.http()
-      # http is authorized with the user's Credentials and can be used
-      # in API calls
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
set_credentials(self, - credentials) - source code - -
- -
-   - - - - - - -
get_credentials(self)
- A thread local Credentials object.
- source code - -
- -
-   - - - - - - -
set_flow(self, - flow) - source code - -
- -
-   - - - - - - -
get_flow(self)
- A thread local Flow object.
- source code - -
- -
-   - - - - - - -
__init__(self, - client_id, - client_secret, - scope, - auth_uri=GOOGLE_AUTH_URI, - token_uri=GOOGLE_TOKEN_URI, - revoke_uri=GOOGLE_REVOKE_URI, - user_agent=None, - message=None, - callback_path='/oauth2callback', - token_response_param=None, - _storage_class=StorageByKeyName, - _credentials_class=CredentialsModel, - _credentials_property_name='credentials', - **kwargs)
- Constructor for OAuth2Decorator
- source code - -
- -
-   - - - - - - -
_display_error_message(self, - request_handler) - source code - -
- -
-   - - - - - - -
oauth_required(self, - method)
- Decorator that starts the OAuth 2.0 dance.
- source code - -
- -
-   - - - - - - -
_create_flow(self, - request_handler)
- Create the Flow object.
- source code - -
- -
-   - - - - - - -
oauth_aware(self, - method)
- Decorator that sets up for OAuth 2.0 dance, but doesn't do it.
- source code - -
- -
-   - - - - - - -
has_credentials(self)
- True if for the logged in user there are valid access Credentials.
- source code - -
- -
-   - - - - - - -
authorize_url(self)
- Returns the URL to start the OAuth dance.
- source code - -
- -
-   - - - - - - -
http(self, - *args, - **kwargs)
- Returns an authorized http instance.
- source code - -
- -
-   - - - - - - -
callback_path(self)
- The absolute path where the callback will occur.
- source code - -
- -
-   - - - - - - -
callback_handler(self)
- RequestHandler for the OAuth 2.0 redirect callback.
- source code - -
- -
-   - - - - - - -
callback_application(self)
- WSGI application for handling the OAuth 2.0 redirect callback.
- source code - -
- -
-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - credentials = property(get_credentials, set_credentials) -
-   - - flow = property(get_flow, set_flow) -
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

get_credentials(self) -

-
source code  -
- -
-A thread local Credentials object.
-
-Returns:
-  A client.Credentials object, or None if credentials hasn't been set in
-  this thread yet, which may happen when calling has_credentials inside
-  oauth_aware.
-
-
-
-
-
-
- -
- -
- - -
-

get_flow(self) -

-
source code  -
- -
-A thread local Flow object.
-
-Returns:
-  A credentials.Flow object, or None if the flow hasn't been set in this
-  thread yet, which happens in _create_flow() since Flows are created
-  lazily.
-
-
-
-
-
-
- -
- -
- - -
-

__init__(self, - client_id, - client_secret, - scope, - auth_uri=GOOGLE_AUTH_URI, - token_uri=GOOGLE_TOKEN_URI, - revoke_uri=GOOGLE_REVOKE_URI, - user_agent=None, - message=None, - callback_path='/oauth2callback', - token_response_param=None, - _storage_class=StorageByKeyName, - _credentials_class=CredentialsModel, - _credentials_property_name='credentials', - **kwargs) -
(Constructor) -

-
source code  -
- -
-Constructor for OAuth2Decorator
-
-Args:
-  client_id: string, client identifier.
-  client_secret: string client secret.
-  scope: string or iterable of strings, scope(s) of the credentials being
-    requested.
-  auth_uri: string, URI for authorization endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  token_uri: string, URI for token endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  revoke_uri: string, URI for revoke endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  user_agent: string, User agent of your application, default to None.
-  message: Message to display if there are problems with the OAuth 2.0
-    configuration. The message may contain HTML and will be presented on the
-    web interface for any method that uses the decorator.
-  callback_path: string, The absolute path to use as the callback URI. Note
-    that this must match up with the URI given when registering the
-    application in the APIs Console.
-  token_response_param: string. If provided, the full JSON response
-    to the access token request will be encoded and included in this query
-    parameter in the callback URI. This is useful with providers (e.g.
-    wordpress.com) that include extra fields that the client may want.
-  _storage_class: "Protected" keyword argument not typically provided to
-    this constructor. A storage class to aid in storing a Credentials object
-    for a user in the datastore. Defaults to StorageByKeyName.
-  _credentials_class: "Protected" keyword argument not typically provided to
-    this constructor. A db or ndb Model class to hold credentials. Defaults
-    to CredentialsModel.
-  _credentials_property_name: "Protected" keyword argument not typically
-    provided to this constructor. A string indicating the name of the field
-    on the _credentials_class where a Credentials object will be stored.
-    Defaults to 'credentials'.
-  **kwargs: dict, Keyword arguments are passed along as kwargs to
-    the OAuth2WebServerFlow constructor.
-
-
-
-
Decorators:
-
    -
  • @util.positional(4)
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

oauth_required(self, - method) -

-
source code  -
- -
-Decorator that starts the OAuth 2.0 dance.
-
-Starts the OAuth dance for the logged in user if they haven't already
-granted access for this application.
-
-Args:
-  method: callable, to be decorated method of a webapp.RequestHandler
-    instance.
-
-
-
-
-
-
- -
- -
- - -
-

_create_flow(self, - request_handler) -

-
source code  -
- -
-Create the Flow object.
-
-The Flow is calculated lazily since we don't know where this app is
-running until it receives a request, at which point redirect_uri can be
-calculated and then the Flow object can be constructed.
-
-Args:
-  request_handler: webapp.RequestHandler, the request handler.
-
-
-
-
-
-
- -
- -
- - -
-

oauth_aware(self, - method) -

-
source code  -
- -
-Decorator that sets up for OAuth 2.0 dance, but doesn't do it.
-
-Does all the setup for the OAuth dance, but doesn't initiate it.
-This decorator is useful if you want to create a page that knows
-whether or not the user has granted access to this application.
-From within a method decorated with @oauth_aware the has_credentials()
-and authorize_url() methods can be called.
-
-Args:
-  method: callable, to be decorated method of a webapp.RequestHandler
-    instance.
-
-
-
-
-
-
- -
- -
- - -
-

has_credentials(self) -

-
source code  -
- -
-True if for the logged in user there are valid access Credentials.
-
-Must only be called from with a webapp.RequestHandler subclassed method
-that had been decorated with either @oauth_required or @oauth_aware.
-
-
-
-
-
-
- -
- -
- - -
-

authorize_url(self) -

-
source code  -
- -
-Returns the URL to start the OAuth dance.
-
-Must only be called from with a webapp.RequestHandler subclassed method
-that had been decorated with either @oauth_required or @oauth_aware.
-
-
-
-
-
-
- -
- -
- - -
-

http(self, - *args, - **kwargs) -

-
source code  -
- -
-Returns an authorized http instance.
-
-Must only be called from within an @oauth_required decorated method, or
-from within an @oauth_aware decorated method where has_credentials()
-returns True.
-
-Args:
-    *args: Positional arguments passed to httplib2.Http constructor.
-    **kwargs: Positional arguments passed to httplib2.Http constructor.
-
-
-
-
-
-
- -
- -
- - -
-

callback_path(self) -

-
source code  -
- -
-The absolute path where the callback will occur.
-
-Note this is the absolute path, not the absolute URI, that will be
-calculated by the decorator at runtime. See callback_handler() for how this
-should be used.
-
-Returns:
-  The callback path as a string.
-
-
-
-
Decorators:
-
    -
  • @property
  • -
-
-
-
- -
- -
- - -
-

callback_handler(self) -

-
source code  -
- -
-RequestHandler for the OAuth 2.0 redirect callback.
-
-Usage:
-   app = webapp.WSGIApplication([
-     ('/index', MyIndexHandler),
-     ...,
-     (decorator.callback_path, decorator.callback_handler())
-   ])
-
-Returns:
-  A webapp.RequestHandler that handles the redirect back from the
-  server during the OAuth 2.0 dance.
-
-
-
-
-
-
- -
- -
- - -
-

callback_application(self) -

-
source code  -
- -
-WSGI application for handling the OAuth 2.0 redirect callback.
-
-If you need finer grained control use `callback_handler` which returns just
-the webapp.RequestHandler.
-
-Returns:
-  A webapp.WSGIApplication that handles the redirect back from the
-  server during the OAuth 2.0 dance.
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.OAuth2DecoratorFromClientSecrets-class.html b/docs/epy/oauth2client.appengine.OAuth2DecoratorFromClientSecrets-class.html deleted file mode 100644 index 33bb2f4..0000000 --- a/docs/epy/oauth2client.appengine.OAuth2DecoratorFromClientSecrets-class.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - oauth2client.appengine.OAuth2DecoratorFromClientSecrets - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class OAuth2DecoratorFromClientSecrets - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class OAuth2DecoratorFromClientSecrets

source code

-
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-An OAuth2Decorator that builds from a clientsecrets file.
-
-Uses a clientsecrets file as the source for all the information when
-constructing an OAuth2Decorator.
-
-Example:
-
-  decorator = OAuth2DecoratorFromClientSecrets(
-    os.path.join(os.path.dirname(__file__), 'client_secrets.json')
-    scope='https://www.googleapis.com/auth/plus')
-
-
-  class MainHandler(webapp.RequestHandler):
-
-    @decorator.oauth_required
-    def get(self):
-      http = decorator.http()
-      # http is authorized with the user's Credentials and can be used
-      # in API calls
-
-
- - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - filename, - scope, - message=None, - cache=None, - **kwargs)
- Constructor
- source code - -
- -
-

Inherited from OAuth2Decorator: - authorize_url, - callback_application, - callback_handler, - callback_path, - get_credentials, - get_flow, - has_credentials, - http, - oauth_aware, - oauth_required, - set_credentials, - set_flow -

-

Inherited from OAuth2Decorator (private): - _create_flow, - _display_error_message -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-

Inherited from OAuth2Decorator: - credentials, - flow -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - filename, - scope, - message=None, - cache=None, - **kwargs) -
(Constructor) -

-
source code  -
- -
-Constructor
-
-Args:
-  filename: string, File name of client secrets.
-  scope: string or iterable of strings, scope(s) of the credentials being
-    requested.
-  message: string, A friendly string to display to the user if the
-    clientsecrets file is missing or invalid. The message may contain HTML
-    and will be presented on the web interface for any method that uses the
-    decorator.
-  cache: An optional cache service client that implements get() and set()
-    methods. See clientsecrets.loadfile() for details.
-  **kwargs: dict, Keyword arguments are passed along as kwargs to
-    the OAuth2WebServerFlow constructor.
-
-
-
-
Decorators:
-
    -
  • @util.positional(3)
  • -
-
Overrides: - object.__init__ -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.SiteXsrfSecretKey-class.html b/docs/epy/oauth2client.appengine.SiteXsrfSecretKey-class.html deleted file mode 100644 index ff552d4..0000000 --- a/docs/epy/oauth2client.appengine.SiteXsrfSecretKey-class.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - oauth2client.appengine.SiteXsrfSecretKey - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class SiteXsrfSecretKey - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class SiteXsrfSecretKey

source code

-
-
- - - - -
-
-
-
-Storage for the sites XSRF secret key.
-
-There will only be one instance stored of this model, the one used for the
-site.
-
-
- - - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - secret = db.StringProperty() -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.SiteXsrfSecretKeyNDB-class.html b/docs/epy/oauth2client.appengine.SiteXsrfSecretKeyNDB-class.html deleted file mode 100644 index 85ecc82..0000000 --- a/docs/epy/oauth2client.appengine.SiteXsrfSecretKeyNDB-class.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - oauth2client.appengine.SiteXsrfSecretKeyNDB - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class SiteXsrfSecretKeyNDB - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class SiteXsrfSecretKeyNDB

source code

-
-
- - - - - -
-
-
-
-NDB Model for storage for the sites XSRF secret key.
-
-Since this model uses the same kind as SiteXsrfSecretKey, it can be used
-interchangeably. This simply provides an NDB model for interacting with the
-same data the DB model interacts with.
-
-There should only be one instance stored of this model, the one used for the
-site.
-
-
- - - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-   - - - - - - -
_get_kind(cls)
- Return the kind name for this class.
- source code - -
- -
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - secret = ndb.StringProperty() -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.appengine.StorageByKeyName-class.html b/docs/epy/oauth2client.appengine.StorageByKeyName-class.html deleted file mode 100644 index 5430dc2..0000000 --- a/docs/epy/oauth2client.appengine.StorageByKeyName-class.html +++ /dev/null @@ -1,562 +0,0 @@ - - - - - oauth2client.appengine.StorageByKeyName - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module appengine :: - Class StorageByKeyName - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class StorageByKeyName

source code

-
-
- - - - - - - - - - - - - -
-
-
-
-Store and retrieve a credential to and from the App Engine datastore.
-
-This Storage helper presumes the Credentials have been stored as a
-CredentialsProperty or CredentialsNDBProperty on a datastore model class, and
-that entities are stored by key_name.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - model, - key_name, - property_name, - cache=None, - user=None)
- Constructor for Storage.
- source code - -
- -
-   - - - - - - -
_is_ndb(self)
- Determine whether the model of the instance is an NDB model.
- source code - -
- -
-   - - - - - - -
_get_entity(self)
- Retrieve entity from datastore.
- source code - -
- -
-   - - - - - - -
_delete_entity(self)
- Delete entity from datastore.
- source code - -
- -
-   - - - - - - -
locked_get(self)
- Retrieve Credential from datastore.
- source code - -
- -
-   - - - - - - -
locked_put(self, - credentials)
- Write a Credentials to the datastore.
- source code - -
- -
-   - - - - - - -
locked_delete(self)
- Delete Credential from datastore.
- source code - -
- -
-

Inherited from client.Storage: - acquire_lock, - delete, - get, - put, - release_lock -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - model, - key_name, - property_name, - cache=None, - user=None) -
(Constructor) -

-
source code  -
- -
-Constructor for Storage.
-
-Args:
-  model: db.Model or ndb.Model, model class
-  key_name: string, key name for the entity that has the credentials
-  property_name: string, name of the property that is a CredentialsProperty
-    or CredentialsNDBProperty.
-  cache: memcache, a write-through cache to put in front of the datastore.
-    If the model you are using is an NDB model, using a cache will be
-    redundant since the model uses an instance cache and memcache for you.
-  user: users.User object, optional. Can be used to grab user ID as a
-    key_name if no key name is specified.
-
-
-
-
Decorators:
-
    -
  • @util.positional(4)
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

_is_ndb(self) -

-
source code  -
- -
-Determine whether the model of the instance is an NDB model.
-
-Returns:
-  Boolean indicating whether or not the model is an NDB or DB model.
-
-
-
-
-
-
- -
- -
- - -
-

_get_entity(self) -

-
source code  -
- -
-Retrieve entity from datastore.
-
-Uses a different model method for db or ndb models.
-
-Returns:
-  Instance of the model corresponding to the current storage object
-      and stored using the key name of the storage object.
-
-
-
-
-
-
- -
- -
- - -
-

_delete_entity(self) -

-
source code  -
- -
-Delete entity from datastore.
-
-Attempts to delete using the key_name stored on the object, whether or not
-the given key is in the datastore.
-
-
-
-
-
-
- -
- -
- - -
-

locked_get(self) -

-
source code  -
- -
-Retrieve Credential from datastore.
-
-Returns:
-  oauth2client.Credentials
-
-
-
-
Decorators:
-
    -
  • @db.non_transactional(allow_existing= True)
  • -
-
Overrides: - client.Storage.locked_get -
-
-
-
- -
- -
- - -
-

locked_put(self, - credentials) -

-
source code  -
- -
-Write a Credentials to the datastore.
-
-Args:
-  credentials: Credentials, the credentials to store.
-
-
-
-
Decorators:
-
    -
  • @db.non_transactional(allow_existing= True)
  • -
-
Overrides: - client.Storage.locked_put -
-
-
-
- -
- -
- - -
-

locked_delete(self) -

-
source code  -
- -
-Delete Credential from datastore.
-
-
-
-
Decorators:
-
    -
  • @db.non_transactional(allow_existing= True)
  • -
-
Overrides: - client.Storage.locked_delete -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client-module.html b/docs/epy/oauth2client.client-module.html deleted file mode 100644 index d13270f..0000000 --- a/docs/epy/oauth2client.client-module.html +++ /dev/null @@ -1,1347 +0,0 @@ - - - - - oauth2client.client - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module client

source code

-
-An OAuth 2.0 client.
-
-Tools for interacting with OAuth 2.0 protected resources.
-
-
- -
-

Author: - jcgregorio@google.com (Joe Gregorio) -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - Error
- Base error for this module. -
-   - - FlowExchangeError
- Error trying to exchange an authorization grant for an access token. -
-   - - AccessTokenRefreshError
- Error trying to refresh an expired access token. -
-   - - TokenRevokeError
- Error trying to revoke a token. -
-   - - UnknownClientSecretsFlowError
- The client secrets file called for an unknown type of OAuth 2.0 flow. -
-   - - AccessTokenCredentialsError
- Having only the access_token means no refresh is possible. -
-   - - VerifyJwtTokenError
- Could not retrieve certificates for validation. -
-   - - NonAsciiHeaderError
- Header names and values must be ASCII strings. -
-   - - ApplicationDefaultCredentialsError
- Error retrieving the Application Default Credentials. -
-   - - OAuth2DeviceCodeError
- Error trying to retrieve a device code. -
-   - - CryptoUnavailableError
- Raised when a crypto library is required, but none is available. -
-   - - MemoryCache
- httplib2 Cache implementation which only caches locally. -
-   - - Credentials
- Base class for all Credentials objects. -
-   - - Flow
- Base class for all Flow objects. -
-   - - Storage
- Base class for all Storage objects. -
-   - - OAuth2Credentials
- Credentials object for OAuth 2.0. -
-   - - AccessTokenCredentials
- Credentials object for OAuth 2.0. -
-   - - GoogleCredentials
- Application Default Credentials for use in calling Google APIs. -
-   - - AssertionCredentials
- Abstract Credentials object used for OAuth 2.0 assertion grants. -
-   - - SignedJwtAssertionCredentials
- Credentials object used for OAuth 2.0 Signed JWT assertion grants. -
-   - - DeviceFlowInfo
- Intermediate information the OAuth2 for devices flow. -
-   - - OAuth2WebServerFlow
- Does the Web Server Flow for OAuth 2.0. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Functions[hide private]
-
-   - - - - - - -
_abstract() - source code - -
- -
-   - - - - - - -
clean_headers(headers)
- Forces header keys and values to be strings, i.e not unicode.
- source code - -
- -
-   - - - - - - -
_update_query_params(uri, - params)
- Updates a URI with new query parameters.
- source code - -
- -
-   - - - - - - -
_get_environment(urlopen=None)
- Detect the environment the code is being run on.
- source code - -
- -
-   - - - - - - -
save_to_well_known_file(credentials, - well_known_file=None)
- Save the provided GoogleCredentials to the well known file.
- source code - -
- -
-   - - - - - - -
_get_environment_variable_file() - source code - -
- -
-   - - - - - - -
_get_well_known_file()
- Get the well known file produced by command 'gcloud auth login'.
- source code - -
- -
-   - - - - - - -
_get_application_default_credential_from_file(application_default_credential_filename)
- Build the Application Default Credentials from file.
- source code - -
- -
-   - - - - - - -
_raise_exception_for_missing_fields(missing_fields) - source code - -
- -
-   - - - - - - -
_raise_exception_for_reading_json(credential_file, - extra_help, - error) - source code - -
- -
-   - - - - - - -
_get_application_default_credential_GAE() - source code - -
- -
-   - - - - - - -
_get_application_default_credential_GCE() - source code - -
- -
-   - - - - - - -
_RequireCryptoOrDie()
- Ensure we have a crypto library, or throw CryptoUnavailableError.
- source code - -
- -
-   - - - - - - -
verify_id_token(id_token, - audience, - http=None, - cert_uri=ID_TOKEN_VERIFICATION_CERTS)
- Verifies a signed JWT id_token.
- source code - -
- -
-   - - - - - - -
_urlsafe_b64decode(b64string) - source code - -
- -
-   - - - - - - -
_extract_id_token(id_token)
- Extract the JSON payload from a JWT.
- source code - -
- -
-   - - - - - - -
_parse_exchange_token_response(content)
- Parses response of an exchange token request.
- source code - -
- -
-   - - - - - - -
credentials_from_code(client_id, - client_secret, - scope, - code, - redirect_uri='postmessage', - http=None, - user_agent=None, - token_uri=GOOGLE_TOKEN_URI, - auth_uri=GOOGLE_AUTH_URI, - revoke_uri=GOOGLE_REVOKE_URI, - device_uri=GOOGLE_DEVICE_URI)
- Exchanges an authorization code for an OAuth2Credentials object.
- source code - -
- -
-   - - - - - - -
credentials_from_clientsecrets_and_code(filename, - scope, - code, - message=None, - redirect_uri='postmessage', - http=None, - cache=None, - device_uri=None)
- Returns OAuth2Credentials from a clientsecrets file and an auth code.
- source code - -
- -
-   - - - - - - -
flow_from_clientsecrets(filename, - scope, - redirect_uri=None, - message=None, - cache=None, - login_hint=None, - device_uri=None)
- Create a Flow from a clientsecrets file.
- source code - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - HAS_CRYPTO = True -
-   - - HAS_OPENSSL = True -
-   - - logger = logging.getLogger(__name__) -
-   - - EXPIRY_FORMAT = '%Y-%m-%dT%H:%M:%SZ' -
-   - - ID_TOKEN_VERIFICATION_CERTS = 'https://www.googleapis.com/oaut... -
-   - - ID_TOKEN_VERIFICATON_CERTS = 'https://www.googleapis.com/oauth... -
-   - - OOB_CALLBACK_URN = 'urn:ietf:wg:oauth:2.0:oob' -
-   - - REFRESH_STATUS_CODES = [401] -
-   - - AUTHORIZED_USER = 'authorized_user' -
-   - - SERVICE_ACCOUNT = 'service_account' -
-   - - GOOGLE_APPLICATION_CREDENTIALS = 'GOOGLE_APPLICATION_CREDENTIALS' -
-   - - ADC_HELP_MSG = 'The Application Default Credentials are not av... -
-   - - AccessTokenInfo = collections.namedtuple('AccessTokenInfo', ['... -
-   - - _env_name = None -
-   - - _cached_http = httplib2.Http(MemoryCache()) -
- - - - - - -
- - - - - -
Function Details[hide private]
-
- -
- -
- - -
-

clean_headers(headers) -

-
source code  -
- -
-Forces header keys and values to be strings, i.e not unicode.
-
-The httplib module just concats the header keys and values in a way that may
-make the message header a unicode string, which, if it then tries to
-contatenate to a binary request body may result in a unicode decode error.
-
-Args:
-  headers: dict, A dictionary of headers.
-
-Returns:
-  The same dictionary but with all the keys converted to strings.
-
-
-
-
-
-
- -
- -
- - -
-

_update_query_params(uri, - params) -

-
source code  -
- -
-Updates a URI with new query parameters.
-
-Args:
-  uri: string, A valid URI, with potential existing query parameters.
-  params: dict, A dictionary of query parameters.
-
-Returns:
-  The same URI but with the new query parameters added.
-
-
-
-
-
-
- -
- -
- - -
-

save_to_well_known_file(credentials, - well_known_file=None) -

-
source code  -
- -
-Save the provided GoogleCredentials to the well known file.
-
-Args:
-  credentials:
-    the credentials to be saved to the well known file;
-    it should be an instance of GoogleCredentials
-  well_known_file:
-    the name of the file where the credentials are to be saved;
-    this parameter is supposed to be used for testing only
-
-
-
-
-
-
- -
- -
- - -
-

_RequireCryptoOrDie() -

-
source code  -
- -
-Ensure we have a crypto library, or throw CryptoUnavailableError.
-
-The oauth2client.crypt module requires either PyCrypto or PyOpenSSL
-to be available in order to function, but these are optional
-dependencies.
-
-
-
-
-
-
- -
- -
- - -
-

verify_id_token(id_token, - audience, - http=None, - cert_uri=ID_TOKEN_VERIFICATION_CERTS) -

-
source code  -
- -
-Verifies a signed JWT id_token.
-
-This function requires PyOpenSSL and because of that it does not work on
-App Engine.
-
-Args:
-  id_token: string, A Signed JWT.
-  audience: string, The audience 'aud' that the token should be for.
-  http: httplib2.Http, instance to use to make the HTTP request. Callers
-    should supply an instance that has caching enabled.
-  cert_uri: string, URI of the certificates in JSON format to
-    verify the JWT against.
-
-Returns:
-  The deserialized JSON in the JWT.
-
-Raises:
-  oauth2client.crypt.AppIdentityError: if the JWT fails to verify.
-  CryptoUnavailableError: if no crypto library is available.
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
-
-
- -
- -
- - -
-

_extract_id_token(id_token) -

-
source code  -
- -
-Extract the JSON payload from a JWT.
-
-Does the extraction w/o checking the signature.
-
-Args:
-  id_token: string, OAuth 2.0 id_token.
-
-Returns:
-  object, The deserialized JSON payload.
-
-
-
-
-
-
- -
- -
- - -
-

_parse_exchange_token_response(content) -

-
source code  -
- -
-Parses response of an exchange token request.
-
-Most providers return JSON but some (e.g. Facebook) return a
-url-encoded string.
-
-Args:
-  content: The body of a response
-
-Returns:
-  Content as a dictionary object. Note that the dict could be empty,
-  i.e. {}. That basically indicates a failure.
-
-
-
-
-
-
- -
- -
- - -
-

credentials_from_code(client_id, - client_secret, - scope, - code, - redirect_uri='postmessage', - http=None, - user_agent=None, - token_uri=GOOGLE_TOKEN_URI, - auth_uri=GOOGLE_AUTH_URI, - revoke_uri=GOOGLE_REVOKE_URI, - device_uri=GOOGLE_DEVICE_URI) -

-
source code  -
- -
-Exchanges an authorization code for an OAuth2Credentials object.
-
-Args:
-  client_id: string, client identifier.
-  client_secret: string, client secret.
-  scope: string or iterable of strings, scope(s) to request.
-  code: string, An authroization code, most likely passed down from
-    the client
-  redirect_uri: string, this is generally set to 'postmessage' to match the
-    redirect_uri that the client specified
-  http: httplib2.Http, optional http instance to use to do the fetch
-  token_uri: string, URI for token endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  auth_uri: string, URI for authorization endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  revoke_uri: string, URI for revoke endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  device_uri: string, URI for device authorization endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-
-Returns:
-  An OAuth2Credentials object.
-
-Raises:
-  FlowExchangeError if the authorization code cannot be exchanged for an
-   access token
-
-
-
-
Decorators:
-
    -
  • @util.positional(4)
  • -
-
-
-
- -
- -
- - -
-

credentials_from_clientsecrets_and_code(filename, - scope, - code, - message=None, - redirect_uri='postmessage', - http=None, - cache=None, - device_uri=None) -

-
source code  -
- -
-Returns OAuth2Credentials from a clientsecrets file and an auth code.
-
-Will create the right kind of Flow based on the contents of the clientsecrets
-file or will raise InvalidClientSecretsError for unknown types of Flows.
-
-Args:
-  filename: string, File name of clientsecrets.
-  scope: string or iterable of strings, scope(s) to request.
-  code: string, An authorization code, most likely passed down from
-    the client
-  message: string, A friendly string to display to the user if the
-    clientsecrets file is missing or invalid. If message is provided then
-    sys.exit will be called in the case of an error. If message in not
-    provided then clientsecrets.InvalidClientSecretsError will be raised.
-  redirect_uri: string, this is generally set to 'postmessage' to match the
-    redirect_uri that the client specified
-  http: httplib2.Http, optional http instance to use to do the fetch
-  cache: An optional cache service client that implements get() and set()
-    methods. See clientsecrets.loadfile() for details.
-  device_uri: string, OAuth 2.0 device authorization endpoint
-
-Returns:
-  An OAuth2Credentials object.
-
-Raises:
-  FlowExchangeError if the authorization code cannot be exchanged for an
-   access token
-  UnknownClientSecretsFlowError if the file describes an unknown kind of Flow.
-  clientsecrets.InvalidClientSecretsError if the clientsecrets file is
-    invalid.
-
-
-
-
Decorators:
-
    -
  • @util.positional(3)
  • -
-
-
-
- -
- -
- - -
-

flow_from_clientsecrets(filename, - scope, - redirect_uri=None, - message=None, - cache=None, - login_hint=None, - device_uri=None) -

-
source code  -
- -
-Create a Flow from a clientsecrets file.
-
-Will create the right kind of Flow based on the contents of the clientsecrets
-file or will raise InvalidClientSecretsError for unknown types of Flows.
-
-Args:
-  filename: string, File name of client secrets.
-  scope: string or iterable of strings, scope(s) to request.
-  redirect_uri: string, Either the string 'urn:ietf:wg:oauth:2.0:oob' for
-    a non-web-based application, or a URI that handles the callback from
-    the authorization server.
-  message: string, A friendly string to display to the user if the
-    clientsecrets file is missing or invalid. If message is provided then
-    sys.exit will be called in the case of an error. If message in not
-    provided then clientsecrets.InvalidClientSecretsError will be raised.
-  cache: An optional cache service client that implements get() and set()
-    methods. See clientsecrets.loadfile() for details.
-  login_hint: string, Either an email address or domain. Passing this hint
-    will either pre-fill the email box on the sign-in form or select the
-    proper multi-login session, thereby simplifying the login flow.
-  device_uri: string, URI for device authorization endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-
-Returns:
-  A Flow object.
-
-Raises:
-  UnknownClientSecretsFlowError if the file describes an unknown kind of Flow.
-  clientsecrets.InvalidClientSecretsError if the clientsecrets file is
-    invalid.
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
-
-
-
- - - - - - -
- - - - - -
Variables Details[hide private]
-
- -
- -
-

ID_TOKEN_VERIFICATION_CERTS

- -
-
-
-
Value:
-
-'https://www.googleapis.com/oauth2/v1/certs'
-
-
-
-
-
- -
- -
-

ID_TOKEN_VERIFICATON_CERTS

- -
-
-
-
Value:
-
-'https://www.googleapis.com/oauth2/v1/certs'
-
-
-
-
-
- -
- -
-

ADC_HELP_MSG

- -
-
-
-
Value:
-
-'The Application Default Credentials are not available. They are avail\
-able ' 'if running in Google Compute Engine. Otherwise, the environmen\
-t variable '+ GOOGLE_APPLICATION_CREDENTIALS+ ' must be defined pointi\
-ng to a file defining the credentials. See ' 'https://developers.googl\
-e.com/accounts/docs/application-default-credentials' ' for more inform\
-ation.'
-
-
-
-
-
- -
- -
-

AccessTokenInfo

- -
-
-
-
Value:
-
-collections.namedtuple('AccessTokenInfo', ['access_token', 'expires_in\
-'])
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client-pysrc.html b/docs/epy/oauth2client.client-pysrc.html deleted file mode 100644 index 5cdb39d..0000000 --- a/docs/epy/oauth2client.client-pysrc.html +++ /dev/null @@ -1,2332 +0,0 @@ - - - - - oauth2client.client - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.client

-
-   1  # Copyright 2014 Google Inc. All rights reserved. 
-   2  # 
-   3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-   4  # you may not use this file except in compliance with the License. 
-   5  # You may obtain a copy of the License at 
-   6  # 
-   7  #      http://www.apache.org/licenses/LICENSE-2.0 
-   8  # 
-   9  # Unless required by applicable law or agreed to in writing, software 
-  10  # distributed under the License is distributed on an "AS IS" BASIS, 
-  11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-  12  # See the License for the specific language governing permissions and 
-  13  # limitations under the License. 
-  14   
-  15  """An OAuth 2.0 client. 
-  16   
-  17  Tools for interacting with OAuth 2.0 protected resources. 
-  18  """ 
-  19   
-  20  __author__ = 'jcgregorio@google.com (Joe Gregorio)' 
-  21   
-  22  import base64 
-  23  import collections 
-  24  import copy 
-  25  import datetime 
-  26  import json 
-  27  import logging 
-  28  import os 
-  29  import sys 
-  30  import time 
-  31  import six 
-  32  from six.moves import urllib 
-  33   
-  34  import httplib2 
-  35  from oauth2client import clientsecrets 
-  36  from oauth2client import GOOGLE_AUTH_URI 
-  37  from oauth2client import GOOGLE_DEVICE_URI 
-  38  from oauth2client import GOOGLE_REVOKE_URI 
-  39  from oauth2client import GOOGLE_TOKEN_URI 
-  40  from oauth2client import util 
-  41   
-  42  HAS_OPENSSL = False 
-  43  HAS_CRYPTO = False 
-  44  try: 
-  45    from oauth2client import crypt 
-  46    HAS_CRYPTO = True 
-  47    if crypt.OpenSSLVerifier is not None: 
-  48      HAS_OPENSSL = True 
-  49  except ImportError: 
-  50    pass 
-  51   
-  52  logger = logging.getLogger(__name__) 
-  53   
-  54  # Expiry is stored in RFC3339 UTC format 
-  55  EXPIRY_FORMAT = '%Y-%m-%dT%H:%M:%SZ' 
-  56   
-  57  # Which certs to use to validate id_tokens received. 
-  58  ID_TOKEN_VERIFICATION_CERTS = 'https://www.googleapis.com/oauth2/v1/certs' 
-  59  # This symbol previously had a typo in the name; we keep the old name 
-  60  # around for now, but will remove it in the future. 
-  61  ID_TOKEN_VERIFICATON_CERTS = ID_TOKEN_VERIFICATION_CERTS 
-  62   
-  63  # Constant to use for the out of band OAuth 2.0 flow. 
-  64  OOB_CALLBACK_URN = 'urn:ietf:wg:oauth:2.0:oob' 
-  65   
-  66  # Google Data client libraries may need to set this to [401, 403]. 
-  67  REFRESH_STATUS_CODES = [401] 
-  68   
-  69  # The value representing user credentials. 
-  70  AUTHORIZED_USER = 'authorized_user' 
-  71   
-  72  # The value representing service account credentials. 
-  73  SERVICE_ACCOUNT = 'service_account' 
-  74   
-  75  # The environment variable pointing the file with local 
-  76  # Application Default Credentials. 
-  77  GOOGLE_APPLICATION_CREDENTIALS = 'GOOGLE_APPLICATION_CREDENTIALS' 
-  78   
-  79  # The error message we show users when we can't find the Application 
-  80  # Default Credentials. 
-  81  ADC_HELP_MSG = ( 
-  82      'The Application Default Credentials are not available. They are available ' 
-  83      'if running in Google Compute Engine. Otherwise, the environment variable ' 
-  84      + GOOGLE_APPLICATION_CREDENTIALS + 
-  85      ' must be defined pointing to a file defining the credentials. See ' 
-  86      'https://developers.google.com/accounts/docs/application-default-credentials'  # pylint:disable=line-too-long 
-  87      ' for more information.') 
-  88   
-  89  # The access token along with the seconds in which it expires. 
-  90  AccessTokenInfo = collections.namedtuple( 
-  91      'AccessTokenInfo', ['access_token', 'expires_in']) 
-
92 - 93 - 94 -class Error(Exception): -
95 """Base error for this module.""" -
96 -
97 - 98 -class FlowExchangeError(Error): -
99 """Error trying to exchange an authorization grant for an access token.""" -
100 -
101 - 102 -class AccessTokenRefreshError(Error): -
103 """Error trying to refresh an expired access token.""" -
104 -
105 - 106 -class TokenRevokeError(Error): -
107 """Error trying to revoke a token.""" -
108 -
109 - 110 -class UnknownClientSecretsFlowError(Error): -
111 """The client secrets file called for an unknown type of OAuth 2.0 flow. """ -
112 -
113 - 114 -class AccessTokenCredentialsError(Error): -
115 """Having only the access_token means no refresh is possible.""" -
116 -
117 - 118 -class VerifyJwtTokenError(Error): -
119 """Could not retrieve certificates for validation.""" -
120 -
121 - 122 -class NonAsciiHeaderError(Error): -
123 """Header names and values must be ASCII strings.""" -
124 -
125 - 126 -class ApplicationDefaultCredentialsError(Error): -
127 """Error retrieving the Application Default Credentials.""" -
128 -
129 - 130 -class OAuth2DeviceCodeError(Error): -
131 """Error trying to retrieve a device code.""" -
132 -
133 - 134 -class CryptoUnavailableError(Error, NotImplementedError): -
135 """Raised when a crypto library is required, but none is available.""" -
136 -
137 - 138 -def _abstract(): -
139 raise NotImplementedError('You need to override this function') -
140 -
141 - 142 -class MemoryCache(object): -
143 """httplib2 Cache implementation which only caches locally.""" - 144 -
145 - def __init__(self): -
146 self.cache = {} -
147 -
148 - def get(self, key): -
149 return self.cache.get(key) -
150 -
151 - def set(self, key, value): -
152 self.cache[key] = value -
153 -
154 - def delete(self, key): -
155 self.cache.pop(key, None) -
156 -
157 - 158 -class Credentials(object): -
159 """Base class for all Credentials objects. - 160 - 161 Subclasses must define an authorize() method that applies the credentials to - 162 an HTTP transport. - 163 - 164 Subclasses must also specify a classmethod named 'from_json' that takes a JSON - 165 string as input and returns an instantiated Credentials object. - 166 """ - 167 - 168 NON_SERIALIZED_MEMBERS = ['store'] - 169 - 170 -
171 - def authorize(self, http): -
172 """Take an httplib2.Http instance (or equivalent) and authorizes it. - 173 - 174 Authorizes it for the set of credentials, usually by replacing - 175 http.request() with a method that adds in the appropriate headers and then - 176 delegates to the original Http.request() method. - 177 - 178 Args: - 179 http: httplib2.Http, an http object to be used to make the refresh - 180 request. - 181 """ - 182 _abstract() -
183 - 184 -
185 - def refresh(self, http): -
186 """Forces a refresh of the access_token. - 187 - 188 Args: - 189 http: httplib2.Http, an http object to be used to make the refresh - 190 request. - 191 """ - 192 _abstract() -
193 - 194 -
195 - def revoke(self, http): -
196 """Revokes a refresh_token and makes the credentials void. - 197 - 198 Args: - 199 http: httplib2.Http, an http object to be used to make the revoke - 200 request. - 201 """ - 202 _abstract() -
203 - 204 -
205 - def apply(self, headers): -
206 """Add the authorization to the headers. - 207 - 208 Args: - 209 headers: dict, the headers to add the Authorization header to. - 210 """ - 211 _abstract() -
212 -
213 - def _to_json(self, strip): -
214 """Utility function that creates JSON repr. of a Credentials object. - 215 - 216 Args: - 217 strip: array, An array of names of members to not include in the JSON. - 218 - 219 Returns: - 220 string, a JSON representation of this instance, suitable to pass to - 221 from_json(). - 222 """ - 223 t = type(self) - 224 d = copy.copy(self.__dict__) - 225 for member in strip: - 226 if member in d: - 227 del d[member] - 228 if (d.get('token_expiry') and - 229 isinstance(d['token_expiry'], datetime.datetime)): - 230 d['token_expiry'] = d['token_expiry'].strftime(EXPIRY_FORMAT) - 231 # Add in information we will need later to reconsistitue this instance. - 232 d['_class'] = t.__name__ - 233 d['_module'] = t.__module__ - 234 for key, val in d.items(): - 235 if isinstance(val, bytes): - 236 d[key] = val.decode('utf-8') - 237 return json.dumps(d) -
238 -
239 - def to_json(self): -
240 """Creating a JSON representation of an instance of Credentials. - 241 - 242 Returns: - 243 string, a JSON representation of this instance, suitable to pass to - 244 from_json(). - 245 """ - 246 return self._to_json(Credentials.NON_SERIALIZED_MEMBERS) -
247 - 248 @classmethod -
249 - def new_from_json(cls, s): -
250 """Utility class method to instantiate a Credentials subclass from a JSON - 251 representation produced by to_json(). - 252 - 253 Args: - 254 s: string, JSON from to_json(). - 255 - 256 Returns: - 257 An instance of the subclass of Credentials that was serialized with - 258 to_json(). - 259 """ - 260 if six.PY3 and isinstance(s, bytes): - 261 s = s.decode('utf-8') - 262 data = json.loads(s) - 263 # Find and call the right classmethod from_json() to restore the object. - 264 module = data['_module'] - 265 try: - 266 m = __import__(module) - 267 except ImportError: - 268 # In case there's an object from the old package structure, update it - 269 module = module.replace('.googleapiclient', '') - 270 m = __import__(module) - 271 - 272 m = __import__(module, fromlist=module.split('.')[:-1]) - 273 kls = getattr(m, data['_class']) - 274 from_json = getattr(kls, 'from_json') - 275 return from_json(s) -
276 - 277 @classmethod -
278 - def from_json(cls, unused_data): -
279 """Instantiate a Credentials object from a JSON description of it. - 280 - 281 The JSON should have been produced by calling .to_json() on the object. - 282 - 283 Args: - 284 unused_data: dict, A deserialized JSON object. - 285 - 286 Returns: - 287 An instance of a Credentials subclass. - 288 """ - 289 return Credentials() -
290 -
291 - 292 -class Flow(object): -
293 """Base class for all Flow objects.""" - 294 pass -
295 -
296 - 297 -class Storage(object): -
298 """Base class for all Storage objects. - 299 - 300 Store and retrieve a single credential. This class supports locking - 301 such that multiple processes and threads can operate on a single - 302 store. - 303 """ - 304 -
305 - def acquire_lock(self): -
306 """Acquires any lock necessary to access this Storage. - 307 - 308 This lock is not reentrant. - 309 """ - 310 pass -
311 -
312 - def release_lock(self): -
313 """Release the Storage lock. - 314 - 315 Trying to release a lock that isn't held will result in a - 316 RuntimeError. - 317 """ - 318 pass -
319 -
320 - def locked_get(self): -
321 """Retrieve credential. - 322 - 323 The Storage lock must be held when this is called. - 324 - 325 Returns: - 326 oauth2client.client.Credentials - 327 """ - 328 _abstract() -
329 -
330 - def locked_put(self, credentials): -
331 """Write a credential. - 332 - 333 The Storage lock must be held when this is called. - 334 - 335 Args: - 336 credentials: Credentials, the credentials to store. - 337 """ - 338 _abstract() -
339 -
340 - def locked_delete(self): -
341 """Delete a credential. - 342 - 343 The Storage lock must be held when this is called. - 344 """ - 345 _abstract() -
346 -
347 - def get(self): -
348 """Retrieve credential. - 349 - 350 The Storage lock must *not* be held when this is called. - 351 - 352 Returns: - 353 oauth2client.client.Credentials - 354 """ - 355 self.acquire_lock() - 356 try: - 357 return self.locked_get() - 358 finally: - 359 self.release_lock() -
360 -
361 - def put(self, credentials): -
362 """Write a credential. - 363 - 364 The Storage lock must be held when this is called. - 365 - 366 Args: - 367 credentials: Credentials, the credentials to store. - 368 """ - 369 self.acquire_lock() - 370 try: - 371 self.locked_put(credentials) - 372 finally: - 373 self.release_lock() -
374 -
375 - def delete(self): -
376 """Delete credential. - 377 - 378 Frees any resources associated with storing the credential. - 379 The Storage lock must *not* be held when this is called. - 380 - 381 Returns: - 382 None - 383 """ - 384 self.acquire_lock() - 385 try: - 386 return self.locked_delete() - 387 finally: - 388 self.release_lock() -
389 -
390 - 391 -def clean_headers(headers): -
392 """Forces header keys and values to be strings, i.e not unicode. - 393 - 394 The httplib module just concats the header keys and values in a way that may - 395 make the message header a unicode string, which, if it then tries to - 396 contatenate to a binary request body may result in a unicode decode error. - 397 - 398 Args: - 399 headers: dict, A dictionary of headers. - 400 - 401 Returns: - 402 The same dictionary but with all the keys converted to strings. - 403 """ - 404 clean = {} - 405 try: - 406 for k, v in six.iteritems(headers): - 407 clean[str(k)] = str(v) - 408 except UnicodeEncodeError: - 409 raise NonAsciiHeaderError(k + ': ' + v) - 410 return clean -
411 -
412 - 413 -def _update_query_params(uri, params): -
414 """Updates a URI with new query parameters. - 415 - 416 Args: - 417 uri: string, A valid URI, with potential existing query parameters. - 418 params: dict, A dictionary of query parameters. - 419 - 420 Returns: - 421 The same URI but with the new query parameters added. - 422 """ - 423 parts = urllib.parse.urlparse(uri) - 424 query_params = dict(urllib.parse.parse_qsl(parts.query)) - 425 query_params.update(params) - 426 new_parts = parts._replace(query=urllib.parse.urlencode(query_params)) - 427 return urllib.parse.urlunparse(new_parts) -
428 -
429 - 430 -class OAuth2Credentials(Credentials): -
431 """Credentials object for OAuth 2.0. - 432 - 433 Credentials can be applied to an httplib2.Http object using the authorize() - 434 method, which then adds the OAuth 2.0 access token to each request. - 435 - 436 OAuth2Credentials objects may be safely pickled and unpickled. - 437 """ - 438 - 439 @util.positional(8) -
440 - def __init__(self, access_token, client_id, client_secret, refresh_token, - 441 token_expiry, token_uri, user_agent, revoke_uri=None, - 442 id_token=None, token_response=None): -
443 """Create an instance of OAuth2Credentials. - 444 - 445 This constructor is not usually called by the user, instead - 446 OAuth2Credentials objects are instantiated by the OAuth2WebServerFlow. - 447 - 448 Args: - 449 access_token: string, access token. - 450 client_id: string, client identifier. - 451 client_secret: string, client secret. - 452 refresh_token: string, refresh token. - 453 token_expiry: datetime, when the access_token expires. - 454 token_uri: string, URI of token endpoint. - 455 user_agent: string, The HTTP User-Agent to provide for this application. - 456 revoke_uri: string, URI for revoke endpoint. Defaults to None; a token - 457 can't be revoked if this is None. - 458 id_token: object, The identity of the resource owner. - 459 token_response: dict, the decoded response to the token request. None - 460 if a token hasn't been requested yet. Stored because some providers - 461 (e.g. wordpress.com) include extra fields that clients may want. - 462 - 463 Notes: - 464 store: callable, A callable that when passed a Credential - 465 will store the credential back to where it came from. - 466 This is needed to store the latest access_token if it - 467 has expired and been refreshed. - 468 """ - 469 self.access_token = access_token - 470 self.client_id = client_id - 471 self.client_secret = client_secret - 472 self.refresh_token = refresh_token - 473 self.store = None - 474 self.token_expiry = token_expiry - 475 self.token_uri = token_uri - 476 self.user_agent = user_agent - 477 self.revoke_uri = revoke_uri - 478 self.id_token = id_token - 479 self.token_response = token_response - 480 - 481 # True if the credentials have been revoked or expired and can't be - 482 # refreshed. - 483 self.invalid = False -
484 -
485 - def authorize(self, http): -
486 """Authorize an httplib2.Http instance with these credentials. - 487 - 488 The modified http.request method will add authentication headers to each - 489 request and will refresh access_tokens when a 401 is received on a - 490 request. In addition the http.request method has a credentials property, - 491 http.request.credentials, which is the Credentials object that authorized - 492 it. - 493 - 494 Args: - 495 http: An instance of httplib2.Http - 496 or something that acts like it. - 497 - 498 Returns: - 499 A modified instance of http that was passed in. - 500 - 501 Example: - 502 - 503 h = httplib2.Http() - 504 h = credentials.authorize(h) - 505 - 506 You can't create a new OAuth subclass of httplib2.Authentication - 507 because it never gets passed the absolute URI, which is needed for - 508 signing. So instead we have to overload 'request' with a closure - 509 that adds in the Authorization header and then calls the original - 510 version of 'request()'. - 511 """ - 512 request_orig = http.request - 513 - 514 # The closure that will replace 'httplib2.Http.request'. - 515 @util.positional(1) - 516 def new_request(uri, method='GET', body=None, headers=None, - 517 redirections=httplib2.DEFAULT_MAX_REDIRECTS, - 518 connection_type=None): - 519 if not self.access_token: - 520 logger.info('Attempting refresh to obtain initial access_token') - 521 self._refresh(request_orig) - 522 - 523 # Clone and modify the request headers to add the appropriate - 524 # Authorization header. - 525 if headers is None: - 526 headers = {} - 527 else: - 528 headers = dict(headers) - 529 self.apply(headers) - 530 - 531 if self.user_agent is not None: - 532 if 'user-agent' in headers: - 533 headers['user-agent'] = self.user_agent + ' ' + headers['user-agent'] - 534 else: - 535 headers['user-agent'] = self.user_agent - 536 - 537 resp, content = request_orig(uri, method, body, clean_headers(headers), - 538 redirections, connection_type) - 539 - 540 if resp.status in REFRESH_STATUS_CODES: - 541 logger.info('Refreshing due to a %s', resp.status) - 542 self._refresh(request_orig) - 543 self.apply(headers) - 544 return request_orig(uri, method, body, clean_headers(headers), - 545 redirections, connection_type) - 546 else: - 547 return (resp, content) -
548 - 549 # Replace the request method with our own closure. - 550 http.request = new_request - 551 - 552 # Set credentials as a property of the request method. - 553 setattr(http.request, 'credentials', self) - 554 - 555 return http -
556 -
557 - def refresh(self, http): -
558 """Forces a refresh of the access_token. - 559 - 560 Args: - 561 http: httplib2.Http, an http object to be used to make the refresh - 562 request. - 563 """ - 564 self._refresh(http.request) -
565 -
566 - def revoke(self, http): -
567 """Revokes a refresh_token and makes the credentials void. - 568 - 569 Args: - 570 http: httplib2.Http, an http object to be used to make the revoke - 571 request. - 572 """ - 573 self._revoke(http.request) -
574 -
575 - def apply(self, headers): -
576 """Add the authorization to the headers. - 577 - 578 Args: - 579 headers: dict, the headers to add the Authorization header to. - 580 """ - 581 headers['Authorization'] = 'Bearer ' + self.access_token -
582 -
583 - def to_json(self): -
585 - 586 @classmethod -
587 - def from_json(cls, s): -
588 """Instantiate a Credentials object from a JSON description of it. The JSON - 589 should have been produced by calling .to_json() on the object. - 590 - 591 Args: - 592 data: dict, A deserialized JSON object. - 593 - 594 Returns: - 595 An instance of a Credentials subclass. - 596 """ - 597 if six.PY3 and isinstance(s, bytes): - 598 s = s.decode('utf-8') - 599 data = json.loads(s) - 600 if (data.get('token_expiry') and - 601 not isinstance(data['token_expiry'], datetime.datetime)): - 602 try: - 603 data['token_expiry'] = datetime.datetime.strptime( - 604 data['token_expiry'], EXPIRY_FORMAT) - 605 except ValueError: - 606 data['token_expiry'] = None - 607 retval = cls( - 608 data['access_token'], - 609 data['client_id'], - 610 data['client_secret'], - 611 data['refresh_token'], - 612 data['token_expiry'], - 613 data['token_uri'], - 614 data['user_agent'], - 615 revoke_uri=data.get('revoke_uri', None), - 616 id_token=data.get('id_token', None), - 617 token_response=data.get('token_response', None)) - 618 retval.invalid = data['invalid'] - 619 return retval -
620 - 621 @property -
622 - def access_token_expired(self): -
623 """True if the credential is expired or invalid. - 624 - 625 If the token_expiry isn't set, we assume the token doesn't expire. - 626 """ - 627 if self.invalid: - 628 return True - 629 - 630 if not self.token_expiry: - 631 return False - 632 - 633 now = datetime.datetime.utcnow() - 634 if now >= self.token_expiry: - 635 logger.info('access_token is expired. Now: %s, token_expiry: %s', - 636 now, self.token_expiry) - 637 return True - 638 return False -
639 -
640 - def get_access_token(self, http=None): -
641 """Return the access token and its expiration information. - 642 - 643 If the token does not exist, get one. - 644 If the token expired, refresh it. - 645 """ - 646 if not self.access_token or self.access_token_expired: - 647 if not http: - 648 http = httplib2.Http() - 649 self.refresh(http) - 650 return AccessTokenInfo(access_token=self.access_token, - 651 expires_in=self._expires_in()) -
652 -
653 - def set_store(self, store): -
654 """Set the Storage for the credential. - 655 - 656 Args: - 657 store: Storage, an implementation of Storage object. - 658 This is needed to store the latest access_token if it - 659 has expired and been refreshed. This implementation uses - 660 locking to check for updates before updating the - 661 access_token. - 662 """ - 663 self.store = store -
664 -
665 - def _expires_in(self): -
666 """Return the number of seconds until this token expires. - 667 - 668 If token_expiry is in the past, this method will return 0, meaning the - 669 token has already expired. - 670 If token_expiry is None, this method will return None. Note that returning - 671 0 in such a case would not be fair: the token may still be valid; - 672 we just don't know anything about it. - 673 """ - 674 if self.token_expiry: - 675 now = datetime.datetime.utcnow() - 676 if self.token_expiry > now: - 677 time_delta = self.token_expiry - now - 678 # TODO(orestica): return time_delta.total_seconds() - 679 # once dropping support for Python 2.6 - 680 return time_delta.days * 86400 + time_delta.seconds - 681 else: - 682 return 0 -
683 -
684 - def _updateFromCredential(self, other): -
685 """Update this Credential from another instance.""" - 686 self.__dict__.update(other.__getstate__()) -
687 -
688 - def __getstate__(self): -
689 """Trim the state down to something that can be pickled.""" - 690 d = copy.copy(self.__dict__) - 691 del d['store'] - 692 return d -
693 -
694 - def __setstate__(self, state): -
695 """Reconstitute the state of the object from being pickled.""" - 696 self.__dict__.update(state) - 697 self.store = None -
698 -
700 """Generate the body that will be used in the refresh request.""" - 701 body = urllib.parse.urlencode({ - 702 'grant_type': 'refresh_token', - 703 'client_id': self.client_id, - 704 'client_secret': self.client_secret, - 705 'refresh_token': self.refresh_token, - 706 }) - 707 return body -
708 -
710 """Generate the headers that will be used in the refresh request.""" - 711 headers = { - 712 'content-type': 'application/x-www-form-urlencoded', - 713 } - 714 - 715 if self.user_agent is not None: - 716 headers['user-agent'] = self.user_agent - 717 - 718 return headers -
719 -
720 - def _refresh(self, http_request): -
721 """Refreshes the access_token. - 722 - 723 This method first checks by reading the Storage object if available. - 724 If a refresh is still needed, it holds the Storage lock until the - 725 refresh is completed. - 726 - 727 Args: - 728 http_request: callable, a callable that matches the method signature of - 729 httplib2.Http.request, used to make the refresh request. - 730 - 731 Raises: - 732 AccessTokenRefreshError: When the refresh fails. - 733 """ - 734 if not self.store: - 735 self._do_refresh_request(http_request) - 736 else: - 737 self.store.acquire_lock() - 738 try: - 739 new_cred = self.store.locked_get() - 740 if (new_cred and not new_cred.invalid and - 741 new_cred.access_token != self.access_token): - 742 logger.info('Updated access_token read from Storage') - 743 self._updateFromCredential(new_cred) - 744 else: - 745 self._do_refresh_request(http_request) - 746 finally: - 747 self.store.release_lock() -
748 -
749 - def _do_refresh_request(self, http_request): -
750 """Refresh the access_token using the refresh_token. - 751 - 752 Args: - 753 http_request: callable, a callable that matches the method signature of - 754 httplib2.Http.request, used to make the refresh request. - 755 - 756 Raises: - 757 AccessTokenRefreshError: When the refresh fails. - 758 """ - 759 body = self._generate_refresh_request_body() - 760 headers = self._generate_refresh_request_headers() - 761 - 762 logger.info('Refreshing access_token') - 763 resp, content = http_request( - 764 self.token_uri, method='POST', body=body, headers=headers) - 765 if six.PY3 and isinstance(content, bytes): - 766 content = content.decode('utf-8') - 767 if resp.status == 200: - 768 d = json.loads(content) - 769 self.token_response = d - 770 self.access_token = d['access_token'] - 771 self.refresh_token = d.get('refresh_token', self.refresh_token) - 772 if 'expires_in' in d: - 773 self.token_expiry = datetime.timedelta( - 774 seconds=int(d['expires_in'])) + datetime.datetime.utcnow() - 775 else: - 776 self.token_expiry = None - 777 # On temporary refresh errors, the user does not actually have to - 778 # re-authorize, so we unflag here. - 779 self.invalid = False - 780 if self.store: - 781 self.store.locked_put(self) - 782 else: - 783 # An {'error':...} response body means the token is expired or revoked, - 784 # so we flag the credentials as such. - 785 logger.info('Failed to retrieve access token: %s', content) - 786 error_msg = 'Invalid response %s.' % resp['status'] - 787 try: - 788 d = json.loads(content) - 789 if 'error' in d: - 790 error_msg = d['error'] - 791 if 'error_description' in d: - 792 error_msg += ': ' + d['error_description'] - 793 self.invalid = True - 794 if self.store: - 795 self.store.locked_put(self) - 796 except (TypeError, ValueError): - 797 pass - 798 raise AccessTokenRefreshError(error_msg) -
799 -
800 - def _revoke(self, http_request): -
801 """Revokes the refresh_token and deletes the store if available. - 802 - 803 Args: - 804 http_request: callable, a callable that matches the method signature of - 805 httplib2.Http.request, used to make the revoke request. - 806 """ - 807 self._do_revoke(http_request, self.refresh_token) -
808 -
809 - def _do_revoke(self, http_request, token): -
810 """Revokes the credentials and deletes the store if available. - 811 - 812 Args: - 813 http_request: callable, a callable that matches the method signature of - 814 httplib2.Http.request, used to make the refresh request. - 815 token: A string used as the token to be revoked. Can be either an - 816 access_token or refresh_token. - 817 - 818 Raises: - 819 TokenRevokeError: If the revoke request does not return with a 200 OK. - 820 """ - 821 logger.info('Revoking token') - 822 query_params = {'token': token} - 823 token_revoke_uri = _update_query_params(self.revoke_uri, query_params) - 824 resp, content = http_request(token_revoke_uri) - 825 if resp.status == 200: - 826 self.invalid = True - 827 else: - 828 error_msg = 'Invalid response %s.' % resp.status - 829 try: - 830 d = json.loads(content) - 831 if 'error' in d: - 832 error_msg = d['error'] - 833 except (TypeError, ValueError): - 834 pass - 835 raise TokenRevokeError(error_msg) - 836 - 837 if self.store: - 838 self.store.delete() -
839 -
840 - 841 -class AccessTokenCredentials(OAuth2Credentials): -
842 """Credentials object for OAuth 2.0. - 843 - 844 Credentials can be applied to an httplib2.Http object using the - 845 authorize() method, which then signs each request from that object - 846 with the OAuth 2.0 access token. This set of credentials is for the - 847 use case where you have acquired an OAuth 2.0 access_token from - 848 another place such as a JavaScript client or another web - 849 application, and wish to use it from Python. Because only the - 850 access_token is present it can not be refreshed and will in time - 851 expire. - 852 - 853 AccessTokenCredentials objects may be safely pickled and unpickled. - 854 - 855 Usage: - 856 credentials = AccessTokenCredentials('<an access token>', - 857 'my-user-agent/1.0') - 858 http = httplib2.Http() - 859 http = credentials.authorize(http) - 860 - 861 Exceptions: - 862 AccessTokenCredentialsExpired: raised when the access_token expires or is - 863 revoked. - 864 """ - 865 -
866 - def __init__(self, access_token, user_agent, revoke_uri=None): -
867 """Create an instance of OAuth2Credentials - 868 - 869 This is one of the few types if Credentials that you should contrust, - 870 Credentials objects are usually instantiated by a Flow. - 871 - 872 Args: - 873 access_token: string, access token. - 874 user_agent: string, The HTTP User-Agent to provide for this application. - 875 revoke_uri: string, URI for revoke endpoint. Defaults to None; a token - 876 can't be revoked if this is None. - 877 """ - 878 super(AccessTokenCredentials, self).__init__( - 879 access_token, - 880 None, - 881 None, - 882 None, - 883 None, - 884 None, - 885 user_agent, - 886 revoke_uri=revoke_uri) -
887 - 888 - 889 @classmethod -
890 - def from_json(cls, s): -
891 if six.PY3 and isinstance(s, bytes): - 892 s = s.decode('utf-8') - 893 data = json.loads(s) - 894 retval = AccessTokenCredentials( - 895 data['access_token'], - 896 data['user_agent']) - 897 return retval -
898 -
899 - def _refresh(self, http_request): -
900 raise AccessTokenCredentialsError( - 901 'The access_token is expired or invalid and can\'t be refreshed.') -
902 -
903 - def _revoke(self, http_request): -
904 """Revokes the access_token and deletes the store if available. - 905 - 906 Args: - 907 http_request: callable, a callable that matches the method signature of - 908 httplib2.Http.request, used to make the revoke request. - 909 """ - 910 self._do_revoke(http_request, self.access_token) -
911 - 912 - 913 _env_name = None -
914 - 915 - 916 -def _get_environment(urlopen=None): -
917 """Detect the environment the code is being run on.""" - 918 - 919 global _env_name - 920 - 921 if _env_name: - 922 return _env_name - 923 - 924 server_software = os.environ.get('SERVER_SOFTWARE', '') - 925 if server_software.startswith('Google App Engine/'): - 926 _env_name = 'GAE_PRODUCTION' - 927 elif server_software.startswith('Development/'): - 928 _env_name = 'GAE_LOCAL' - 929 else: - 930 try: - 931 if urlopen is None: - 932 urlopen = urllib.request.urlopen - 933 response = urlopen('http://metadata.google.internal') - 934 if any('Metadata-Flavor: Google' in h for h in response.info().headers): - 935 _env_name = 'GCE_PRODUCTION' - 936 else: - 937 _env_name = 'UNKNOWN' - 938 except urllib.error.URLError: - 939 _env_name = 'UNKNOWN' - 940 - 941 return _env_name -
942 -
943 - 944 -class GoogleCredentials(OAuth2Credentials): -
945 """Application Default Credentials for use in calling Google APIs. - 946 - 947 The Application Default Credentials are being constructed as a function of - 948 the environment where the code is being run. - 949 More details can be found on this page: - 950 https://developers.google.com/accounts/docs/application-default-credentials - 951 - 952 Here is an example of how to use the Application Default Credentials for a - 953 service that requires authentication: - 954 - 955 <code> - 956 from __future__ import print_function # unnecessary in python3 - 957 from googleapiclient.discovery import build - 958 from oauth2client.client import GoogleCredentials - 959 - 960 PROJECT = 'bamboo-machine-422' # replace this with one of your projects - 961 ZONE = 'us-central1-a' # replace this with the zone you care about - 962 - 963 credentials = GoogleCredentials.get_application_default() - 964 service = build('compute', 'v1', credentials=credentials) - 965 - 966 request = service.instances().list(project=PROJECT, zone=ZONE) - 967 response = request.execute() - 968 - 969 print(response) - 970 </code> - 971 - 972 A service that does not require authentication does not need credentials - 973 to be passed in: - 974 - 975 <code> - 976 from googleapiclient.discovery import build - 977 - 978 service = build('discovery', 'v1') - 979 - 980 request = service.apis().list() - 981 response = request.execute() - 982 - 983 print(response) - 984 </code> - 985 """ - 986 -
987 - def __init__(self, access_token, client_id, client_secret, refresh_token, - 988 token_expiry, token_uri, user_agent, - 989 revoke_uri=GOOGLE_REVOKE_URI): -
990 """Create an instance of GoogleCredentials. - 991 - 992 This constructor is not usually called by the user, instead - 993 GoogleCredentials objects are instantiated by - 994 GoogleCredentials.from_stream() or - 995 GoogleCredentials.get_application_default(). - 996 - 997 Args: - 998 access_token: string, access token. - 999 client_id: string, client identifier. -1000 client_secret: string, client secret. -1001 refresh_token: string, refresh token. -1002 token_expiry: datetime, when the access_token expires. -1003 token_uri: string, URI of token endpoint. -1004 user_agent: string, The HTTP User-Agent to provide for this application. -1005 revoke_uri: string, URI for revoke endpoint. -1006 Defaults to GOOGLE_REVOKE_URI; a token can't be revoked if this is None. -1007 """ -1008 super(GoogleCredentials, self).__init__( -1009 access_token, client_id, client_secret, refresh_token, token_expiry, -1010 token_uri, user_agent, revoke_uri=revoke_uri) -
1011 -
1012 - def create_scoped_required(self): -
1013 """Whether this Credentials object is scopeless. -1014 -1015 create_scoped(scopes) method needs to be called in order to create -1016 a Credentials object for API calls. -1017 """ -1018 return False -
1019 -
1020 - def create_scoped(self, scopes): -
1021 """Create a Credentials object for the given scopes. -1022 -1023 The Credentials type is preserved. -1024 """ -1025 return self -
1026 -1027 @property -
1028 - def serialization_data(self): -
1029 """Get the fields and their values identifying the current credentials.""" -1030 return { -1031 'type': 'authorized_user', -1032 'client_id': self.client_id, -1033 'client_secret': self.client_secret, -1034 'refresh_token': self.refresh_token -1035 } -
1036 -1037 @staticmethod -
1039 """Get the Application Default Credentials for the current environment. -1040 -1041 Exceptions: -1042 ApplicationDefaultCredentialsError: raised when the credentials fail -1043 to be retrieved. -1044 """ -1045 -1046 env_name = _get_environment() -1047 -1048 if env_name in ('GAE_PRODUCTION', 'GAE_LOCAL'): -1049 # if we are running inside Google App Engine -1050 # there is no need to look for credentials in local files -1051 application_default_credential_filename = None -1052 well_known_file = None -1053 else: -1054 application_default_credential_filename = _get_environment_variable_file() -1055 well_known_file = _get_well_known_file() -1056 if not os.path.isfile(well_known_file): -1057 well_known_file = None -1058 -1059 if application_default_credential_filename: -1060 try: -1061 return _get_application_default_credential_from_file( -1062 application_default_credential_filename) -1063 except (ApplicationDefaultCredentialsError, ValueError) as error: -1064 extra_help = (' (pointed to by ' + GOOGLE_APPLICATION_CREDENTIALS + -1065 ' environment variable)') -1066 _raise_exception_for_reading_json( -1067 application_default_credential_filename, extra_help, error) -1068 elif well_known_file: -1069 try: -1070 return _get_application_default_credential_from_file(well_known_file) -1071 except (ApplicationDefaultCredentialsError, ValueError) as error: -1072 extra_help = (' (produced automatically when running' -1073 ' "gcloud auth login" command)') -1074 _raise_exception_for_reading_json(well_known_file, extra_help, error) -1075 elif env_name in ('GAE_PRODUCTION', 'GAE_LOCAL'): -1076 return _get_application_default_credential_GAE() -1077 elif env_name == 'GCE_PRODUCTION': -1078 return _get_application_default_credential_GCE() -1079 else: -1080 raise ApplicationDefaultCredentialsError(ADC_HELP_MSG) -
1081 -1082 @staticmethod -
1083 - def from_stream(credential_filename): -
1084 """Create a Credentials object by reading the information from a given file. -1085 -1086 It returns an object of type GoogleCredentials. -1087 -1088 Args: -1089 credential_filename: the path to the file from where the credentials -1090 are to be read -1091 -1092 Exceptions: -1093 ApplicationDefaultCredentialsError: raised when the credentials fail -1094 to be retrieved. -1095 """ -1096 -1097 if credential_filename and os.path.isfile(credential_filename): -1098 try: -1099 return _get_application_default_credential_from_file( -1100 credential_filename) -1101 except (ApplicationDefaultCredentialsError, ValueError) as error: -1102 extra_help = ' (provided as parameter to the from_stream() method)' -1103 _raise_exception_for_reading_json(credential_filename, -1104 extra_help, -1105 error) -1106 else: -1107 raise ApplicationDefaultCredentialsError( -1108 'The parameter passed to the from_stream() ' -1109 'method should point to a file.') -
1110 -
1111 -1112 -def save_to_well_known_file(credentials, well_known_file=None): -
1113 """Save the provided GoogleCredentials to the well known file. -1114 -1115 Args: -1116 credentials: -1117 the credentials to be saved to the well known file; -1118 it should be an instance of GoogleCredentials -1119 well_known_file: -1120 the name of the file where the credentials are to be saved; -1121 this parameter is supposed to be used for testing only -1122 """ -1123 # TODO(orestica): move this method to tools.py -1124 # once the argparse import gets fixed (it is not present in Python 2.6) -1125 -1126 if well_known_file is None: -1127 well_known_file = _get_well_known_file() -1128 -1129 credentials_data = credentials.serialization_data -1130 -1131 with open(well_known_file, 'w') as f: -1132 json.dump(credentials_data, f, sort_keys=True, indent=2, separators=(',', ': ')) -
1133 -
1136 application_default_credential_filename = ( -1137 os.environ.get(GOOGLE_APPLICATION_CREDENTIALS, -1138 None)) -1139 -1140 if application_default_credential_filename: -1141 if os.path.isfile(application_default_credential_filename): -1142 return application_default_credential_filename -1143 else: -1144 raise ApplicationDefaultCredentialsError( -1145 'File ' + application_default_credential_filename + ' (pointed by ' + -1146 GOOGLE_APPLICATION_CREDENTIALS + -1147 ' environment variable) does not exist!') -
1148 -
1149 -1150 -def _get_well_known_file(): -
1151 """Get the well known file produced by command 'gcloud auth login'.""" -1152 # TODO(orestica): Revisit this method once gcloud provides a better way -1153 # of pinpointing the exact location of the file. -1154 -1155 WELL_KNOWN_CREDENTIALS_FILE = 'application_default_credentials.json' -1156 CLOUDSDK_CONFIG_DIRECTORY = 'gcloud' -1157 -1158 if os.name == 'nt': -1159 try: -1160 default_config_path = os.path.join(os.environ['APPDATA'], -1161 CLOUDSDK_CONFIG_DIRECTORY) -1162 except KeyError: -1163 # This should never happen unless someone is really messing with things. -1164 drive = os.environ.get('SystemDrive', 'C:') -1165 default_config_path = os.path.join(drive, '\\', CLOUDSDK_CONFIG_DIRECTORY) -1166 else: -1167 default_config_path = os.path.join(os.path.expanduser('~'), -1168 '.config', -1169 CLOUDSDK_CONFIG_DIRECTORY) -1170 -1171 default_config_path = os.path.join(default_config_path, -1172 WELL_KNOWN_CREDENTIALS_FILE) -1173 -1174 return default_config_path -
1175 -
1176 -1177 -def _get_application_default_credential_from_file( -1178 application_default_credential_filename): -
1179 """Build the Application Default Credentials from file.""" -1180 -1181 from oauth2client import service_account -1182 -1183 # read the credentials from the file -1184 with open(application_default_credential_filename) as ( -1185 application_default_credential): -1186 client_credentials = json.load(application_default_credential) -1187 -1188 credentials_type = client_credentials.get('type') -1189 if credentials_type == AUTHORIZED_USER: -1190 required_fields = set(['client_id', 'client_secret', 'refresh_token']) -1191 elif credentials_type == SERVICE_ACCOUNT: -1192 required_fields = set(['client_id', 'client_email', 'private_key_id', -1193 'private_key']) -1194 else: -1195 raise ApplicationDefaultCredentialsError( -1196 "'type' field should be defined (and have one of the '" + -1197 AUTHORIZED_USER + "' or '" + SERVICE_ACCOUNT + "' values)") -1198 -1199 missing_fields = required_fields.difference(client_credentials.keys()) -1200 -1201 if missing_fields: -1202 _raise_exception_for_missing_fields(missing_fields) -1203 -1204 if client_credentials['type'] == AUTHORIZED_USER: -1205 return GoogleCredentials( -1206 access_token=None, -1207 client_id=client_credentials['client_id'], -1208 client_secret=client_credentials['client_secret'], -1209 refresh_token=client_credentials['refresh_token'], -1210 token_expiry=None, -1211 token_uri=GOOGLE_TOKEN_URI, -1212 user_agent='Python client library') -1213 else: # client_credentials['type'] == SERVICE_ACCOUNT -1214 return service_account._ServiceAccountCredentials( -1215 service_account_id=client_credentials['client_id'], -1216 service_account_email=client_credentials['client_email'], -1217 private_key_id=client_credentials['private_key_id'], -1218 private_key_pkcs8_text=client_credentials['private_key'], -1219 scopes=[]) -
1220 -
1221 -1222 -def _raise_exception_for_missing_fields(missing_fields): -
1223 raise ApplicationDefaultCredentialsError( -1224 'The following field(s) must be defined: ' + ', '.join(missing_fields)) -
1225 -
1226 -1227 -def _raise_exception_for_reading_json(credential_file, -1228 extra_help, -1229 error): -
1230 raise ApplicationDefaultCredentialsError( -1231 'An error was encountered while reading json file: '+ -1232 credential_file + extra_help + ': ' + str(error)) -
1233 -
1236 from oauth2client.appengine import AppAssertionCredentials -1237 -1238 return AppAssertionCredentials([]) -
1239 -
1242 from oauth2client.gce import AppAssertionCredentials -1243 -1244 return AppAssertionCredentials([]) -
1245 -
1246 -1247 -class AssertionCredentials(GoogleCredentials): -
1248 """Abstract Credentials object used for OAuth 2.0 assertion grants. -1249 -1250 This credential does not require a flow to instantiate because it -1251 represents a two legged flow, and therefore has all of the required -1252 information to generate and refresh its own access tokens. It must -1253 be subclassed to generate the appropriate assertion string. -1254 -1255 AssertionCredentials objects may be safely pickled and unpickled. -1256 """ -1257 -1258 @util.positional(2) -
1259 - def __init__(self, assertion_type, user_agent=None, -1260 token_uri=GOOGLE_TOKEN_URI, -1261 revoke_uri=GOOGLE_REVOKE_URI, -1262 **unused_kwargs): -
1263 """Constructor for AssertionFlowCredentials. -1264 -1265 Args: -1266 assertion_type: string, assertion type that will be declared to the auth -1267 server -1268 user_agent: string, The HTTP User-Agent to provide for this application. -1269 token_uri: string, URI for token endpoint. For convenience -1270 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -1271 revoke_uri: string, URI for revoke endpoint. -1272 """ -1273 super(AssertionCredentials, self).__init__( -1274 None, -1275 None, -1276 None, -1277 None, -1278 None, -1279 token_uri, -1280 user_agent, -1281 revoke_uri=revoke_uri) -1282 self.assertion_type = assertion_type -
1283 -
1285 assertion = self._generate_assertion() -1286 -1287 body = urllib.parse.urlencode({ -1288 'assertion': assertion, -1289 'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer', -1290 }) -1291 -1292 return body -
1293 -
1294 - def _generate_assertion(self): -
1295 """Generate the assertion string that will be used in the access token -1296 request. -1297 """ -1298 _abstract() -
1299 -
1300 - def _revoke(self, http_request): -
1301 """Revokes the access_token and deletes the store if available. -1302 -1303 Args: -1304 http_request: callable, a callable that matches the method signature of -1305 httplib2.Http.request, used to make the revoke request. -1306 """ -1307 self._do_revoke(http_request, self.access_token) -
1308 -
1309 -1310 -def _RequireCryptoOrDie(): -
1311 """Ensure we have a crypto library, or throw CryptoUnavailableError. -1312 -1313 The oauth2client.crypt module requires either PyCrypto or PyOpenSSL -1314 to be available in order to function, but these are optional -1315 dependencies. -1316 """ -1317 if not HAS_CRYPTO: -1318 raise CryptoUnavailableError('No crypto library available') -
1319 -
1320 -1321 -class SignedJwtAssertionCredentials(AssertionCredentials): -
1322 """Credentials object used for OAuth 2.0 Signed JWT assertion grants. -1323 -1324 This credential does not require a flow to instantiate because it -1325 represents a two legged flow, and therefore has all of the required -1326 information to generate and refresh its own access tokens. -1327 -1328 SignedJwtAssertionCredentials requires either PyOpenSSL, or PyCrypto -1329 2.6 or later. For App Engine you may also consider using -1330 AppAssertionCredentials. -1331 """ -1332 -1333 MAX_TOKEN_LIFETIME_SECS = 3600 # 1 hour in seconds -1334 -1335 @util.positional(4) -
1336 - def __init__(self, -1337 service_account_name, -1338 private_key, -1339 scope, -1340 private_key_password='notasecret', -1341 user_agent=None, -1342 token_uri=GOOGLE_TOKEN_URI, -1343 revoke_uri=GOOGLE_REVOKE_URI, -1344 **kwargs): -
1345 """Constructor for SignedJwtAssertionCredentials. -1346 -1347 Args: -1348 service_account_name: string, id for account, usually an email address. -1349 private_key: string, private key in PKCS12 or PEM format. -1350 scope: string or iterable of strings, scope(s) of the credentials being -1351 requested. -1352 private_key_password: string, password for private_key, unused if -1353 private_key is in PEM format. -1354 user_agent: string, HTTP User-Agent to provide for this application. -1355 token_uri: string, URI for token endpoint. For convenience -1356 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -1357 revoke_uri: string, URI for revoke endpoint. -1358 kwargs: kwargs, Additional parameters to add to the JWT token, for -1359 example sub=joe@xample.org. -1360 -1361 Raises: -1362 CryptoUnavailableError if no crypto library is available. -1363 """ -1364 _RequireCryptoOrDie() -1365 super(SignedJwtAssertionCredentials, self).__init__( -1366 None, -1367 user_agent=user_agent, -1368 token_uri=token_uri, -1369 revoke_uri=revoke_uri, -1370 ) -1371 -1372 self.scope = util.scopes_to_string(scope) -1373 -1374 # Keep base64 encoded so it can be stored in JSON. -1375 self.private_key = base64.b64encode(private_key) -1376 if isinstance(self.private_key, six.text_type): -1377 self.private_key = self.private_key.encode('utf-8') -1378 -1379 self.private_key_password = private_key_password -1380 self.service_account_name = service_account_name -1381 self.kwargs = kwargs -
1382 -1383 @classmethod -
1384 - def from_json(cls, s): -
1385 data = json.loads(s) -1386 retval = SignedJwtAssertionCredentials( -1387 data['service_account_name'], -1388 base64.b64decode(data['private_key']), -1389 data['scope'], -1390 private_key_password=data['private_key_password'], -1391 user_agent=data['user_agent'], -1392 token_uri=data['token_uri'], -1393 **data['kwargs'] -1394 ) -1395 retval.invalid = data['invalid'] -1396 retval.access_token = data['access_token'] -1397 return retval -
1398 -
1399 - def _generate_assertion(self): -
1400 """Generate the assertion that will be used in the request.""" -1401 now = int(time.time()) -1402 payload = { -1403 'aud': self.token_uri, -1404 'scope': self.scope, -1405 'iat': now, -1406 'exp': now + SignedJwtAssertionCredentials.MAX_TOKEN_LIFETIME_SECS, -1407 'iss': self.service_account_name -1408 } -1409 payload.update(self.kwargs) -1410 logger.debug(str(payload)) -1411 -1412 private_key = base64.b64decode(self.private_key) -1413 return crypt.make_signed_jwt(crypt.Signer.from_string( -1414 private_key, self.private_key_password), payload) -
1415 -1416 # Only used in verify_id_token(), which is always calling to the same URI -1417 # for the certs. -1418 _cached_http = httplib2.Http(MemoryCache()) -
1419 -1420 @util.positional(2) -1421 -def verify_id_token(id_token, audience, http=None, -1422 cert_uri=ID_TOKEN_VERIFICATION_CERTS): -
1423 """Verifies a signed JWT id_token. -1424 -1425 This function requires PyOpenSSL and because of that it does not work on -1426 App Engine. -1427 -1428 Args: -1429 id_token: string, A Signed JWT. -1430 audience: string, The audience 'aud' that the token should be for. -1431 http: httplib2.Http, instance to use to make the HTTP request. Callers -1432 should supply an instance that has caching enabled. -1433 cert_uri: string, URI of the certificates in JSON format to -1434 verify the JWT against. -1435 -1436 Returns: -1437 The deserialized JSON in the JWT. -1438 -1439 Raises: -1440 oauth2client.crypt.AppIdentityError: if the JWT fails to verify. -1441 CryptoUnavailableError: if no crypto library is available. -1442 """ -1443 _RequireCryptoOrDie() -1444 if http is None: -1445 http = _cached_http -1446 -1447 resp, content = http.request(cert_uri) -1448 -1449 if resp.status == 200: -1450 certs = json.loads(content.decode('utf-8')) -1451 return crypt.verify_signed_jwt_with_certs(id_token, certs, audience) -1452 else: -1453 raise VerifyJwtTokenError('Status code: %d' % resp.status) -
1454 -
1455 -1456 -def _urlsafe_b64decode(b64string): -
1457 # Guard against unicode strings, which base64 can't handle. -1458 if isinstance(b64string, six.text_type): -1459 b64string = b64string.encode('ascii') -1460 padded = b64string + b'=' * (4 - len(b64string) % 4) -1461 return base64.urlsafe_b64decode(padded) -
1462 -
1463 -1464 -def _extract_id_token(id_token): -
1465 """Extract the JSON payload from a JWT. -1466 -1467 Does the extraction w/o checking the signature. -1468 -1469 Args: -1470 id_token: string, OAuth 2.0 id_token. -1471 -1472 Returns: -1473 object, The deserialized JSON payload. -1474 """ -1475 segments = id_token.split('.') -1476 -1477 if len(segments) != 3: -1478 raise VerifyJwtTokenError( -1479 'Wrong number of segments in token: %s' % id_token) -1480 -1481 return json.loads(_urlsafe_b64decode(segments[1]).decode('utf-8')) -
1482 -
1483 -1484 -def _parse_exchange_token_response(content): -
1485 """Parses response of an exchange token request. -1486 -1487 Most providers return JSON but some (e.g. Facebook) return a -1488 url-encoded string. -1489 -1490 Args: -1491 content: The body of a response -1492 -1493 Returns: -1494 Content as a dictionary object. Note that the dict could be empty, -1495 i.e. {}. That basically indicates a failure. -1496 """ -1497 resp = {} -1498 try: -1499 resp = json.loads(content.decode('utf-8')) -1500 except Exception: -1501 # different JSON libs raise different exceptions, -1502 # so we just do a catch-all here -1503 resp = dict(urllib.parse.parse_qsl(content)) -1504 -1505 # some providers respond with 'expires', others with 'expires_in' -1506 if resp and 'expires' in resp: -1507 resp['expires_in'] = resp.pop('expires') -1508 -1509 return resp -
1510 -
1511 -1512 @util.positional(4) -1513 -def credentials_from_code(client_id, client_secret, scope, code, -1514 redirect_uri='postmessage', http=None, -1515 user_agent=None, token_uri=GOOGLE_TOKEN_URI, -1516 auth_uri=GOOGLE_AUTH_URI, -1517 revoke_uri=GOOGLE_REVOKE_URI, -1518 device_uri=GOOGLE_DEVICE_URI): -
1519 """Exchanges an authorization code for an OAuth2Credentials object. -1520 -1521 Args: -1522 client_id: string, client identifier. -1523 client_secret: string, client secret. -1524 scope: string or iterable of strings, scope(s) to request. -1525 code: string, An authroization code, most likely passed down from -1526 the client -1527 redirect_uri: string, this is generally set to 'postmessage' to match the -1528 redirect_uri that the client specified -1529 http: httplib2.Http, optional http instance to use to do the fetch -1530 token_uri: string, URI for token endpoint. For convenience -1531 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -1532 auth_uri: string, URI for authorization endpoint. For convenience -1533 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -1534 revoke_uri: string, URI for revoke endpoint. For convenience -1535 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -1536 device_uri: string, URI for device authorization endpoint. For convenience -1537 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -1538 -1539 Returns: -1540 An OAuth2Credentials object. -1541 -1542 Raises: -1543 FlowExchangeError if the authorization code cannot be exchanged for an -1544 access token -1545 """ -1546 flow = OAuth2WebServerFlow(client_id, client_secret, scope, -1547 redirect_uri=redirect_uri, user_agent=user_agent, -1548 auth_uri=auth_uri, token_uri=token_uri, -1549 revoke_uri=revoke_uri, device_uri=device_uri) -1550 -1551 credentials = flow.step2_exchange(code, http=http) -1552 return credentials -
1553 -
1554 -1555 @util.positional(3) -1556 -def credentials_from_clientsecrets_and_code(filename, scope, code, -1557 message = None, -1558 redirect_uri='postmessage', -1559 http=None, -1560 cache=None, -1561 device_uri=None): -
1562 """Returns OAuth2Credentials from a clientsecrets file and an auth code. -1563 -1564 Will create the right kind of Flow based on the contents of the clientsecrets -1565 file or will raise InvalidClientSecretsError for unknown types of Flows. -1566 -1567 Args: -1568 filename: string, File name of clientsecrets. -1569 scope: string or iterable of strings, scope(s) to request. -1570 code: string, An authorization code, most likely passed down from -1571 the client -1572 message: string, A friendly string to display to the user if the -1573 clientsecrets file is missing or invalid. If message is provided then -1574 sys.exit will be called in the case of an error. If message in not -1575 provided then clientsecrets.InvalidClientSecretsError will be raised. -1576 redirect_uri: string, this is generally set to 'postmessage' to match the -1577 redirect_uri that the client specified -1578 http: httplib2.Http, optional http instance to use to do the fetch -1579 cache: An optional cache service client that implements get() and set() -1580 methods. See clientsecrets.loadfile() for details. -1581 device_uri: string, OAuth 2.0 device authorization endpoint -1582 -1583 Returns: -1584 An OAuth2Credentials object. -1585 -1586 Raises: -1587 FlowExchangeError if the authorization code cannot be exchanged for an -1588 access token -1589 UnknownClientSecretsFlowError if the file describes an unknown kind of Flow. -1590 clientsecrets.InvalidClientSecretsError if the clientsecrets file is -1591 invalid. -1592 """ -1593 flow = flow_from_clientsecrets(filename, scope, message=message, cache=cache, -1594 redirect_uri=redirect_uri, -1595 device_uri=device_uri) -1596 credentials = flow.step2_exchange(code, http=http) -1597 return credentials -
1598 -
1599 -1600 -class DeviceFlowInfo(collections.namedtuple('DeviceFlowInfo', ( -1601 'device_code', 'user_code', 'interval', 'verification_url', -1602 'user_code_expiry'))): -
1603 """Intermediate information the OAuth2 for devices flow.""" -1604 -1605 @classmethod -
1606 - def FromResponse(cls, response): -
1607 """Create a DeviceFlowInfo from a server response. -1608 -1609 The response should be a dict containing entries as described -1610 here: -1611 http://tools.ietf.org/html/draft-ietf-oauth-v2-05#section-3.7.1 -1612 """ -1613 # device_code, user_code, and verification_url are required. -1614 kwargs = { -1615 'device_code': response['device_code'], -1616 'user_code': response['user_code'], -1617 } -1618 # The response may list the verification address as either -1619 # verification_url or verification_uri, so we check for both. -1620 verification_url = response.get( -1621 'verification_url', response.get('verification_uri')) -1622 if verification_url is None: -1623 raise OAuth2DeviceCodeError( -1624 'No verification_url provided in server response') -1625 kwargs['verification_url'] = verification_url -1626 # expires_in and interval are optional. -1627 kwargs.update({ -1628 'interval': response.get('interval'), -1629 'user_code_expiry': None, -1630 }) -1631 if 'expires_in' in response: -1632 kwargs['user_code_expiry'] = datetime.datetime.now() + datetime.timedelta( -1633 seconds=int(response['expires_in'])) -1634 -1635 return cls(**kwargs) -
1636 -
1637 -class OAuth2WebServerFlow(Flow): -
1638 """Does the Web Server Flow for OAuth 2.0. -1639 -1640 OAuth2WebServerFlow objects may be safely pickled and unpickled. -1641 """ -1642 -1643 @util.positional(4) -
1644 - def __init__(self, client_id, client_secret, scope, -1645 redirect_uri=None, -1646 user_agent=None, -1647 auth_uri=GOOGLE_AUTH_URI, -1648 token_uri=GOOGLE_TOKEN_URI, -1649 revoke_uri=GOOGLE_REVOKE_URI, -1650 login_hint=None, -1651 device_uri=GOOGLE_DEVICE_URI, -1652 **kwargs): -
1653 """Constructor for OAuth2WebServerFlow. -1654 -1655 The kwargs argument is used to set extra query parameters on the -1656 auth_uri. For example, the access_type and approval_prompt -1657 query parameters can be set via kwargs. -1658 -1659 Args: -1660 client_id: string, client identifier. -1661 client_secret: string client secret. -1662 scope: string or iterable of strings, scope(s) of the credentials being -1663 requested. -1664 redirect_uri: string, Either the string 'urn:ietf:wg:oauth:2.0:oob' for -1665 a non-web-based application, or a URI that handles the callback from -1666 the authorization server. -1667 user_agent: string, HTTP User-Agent to provide for this application. -1668 auth_uri: string, URI for authorization endpoint. For convenience -1669 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -1670 token_uri: string, URI for token endpoint. For convenience -1671 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -1672 revoke_uri: string, URI for revoke endpoint. For convenience -1673 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -1674 login_hint: string, Either an email address or domain. Passing this hint -1675 will either pre-fill the email box on the sign-in form or select the -1676 proper multi-login session, thereby simplifying the login flow. -1677 device_uri: string, URI for device authorization endpoint. For convenience -1678 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -1679 **kwargs: dict, The keyword arguments are all optional and required -1680 parameters for the OAuth calls. -1681 """ -1682 self.client_id = client_id -1683 self.client_secret = client_secret -1684 self.scope = util.scopes_to_string(scope) -1685 self.redirect_uri = redirect_uri -1686 self.login_hint = login_hint -1687 self.user_agent = user_agent -1688 self.auth_uri = auth_uri -1689 self.token_uri = token_uri -1690 self.revoke_uri = revoke_uri -1691 self.device_uri = device_uri -1692 self.params = { -1693 'access_type': 'offline', -1694 'response_type': 'code', -1695 } -1696 self.params.update(kwargs) -
1697 -1698 @util.positional(1) -
1699 - def step1_get_authorize_url(self, redirect_uri=None): -
1700 """Returns a URI to redirect to the provider. -1701 -1702 Args: -1703 redirect_uri: string, Either the string 'urn:ietf:wg:oauth:2.0:oob' for -1704 a non-web-based application, or a URI that handles the callback from -1705 the authorization server. This parameter is deprecated, please move to -1706 passing the redirect_uri in via the constructor. -1707 -1708 Returns: -1709 A URI as a string to redirect the user to begin the authorization flow. -1710 """ -1711 if redirect_uri is not None: -1712 logger.warning(( -1713 'The redirect_uri parameter for ' -1714 'OAuth2WebServerFlow.step1_get_authorize_url is deprecated. Please ' -1715 'move to passing the redirect_uri in via the constructor.')) -1716 self.redirect_uri = redirect_uri -1717 -1718 if self.redirect_uri is None: -1719 raise ValueError('The value of redirect_uri must not be None.') -1720 -1721 query_params = { -1722 'client_id': self.client_id, -1723 'redirect_uri': self.redirect_uri, -1724 'scope': self.scope, -1725 } -1726 if self.login_hint is not None: -1727 query_params['login_hint'] = self.login_hint -1728 query_params.update(self.params) -1729 return _update_query_params(self.auth_uri, query_params) -
1730 -1731 @util.positional(1) -
1732 - def step1_get_device_and_user_codes(self, http=None): -
1733 """Returns a user code and the verification URL where to enter it -1734 -1735 Returns: -1736 A user code as a string for the user to authorize the application -1737 An URL as a string where the user has to enter the code -1738 """ -1739 if self.device_uri is None: -1740 raise ValueError('The value of device_uri must not be None.') -1741 -1742 body = urllib.urlencode({ -1743 'client_id': self.client_id, -1744 'scope': self.scope, -1745 }) -1746 headers = { -1747 'content-type': 'application/x-www-form-urlencoded', -1748 } -1749 -1750 if self.user_agent is not None: -1751 headers['user-agent'] = self.user_agent -1752 -1753 if http is None: -1754 http = httplib2.Http() -1755 -1756 resp, content = http.request(self.device_uri, method='POST', body=body, -1757 headers=headers) -1758 if resp.status == 200: -1759 try: -1760 flow_info = json.loads(content) -1761 except ValueError as e: -1762 raise OAuth2DeviceCodeError( -1763 'Could not parse server response as JSON: "%s", error: "%s"' % ( -1764 content, e)) -1765 return DeviceFlowInfo.FromResponse(flow_info) -1766 else: -1767 error_msg = 'Invalid response %s.' % resp.status -1768 try: -1769 d = json.loads(content) -1770 if 'error' in d: -1771 error_msg += ' Error: %s' % d['error'] -1772 except ValueError: -1773 # Couldn't decode a JSON response, stick with the default message. -1774 pass -1775 raise OAuth2DeviceCodeError(error_msg) -
1776 -1777 @util.positional(2) -
1778 - def step2_exchange(self, code=None, http=None, device_flow_info=None): -
1779 """Exchanges a code for OAuth2Credentials. -1780 -1781 Args: -1782 -1783 code: string, a dict-like object, or None. For a non-device -1784 flow, this is either the response code as a string, or a -1785 dictionary of query parameters to the redirect_uri. For a -1786 device flow, this should be None. -1787 http: httplib2.Http, optional http instance to use when fetching -1788 credentials. -1789 device_flow_info: DeviceFlowInfo, return value from step1 in the -1790 case of a device flow. -1791 -1792 Returns: -1793 An OAuth2Credentials object that can be used to authorize requests. -1794 -1795 Raises: -1796 FlowExchangeError: if a problem occurred exchanging the code for a -1797 refresh_token. -1798 ValueError: if code and device_flow_info are both provided or both -1799 missing. -1800 -1801 """ -1802 if code is None and device_flow_info is None: -1803 raise ValueError('No code or device_flow_info provided.') -1804 if code is not None and device_flow_info is not None: -1805 raise ValueError('Cannot provide both code and device_flow_info.') -1806 -1807 if code is None: -1808 code = device_flow_info.device_code -1809 elif not isinstance(code, basestring): -1810 if 'code' not in code: -1811 raise FlowExchangeError(code.get( -1812 'error', 'No code was supplied in the query parameters.')) -1813 code = code['code'] -1814 -1815 post_data = { -1816 'client_id': self.client_id, -1817 'client_secret': self.client_secret, -1818 'code': code, -1819 'scope': self.scope, -1820 } -1821 if device_flow_info is not None: -1822 post_data['grant_type'] = 'http://oauth.net/grant_type/device/1.0' -1823 else: -1824 post_data['grant_type'] = 'authorization_code' -1825 post_data['redirect_uri'] = self.redirect_uri -1826 body = urllib.parse.urlencode(post_data) -1827 headers = { -1828 'content-type': 'application/x-www-form-urlencoded', -1829 } -1830 -1831 if self.user_agent is not None: -1832 headers['user-agent'] = self.user_agent -1833 -1834 if http is None: -1835 http = httplib2.Http() -1836 -1837 resp, content = http.request(self.token_uri, method='POST', body=body, -1838 headers=headers) -1839 d = _parse_exchange_token_response(content) -1840 if resp.status == 200 and 'access_token' in d: -1841 access_token = d['access_token'] -1842 refresh_token = d.get('refresh_token', None) -1843 if not refresh_token: -1844 logger.info( -1845 'Received token response with no refresh_token. Consider ' -1846 "reauthenticating with approval_prompt='force'.") -1847 token_expiry = None -1848 if 'expires_in' in d: -1849 token_expiry = datetime.datetime.utcnow() + datetime.timedelta( -1850 seconds=int(d['expires_in'])) -1851 -1852 extracted_id_token = None -1853 if 'id_token' in d: -1854 extracted_id_token = _extract_id_token(d['id_token']) -1855 -1856 logger.info('Successfully retrieved access token') -1857 return OAuth2Credentials(access_token, self.client_id, -1858 self.client_secret, refresh_token, token_expiry, -1859 self.token_uri, self.user_agent, -1860 revoke_uri=self.revoke_uri, -1861 id_token=extracted_id_token, -1862 token_response=d) -1863 else: -1864 logger.info('Failed to retrieve access token: %s', content) -1865 if 'error' in d: -1866 # you never know what those providers got to say -1867 error_msg = str(d['error']) -1868 else: -1869 error_msg = 'Invalid response: %s.' % str(resp.status) -1870 raise FlowExchangeError(error_msg) -
1871 -
1872 -1873 @util.positional(2) -1874 -def flow_from_clientsecrets(filename, scope, redirect_uri=None, -1875 message=None, cache=None, login_hint=None, -1876 device_uri=None): -
1877 """Create a Flow from a clientsecrets file. -1878 -1879 Will create the right kind of Flow based on the contents of the clientsecrets -1880 file or will raise InvalidClientSecretsError for unknown types of Flows. -1881 -1882 Args: -1883 filename: string, File name of client secrets. -1884 scope: string or iterable of strings, scope(s) to request. -1885 redirect_uri: string, Either the string 'urn:ietf:wg:oauth:2.0:oob' for -1886 a non-web-based application, or a URI that handles the callback from -1887 the authorization server. -1888 message: string, A friendly string to display to the user if the -1889 clientsecrets file is missing or invalid. If message is provided then -1890 sys.exit will be called in the case of an error. If message in not -1891 provided then clientsecrets.InvalidClientSecretsError will be raised. -1892 cache: An optional cache service client that implements get() and set() -1893 methods. See clientsecrets.loadfile() for details. -1894 login_hint: string, Either an email address or domain. Passing this hint -1895 will either pre-fill the email box on the sign-in form or select the -1896 proper multi-login session, thereby simplifying the login flow. -1897 device_uri: string, URI for device authorization endpoint. For convenience -1898 defaults to Google's endpoints but any OAuth 2.0 provider can be used. -1899 -1900 Returns: -1901 A Flow object. -1902 -1903 Raises: -1904 UnknownClientSecretsFlowError if the file describes an unknown kind of Flow. -1905 clientsecrets.InvalidClientSecretsError if the clientsecrets file is -1906 invalid. -1907 """ -1908 try: -1909 client_type, client_info = clientsecrets.loadfile(filename, cache=cache) -1910 if client_type in (clientsecrets.TYPE_WEB, clientsecrets.TYPE_INSTALLED): -1911 constructor_kwargs = { -1912 'redirect_uri': redirect_uri, -1913 'auth_uri': client_info['auth_uri'], -1914 'token_uri': client_info['token_uri'], -1915 'login_hint': login_hint, -1916 } -1917 revoke_uri = client_info.get('revoke_uri') -1918 if revoke_uri is not None: -1919 constructor_kwargs['revoke_uri'] = revoke_uri -1920 if device_uri is not None: -1921 constructor_kwargs['device_uri'] = device_uri -1922 return OAuth2WebServerFlow( -1923 client_info['client_id'], client_info['client_secret'], -1924 scope, **constructor_kwargs) -1925 -1926 except clientsecrets.InvalidClientSecretsError: -1927 if message: -1928 sys.exit(message) -1929 else: -1930 raise -1931 else: -1932 raise UnknownClientSecretsFlowError( -1933 'This OAuth 2.0 flow is unsupported: %r' % client_type) -
1934 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.AccessTokenCredentials-class.html b/docs/epy/oauth2client.client.AccessTokenCredentials-class.html deleted file mode 100644 index e05cf83..0000000 --- a/docs/epy/oauth2client.client.AccessTokenCredentials-class.html +++ /dev/null @@ -1,523 +0,0 @@ - - - - - oauth2client.client.AccessTokenCredentials - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class AccessTokenCredentials - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class AccessTokenCredentials

source code

-
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-Credentials object for OAuth 2.0.
-
-Credentials can be applied to an httplib2.Http object using the
-authorize() method, which then signs each request from that object
-with the OAuth 2.0 access token. This set of credentials is for the
-use case where you have acquired an OAuth 2.0 access_token from
-another place such as a JavaScript client or another web
-application, and wish to use it from Python. Because only the
-access_token is present it can not be refreshed and will in time
-expire.
-
-AccessTokenCredentials objects may be safely pickled and unpickled.
-
-Usage:
-  credentials = AccessTokenCredentials('<an access token>',
-    'my-user-agent/1.0')
-  http = httplib2.Http()
-  http = credentials.authorize(http)
-
-Exceptions:
-  AccessTokenCredentialsExpired: raised when the access_token expires or is
-    revoked.
-
-
- - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - access_token, - user_agent, - revoke_uri=None)
- Create an instance of OAuth2Credentials
- source code - -
- -
-   - - - - - - -
_refresh(self, - http_request)
- Refreshes the access_token.
- source code - -
- -
-   - - - - - - -
_revoke(self, - http_request)
- Revokes the access_token and deletes the store if available.
- source code - -
- -
-

Inherited from OAuth2Credentials: - __getstate__, - __setstate__, - access_token_expired, - apply, - authorize, - get_access_token, - refresh, - revoke, - set_store, - to_json -

- -

Inherited from Credentials (private): - _to_json -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-   - - - - - - -
from_json(cls, - s)
- Instantiate a Credentials object from a JSON description of it.
- source code - -
- -
-

Inherited from Credentials: - new_from_json -

-
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-

Inherited from Credentials: - NON_SERIALIZED_MEMBERS -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - access_token, - user_agent, - revoke_uri=None) -
(Constructor) -

-
source code  -
- -
-Create an instance of OAuth2Credentials
-
-This is one of the few types if Credentials that you should contrust,
-Credentials objects are usually instantiated by a Flow.
-
-Args:
-  access_token: string, access token.
-  user_agent: string, The HTTP User-Agent to provide for this application.
-  revoke_uri: string, URI for revoke endpoint. Defaults to None; a token
-    can't be revoked if this is None.
-
-
-
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

from_json(cls, - s) -
Class Method -

-
source code  -
- -
-Instantiate a Credentials object from a JSON description of it. The JSON
-should have been produced by calling .to_json() on the object.
-
-Args:
-  data: dict, A deserialized JSON object.
-
-Returns:
-  An instance of a Credentials subclass.
-
-
-
-
Overrides: - Credentials.from_json -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

_refresh(self, - http_request) -

-
source code  -
- -
-Refreshes the access_token.
-
-This method first checks by reading the Storage object if available.
-If a refresh is still needed, it holds the Storage lock until the
-refresh is completed.
-
-Args:
-  http_request: callable, a callable that matches the method signature of
-    httplib2.Http.request, used to make the refresh request.
-
-Raises:
-  AccessTokenRefreshError: When the refresh fails.
-
-
-
-
Overrides: - OAuth2Credentials._refresh -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

_revoke(self, - http_request) -

-
source code  -
- -
-Revokes the access_token and deletes the store if available.
-
-Args:
-  http_request: callable, a callable that matches the method signature of
-    httplib2.Http.request, used to make the revoke request.
-
-
-
-
Overrides: - OAuth2Credentials._revoke -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.AccessTokenCredentialsError-class.html b/docs/epy/oauth2client.client.AccessTokenCredentialsError-class.html deleted file mode 100644 index 702c4ad..0000000 --- a/docs/epy/oauth2client.client.AccessTokenCredentialsError-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - oauth2client.client.AccessTokenCredentialsError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class AccessTokenCredentialsError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class AccessTokenCredentialsError

source code

-
-
- - - - - - - - - - - - - - - - - - - - -
-
-
-
-Having only the access_token means no refresh is possible.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.AccessTokenRefreshError-class.html b/docs/epy/oauth2client.client.AccessTokenRefreshError-class.html deleted file mode 100644 index 30d0422..0000000 --- a/docs/epy/oauth2client.client.AccessTokenRefreshError-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - oauth2client.client.AccessTokenRefreshError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class AccessTokenRefreshError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class AccessTokenRefreshError

source code

-
-
- - - - - - - - - - - - - - - - - - - - -
-
-
-
-Error trying to refresh an expired access token.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.ApplicationDefaultCredentialsError-class.html b/docs/epy/oauth2client.client.ApplicationDefaultCredentialsError-class.html deleted file mode 100644 index 78bca82..0000000 --- a/docs/epy/oauth2client.client.ApplicationDefaultCredentialsError-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - oauth2client.client.ApplicationDefaultCredentialsError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class ApplicationDefaultCredentialsError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class ApplicationDefaultCredentialsError

source code

-
-
- - - - - - - - - - - - - - - - - - - - -
-
-
-
-Error retrieving the Application Default Credentials.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.AssertionCredentials-class.html b/docs/epy/oauth2client.client.AssertionCredentials-class.html deleted file mode 100644 index 609cd68..0000000 --- a/docs/epy/oauth2client.client.AssertionCredentials-class.html +++ /dev/null @@ -1,508 +0,0 @@ - - - - - oauth2client.client.AssertionCredentials - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class AssertionCredentials - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class AssertionCredentials

source code

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-Abstract Credentials object used for OAuth 2.0 assertion grants.
-
-This credential does not require a flow to instantiate because it
-represents a two legged flow, and therefore has all of the required
-information to generate and refresh its own access tokens. It must
-be subclassed to generate the appropriate assertion string.
-
-AssertionCredentials objects may be safely pickled and unpickled.
-
-
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - assertion_type, - user_agent=None, - token_uri=GOOGLE_TOKEN_URI, - revoke_uri=GOOGLE_REVOKE_URI, - **unused_kwargs)
- Constructor for AssertionFlowCredentials.
- source code - -
- -
-   - - - - - - -
_generate_refresh_request_body(self)
- Generate the body that will be used in the refresh request.
- source code - -
- -
-   - - - - - - -
_generate_assertion(self)
- Generate the assertion string that will be used in the access token -request.
- source code - -
- -
-   - - - - - - -
_revoke(self, - http_request)
- Revokes the access_token and deletes the store if available.
- source code - -
- -
-

Inherited from GoogleCredentials: - create_scoped, - create_scoped_required, - serialization_data -

-

Inherited from OAuth2Credentials: - __getstate__, - __setstate__, - access_token_expired, - apply, - authorize, - get_access_token, - refresh, - revoke, - set_store, - to_json -

- -

Inherited from Credentials (private): - _to_json -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-

Inherited from OAuth2Credentials: - from_json -

-

Inherited from Credentials: - new_from_json -

-
- - - - - - - - - -
- - - - - -
Static Methods[hide private]
-
-

Inherited from GoogleCredentials: - from_stream, - get_application_default -

-
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-

Inherited from Credentials: - NON_SERIALIZED_MEMBERS -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - assertion_type, - user_agent=None, - token_uri=GOOGLE_TOKEN_URI, - revoke_uri=GOOGLE_REVOKE_URI, - **unused_kwargs) -
(Constructor) -

-
source code  -
- -
-Constructor for AssertionFlowCredentials.
-
-Args:
-  assertion_type: string, assertion type that will be declared to the auth
-    server
-  user_agent: string, The HTTP User-Agent to provide for this application.
-  token_uri: string, URI for token endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  revoke_uri: string, URI for revoke endpoint.
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

_generate_refresh_request_body(self) -

-
source code  -
- -
-Generate the body that will be used in the refresh request.
-
-
-
-
Overrides: - OAuth2Credentials._generate_refresh_request_body -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

_revoke(self, - http_request) -

-
source code  -
- -
-Revokes the access_token and deletes the store if available.
-
-Args:
-  http_request: callable, a callable that matches the method signature of
-    httplib2.Http.request, used to make the revoke request.
-
-
-
-
Overrides: - OAuth2Credentials._revoke -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.Credentials-class.html b/docs/epy/oauth2client.client.Credentials-class.html deleted file mode 100644 index 0be0f6c..0000000 --- a/docs/epy/oauth2client.client.Credentials-class.html +++ /dev/null @@ -1,631 +0,0 @@ - - - - - oauth2client.client.Credentials - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class Credentials - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class Credentials

source code

-
-
- - - - - - - - - - - -
-
-
-
-Base class for all Credentials objects.
-
-Subclasses must define an authorize() method that applies the credentials to
-an HTTP transport.
-
-Subclasses must also specify a classmethod named 'from_json' that takes a JSON
-string as input and returns an instantiated Credentials object.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
authorize(self, - http)
- Take an httplib2.Http instance (or equivalent) and authorizes it.
- source code - -
- -
-   - - - - - - -
refresh(self, - http)
- Forces a refresh of the access_token.
- source code - -
- -
-   - - - - - - -
revoke(self, - http)
- Revokes a refresh_token and makes the credentials void.
- source code - -
- -
-   - - - - - - -
apply(self, - headers)
- Add the authorization to the headers.
- source code - -
- -
-   - - - - - - -
_to_json(self, - strip)
- Utility function that creates JSON repr.
- source code - -
- -
-   - - - - - - -
to_json(self)
- Creating a JSON representation of an instance of Credentials.
- source code - -
- -
-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __init__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-   - - - - - - -
new_from_json(cls, - s)
- Utility class method to instantiate a Credentials subclass from a JSON -representation produced by to_json().
- source code - -
- -
-   - - - - - - -
from_json(cls, - unused_data)
- Instantiate a Credentials object from a JSON description of it.
- source code - -
- -
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - NON_SERIALIZED_MEMBERS = ['store'] -
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

authorize(self, - http) -

-
source code  -
- -
-Take an httplib2.Http instance (or equivalent) and authorizes it.
-
-Authorizes it for the set of credentials, usually by replacing
-http.request() with a method that adds in the appropriate headers and then
-delegates to the original Http.request() method.
-
-Args:
-  http: httplib2.Http, an http object to be used to make the refresh
-    request.
-
-
-
-
-
-
- -
- -
- - -
-

refresh(self, - http) -

-
source code  -
- -
-Forces a refresh of the access_token.
-
-Args:
-  http: httplib2.Http, an http object to be used to make the refresh
-    request.
-
-
-
-
-
-
- -
- -
- - -
-

revoke(self, - http) -

-
source code  -
- -
-Revokes a refresh_token and makes the credentials void.
-
-Args:
-  http: httplib2.Http, an http object to be used to make the revoke
-    request.
-
-
-
-
-
-
- -
- -
- - -
-

apply(self, - headers) -

-
source code  -
- -
-Add the authorization to the headers.
-
-Args:
-  headers: dict, the headers to add the Authorization header to.
-
-
-
-
-
-
- -
- -
- - -
-

_to_json(self, - strip) -

-
source code  -
- -
-Utility function that creates JSON repr. of a Credentials object.
-
-Args:
-  strip: array, An array of names of members to not include in the JSON.
-
-Returns:
-   string, a JSON representation of this instance, suitable to pass to
-   from_json().
-
-
-
-
-
-
- -
- -
- - -
-

to_json(self) -

-
source code  -
- -
-Creating a JSON representation of an instance of Credentials.
-
-Returns:
-   string, a JSON representation of this instance, suitable to pass to
-   from_json().
-
-
-
-
-
-
- -
- -
- - -
-

new_from_json(cls, - s) -
Class Method -

-
source code  -
- -
-Utility class method to instantiate a Credentials subclass from a JSON
-representation produced by to_json().
-
-Args:
-  s: string, JSON from to_json().
-
-Returns:
-  An instance of the subclass of Credentials that was serialized with
-  to_json().
-
-
-
-
-
-
- -
- -
- - -
-

from_json(cls, - unused_data) -
Class Method -

-
source code  -
- -
-Instantiate a Credentials object from a JSON description of it.
-
-The JSON should have been produced by calling .to_json() on the object.
-
-Args:
-  unused_data: dict, A deserialized JSON object.
-
-Returns:
-  An instance of a Credentials subclass.
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.CryptoUnavailableError-class.html b/docs/epy/oauth2client.client.CryptoUnavailableError-class.html deleted file mode 100644 index 4750ba7..0000000 --- a/docs/epy/oauth2client.client.CryptoUnavailableError-class.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - oauth2client.client.CryptoUnavailableError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class CryptoUnavailableError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class CryptoUnavailableError

source code

-
-
- - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-Raised when a crypto library is required, but none is available.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.NotImplementedError: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.DeviceFlowInfo-class.html b/docs/epy/oauth2client.client.DeviceFlowInfo-class.html deleted file mode 100644 index aa4ea86..0000000 --- a/docs/epy/oauth2client.client.DeviceFlowInfo-class.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - oauth2client.client.DeviceFlowInfo - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class DeviceFlowInfo - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class DeviceFlowInfo

source code

-
-Intermediate information the OAuth2 for devices flow.
-
-
- - - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-   - - - - - - -
FromResponse(cls, - response)
- Create a DeviceFlowInfo from a server response.
- source code - -
- -
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

FromResponse(cls, - response) -
Class Method -

-
source code  -
- -
-Create a DeviceFlowInfo from a server response.
-
-The response should be a dict containing entries as described
-here:
-  http://tools.ietf.org/html/draft-ietf-oauth-v2-05#section-3.7.1
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.Error-class.html b/docs/epy/oauth2client.client.Error-class.html deleted file mode 100644 index 6629a1d..0000000 --- a/docs/epy/oauth2client.client.Error-class.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - oauth2client.client.Error - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class Error - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class Error

source code

-
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-Base error for this module.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.Flow-class.html b/docs/epy/oauth2client.client.Flow-class.html deleted file mode 100644 index 2a87c9d..0000000 --- a/docs/epy/oauth2client.client.Flow-class.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - oauth2client.client.Flow - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class Flow - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class Flow

source code

-
-
- - - -
-
-
-
-Base class for all Flow objects.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __init__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.FlowExchangeError-class.html b/docs/epy/oauth2client.client.FlowExchangeError-class.html deleted file mode 100644 index 95dac34..0000000 --- a/docs/epy/oauth2client.client.FlowExchangeError-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - oauth2client.client.FlowExchangeError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class FlowExchangeError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class FlowExchangeError

source code

-
-
- - - - - - - - - - - - - - - - - - - - -
-
-
-
-Error trying to exchange an authorization grant for an access token.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.GoogleCredentials-class.html b/docs/epy/oauth2client.client.GoogleCredentials-class.html deleted file mode 100644 index c6995e7..0000000 --- a/docs/epy/oauth2client.client.GoogleCredentials-class.html +++ /dev/null @@ -1,651 +0,0 @@ - - - - - oauth2client.client.GoogleCredentials - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class GoogleCredentials - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class GoogleCredentials

source code

-
-
- - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-Application Default Credentials for use in calling Google APIs.
-
-The Application Default Credentials are being constructed as a function of
-the environment where the code is being run.
-More details can be found on this page:
-https://developers.google.com/accounts/docs/application-default-credentials
-
-Here is an example of how to use the Application Default Credentials for a
-service that requires authentication:
-
-<code>
-from __future__ import print_function  # unnecessary in python3
-from googleapiclient.discovery import build
-from oauth2client.client import GoogleCredentials
-
-PROJECT = 'bamboo-machine-422'  # replace this with one of your projects
-ZONE = 'us-central1-a'          # replace this with the zone you care about
-
-credentials = GoogleCredentials.get_application_default()
-service = build('compute', 'v1', credentials=credentials)
-
-request = service.instances().list(project=PROJECT, zone=ZONE)
-response = request.execute()
-
-print(response)
-</code>
-
-A service that does not require authentication does not need credentials
-to be passed in:
-
-<code>
-from googleapiclient.discovery import build
-
-service = build('discovery', 'v1')
-
-request = service.apis().list()
-response = request.execute()
-
-print(response)
-</code>
-
-
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - access_token, - client_id, - client_secret, - refresh_token, - token_expiry, - token_uri, - user_agent, - revoke_uri=GOOGLE_REVOKE_URI)
- Create an instance of GoogleCredentials.
- source code - -
- -
-   - - - - - - -
create_scoped_required(self)
- Whether this Credentials object is scopeless.
- source code - -
- -
-   - - - - - - -
create_scoped(self, - scopes)
- Create a Credentials object for the given scopes.
- source code - -
- -
-   - - - - - - -
serialization_data(self)
- Get the fields and their values identifying the current credentials.
- source code - -
- -
-

Inherited from OAuth2Credentials: - __getstate__, - __setstate__, - access_token_expired, - apply, - authorize, - get_access_token, - refresh, - revoke, - set_store, - to_json -

- -

Inherited from Credentials (private): - _to_json -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-

Inherited from OAuth2Credentials: - from_json -

-

Inherited from Credentials: - new_from_json -

-
- - - - - - - - - - - - -
- - - - - -
Static Methods[hide private]
-
-   - - - - - - -
get_application_default()
- Get the Application Default Credentials for the current environment.
- source code - -
- -
-   - - - - - - -
from_stream(credential_filename)
- Create a Credentials object by reading the information from a given file.
- source code - -
- -
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-

Inherited from Credentials: - NON_SERIALIZED_MEMBERS -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - access_token, - client_id, - client_secret, - refresh_token, - token_expiry, - token_uri, - user_agent, - revoke_uri=GOOGLE_REVOKE_URI) -
(Constructor) -

-
source code  -
- -
-Create an instance of GoogleCredentials.
-
-This constructor is not usually called by the user, instead
-GoogleCredentials objects are instantiated by
-GoogleCredentials.from_stream() or
-GoogleCredentials.get_application_default().
-
-Args:
-  access_token: string, access token.
-  client_id: string, client identifier.
-  client_secret: string, client secret.
-  refresh_token: string, refresh token.
-  token_expiry: datetime, when the access_token expires.
-  token_uri: string, URI of token endpoint.
-  user_agent: string, The HTTP User-Agent to provide for this application.
-  revoke_uri: string, URI for revoke endpoint.
-    Defaults to GOOGLE_REVOKE_URI; a token can't be revoked if this is None.
-
-
-
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

create_scoped_required(self) -

-
source code  -
- -
-Whether this Credentials object is scopeless.
-
-create_scoped(scopes) method needs to be called in order to create
-a Credentials object for API calls.
-
-
-
-
-
-
- -
- -
- - -
-

create_scoped(self, - scopes) -

-
source code  -
- -
-Create a Credentials object for the given scopes.
-
-The Credentials type is preserved.
-
-
-
-
-
-
- -
- -
- - -
-

serialization_data(self) -

-
source code  -
- -
-Get the fields and their values identifying the current credentials.
-
-
-
-
Decorators:
-
    -
  • @property
  • -
-
-
-
- -
- -
- - -
-

get_application_default() -
Static Method -

-
source code  -
- -
-Get the Application Default Credentials for the current environment.
-
-Exceptions:
-  ApplicationDefaultCredentialsError: raised when the credentials fail
-                                      to be retrieved.
-
-
-
-
-
-
- -
- -
- - -
-

from_stream(credential_filename) -
Static Method -

-
source code  -
- -
-Create a Credentials object by reading the information from a given file.
-
-It returns an object of type GoogleCredentials.
-
-Args:
-  credential_filename: the path to the file from where the credentials
-    are to be read
-
-Exceptions:
-  ApplicationDefaultCredentialsError: raised when the credentials fail
-                                      to be retrieved.
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.MemoryCache-class.html b/docs/epy/oauth2client.client.MemoryCache-class.html deleted file mode 100644 index 207adac..0000000 --- a/docs/epy/oauth2client.client.MemoryCache-class.html +++ /dev/null @@ -1,298 +0,0 @@ - - - - - oauth2client.client.MemoryCache - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class MemoryCache - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class MemoryCache

source code

-
-
- - - - - - - -
-
-
-
-httplib2 Cache implementation which only caches locally.
-
-
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self)
- x.__init__(...) initializes x; see help(type(x)) for signature
- source code - -
- -
-   - - - - - - -
get(self, - key) - source code - -
- -
-   - - - - - - -
set(self, - key, - value) - source code - -
- -
-   - - - - - - -
delete(self, - key) - source code - -
- -
-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self) -
(Constructor) -

-
source code  -
- -
-x.__init__(...) initializes x; see help(type(x)) for signature
-
-
-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.NonAsciiHeaderError-class.html b/docs/epy/oauth2client.client.NonAsciiHeaderError-class.html deleted file mode 100644 index 9b45b38..0000000 --- a/docs/epy/oauth2client.client.NonAsciiHeaderError-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - oauth2client.client.NonAsciiHeaderError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class NonAsciiHeaderError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class NonAsciiHeaderError

source code

-
-
- - - - - - - - - - - - - - - - - - - - -
-
-
-
-Header names and values must be ASCII strings.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.OAuth2Credentials-class.html b/docs/epy/oauth2client.client.OAuth2Credentials-class.html deleted file mode 100644 index 9ea979b..0000000 --- a/docs/epy/oauth2client.client.OAuth2Credentials-class.html +++ /dev/null @@ -1,1138 +0,0 @@ - - - - - oauth2client.client.OAuth2Credentials - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class OAuth2Credentials - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class OAuth2Credentials

source code

-
-
- - - - - - - - - - - - - - - - - - -
-
-
-
-Credentials object for OAuth 2.0.
-
-Credentials can be applied to an httplib2.Http object using the authorize()
-method, which then adds the OAuth 2.0 access token to each request.
-
-OAuth2Credentials objects may be safely pickled and unpickled.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - access_token, - client_id, - client_secret, - refresh_token, - token_expiry, - token_uri, - user_agent, - revoke_uri=None, - id_token=None, - token_response=None)
- Create an instance of OAuth2Credentials.
- source code - -
- -
-   - - - - - - -
authorize(self, - http)
- Authorize an httplib2.Http instance with these credentials.
- source code - -
- -
-   - - - - - - -
refresh(self, - http)
- Forces a refresh of the access_token.
- source code - -
- -
-   - - - - - - -
revoke(self, - http)
- Revokes a refresh_token and makes the credentials void.
- source code - -
- -
-   - - - - - - -
apply(self, - headers)
- Add the authorization to the headers.
- source code - -
- -
-   - - - - - - -
to_json(self)
- Creating a JSON representation of an instance of Credentials.
- source code - -
- -
-   - - - - - - -
access_token_expired(self)
- True if the credential is expired or invalid.
- source code - -
- -
-   - - - - - - -
get_access_token(self, - http=None)
- Return the access token and its expiration information.
- source code - -
- -
-   - - - - - - -
set_store(self, - store)
- Set the Storage for the credential.
- source code - -
- -
-   - - - - - - -
_expires_in(self)
- Return the number of seconds until this token expires.
- source code - -
- -
-   - - - - - - -
_updateFromCredential(self, - other)
- Update this Credential from another instance.
- source code - -
- -
-   - - - - - - -
__getstate__(self)
- Trim the state down to something that can be pickled.
- source code - -
- -
-   - - - - - - -
__setstate__(self, - state)
- Reconstitute the state of the object from being pickled.
- source code - -
- -
-   - - - - - - -
_generate_refresh_request_body(self)
- Generate the body that will be used in the refresh request.
- source code - -
- -
-   - - - - - - -
_generate_refresh_request_headers(self)
- Generate the headers that will be used in the refresh request.
- source code - -
- -
-   - - - - - - -
_refresh(self, - http_request)
- Refreshes the access_token.
- source code - -
- -
-   - - - - - - -
_do_refresh_request(self, - http_request)
- Refresh the access_token using the refresh_token.
- source code - -
- -
-   - - - - - - -
_revoke(self, - http_request)
- Revokes the refresh_token and deletes the store if available.
- source code - -
- -
-   - - - - - - -
_do_revoke(self, - http_request, - token)
- Revokes the credentials and deletes the store if available.
- source code - -
- -
-

Inherited from Credentials (private): - _to_json -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-   - - - - - - -
from_json(cls, - s)
- Instantiate a Credentials object from a JSON description of it.
- source code - -
- -
-

Inherited from Credentials: - new_from_json -

-
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-

Inherited from Credentials: - NON_SERIALIZED_MEMBERS -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - access_token, - client_id, - client_secret, - refresh_token, - token_expiry, - token_uri, - user_agent, - revoke_uri=None, - id_token=None, - token_response=None) -
(Constructor) -

-
source code  -
- -
-Create an instance of OAuth2Credentials.
-
-This constructor is not usually called by the user, instead
-OAuth2Credentials objects are instantiated by the OAuth2WebServerFlow.
-
-Args:
-  access_token: string, access token.
-  client_id: string, client identifier.
-  client_secret: string, client secret.
-  refresh_token: string, refresh token.
-  token_expiry: datetime, when the access_token expires.
-  token_uri: string, URI of token endpoint.
-  user_agent: string, The HTTP User-Agent to provide for this application.
-  revoke_uri: string, URI for revoke endpoint. Defaults to None; a token
-    can't be revoked if this is None.
-  id_token: object, The identity of the resource owner.
-  token_response: dict, the decoded response to the token request. None
-    if a token hasn't been requested yet. Stored because some providers
-    (e.g. wordpress.com) include extra fields that clients may want.
-
-Notes:
-  store: callable, A callable that when passed a Credential
-    will store the credential back to where it came from.
-    This is needed to store the latest access_token if it
-    has expired and been refreshed.
-
-
-
-
Decorators:
-
    -
  • @util.positional(8)
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

authorize(self, - http) -

-
source code  -
- -
-Authorize an httplib2.Http instance with these credentials.
-
-The modified http.request method will add authentication headers to each
-request and will refresh access_tokens when a 401 is received on a
-request. In addition the http.request method has a credentials property,
-http.request.credentials, which is the Credentials object that authorized
-it.
-
-Args:
-   http: An instance of httplib2.Http
-     or something that acts like it.
-
-Returns:
-   A modified instance of http that was passed in.
-
-Example:
-
-  h = httplib2.Http()
-  h = credentials.authorize(h)
-
-You can't create a new OAuth subclass of httplib2.Authentication
-because it never gets passed the absolute URI, which is needed for
-signing. So instead we have to overload 'request' with a closure
-that adds in the Authorization header and then calls the original
-version of 'request()'.
-
-
-
-
Overrides: - Credentials.authorize -
-
-
-
- -
- -
- - -
-

refresh(self, - http) -

-
source code  -
- -
-Forces a refresh of the access_token.
-
-Args:
-  http: httplib2.Http, an http object to be used to make the refresh
-    request.
-
-
-
-
Overrides: - Credentials.refresh -
-
-
-
- -
- -
- - -
-

revoke(self, - http) -

-
source code  -
- -
-Revokes a refresh_token and makes the credentials void.
-
-Args:
-  http: httplib2.Http, an http object to be used to make the revoke
-    request.
-
-
-
-
Overrides: - Credentials.revoke -
-
-
-
- -
- -
- - -
-

apply(self, - headers) -

-
source code  -
- -
-Add the authorization to the headers.
-
-Args:
-  headers: dict, the headers to add the Authorization header to.
-
-
-
-
Overrides: - Credentials.apply -
-
-
-
- -
- -
- - -
-

to_json(self) -

-
source code  -
- -
-Creating a JSON representation of an instance of Credentials.
-
-Returns:
-   string, a JSON representation of this instance, suitable to pass to
-   from_json().
-
-
-
-
Overrides: - Credentials.to_json -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

from_json(cls, - s) -
Class Method -

-
source code  -
- -
-Instantiate a Credentials object from a JSON description of it. The JSON
-should have been produced by calling .to_json() on the object.
-
-Args:
-  data: dict, A deserialized JSON object.
-
-Returns:
-  An instance of a Credentials subclass.
-
-
-
-
Overrides: - Credentials.from_json -
-
-
-
- -
- -
- - -
-

access_token_expired(self) -

-
source code  -
- -
-True if the credential is expired or invalid.
-
-If the token_expiry isn't set, we assume the token doesn't expire.
-
-
-
-
Decorators:
-
    -
  • @property
  • -
-
-
-
- -
- -
- - -
-

get_access_token(self, - http=None) -

-
source code  -
- -
-Return the access token and its expiration information.
-
-If the token does not exist, get one.
-If the token expired, refresh it.
-
-
-
-
-
-
- -
- -
- - -
-

set_store(self, - store) -

-
source code  -
- -
-Set the Storage for the credential.
-
-Args:
-  store: Storage, an implementation of Storage object.
-    This is needed to store the latest access_token if it
-    has expired and been refreshed. This implementation uses
-    locking to check for updates before updating the
-    access_token.
-
-
-
-
-
-
- -
- -
- - -
-

_expires_in(self) -

-
source code  -
- -
-Return the number of seconds until this token expires.
-
-If token_expiry is in the past, this method will return 0, meaning the
-token has already expired.
-If token_expiry is None, this method will return None. Note that returning
-0 in such a case would not be fair: the token may still be valid;
-we just don't know anything about it.
-
-
-
-
-
-
- -
- -
- - -
-

_refresh(self, - http_request) -

-
source code  -
- -
-Refreshes the access_token.
-
-This method first checks by reading the Storage object if available.
-If a refresh is still needed, it holds the Storage lock until the
-refresh is completed.
-
-Args:
-  http_request: callable, a callable that matches the method signature of
-    httplib2.Http.request, used to make the refresh request.
-
-Raises:
-  AccessTokenRefreshError: When the refresh fails.
-
-
-
-
-
-
- -
- -
- - -
-

_do_refresh_request(self, - http_request) -

-
source code  -
- -
-Refresh the access_token using the refresh_token.
-
-Args:
-  http_request: callable, a callable that matches the method signature of
-    httplib2.Http.request, used to make the refresh request.
-
-Raises:
-  AccessTokenRefreshError: When the refresh fails.
-
-
-
-
-
-
- -
- -
- - -
-

_revoke(self, - http_request) -

-
source code  -
- -
-Revokes the refresh_token and deletes the store if available.
-
-Args:
-  http_request: callable, a callable that matches the method signature of
-    httplib2.Http.request, used to make the revoke request.
-
-
-
-
-
-
- -
- -
- - -
-

_do_revoke(self, - http_request, - token) -

-
source code  -
- -
-Revokes the credentials and deletes the store if available.
-
-Args:
-  http_request: callable, a callable that matches the method signature of
-    httplib2.Http.request, used to make the refresh request.
-  token: A string used as the token to be revoked. Can be either an
-    access_token or refresh_token.
-
-Raises:
-  TokenRevokeError: If the revoke request does not return with a 200 OK.
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.OAuth2DeviceCodeError-class.html b/docs/epy/oauth2client.client.OAuth2DeviceCodeError-class.html deleted file mode 100644 index 7acb20d..0000000 --- a/docs/epy/oauth2client.client.OAuth2DeviceCodeError-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - oauth2client.client.OAuth2DeviceCodeError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class OAuth2DeviceCodeError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class OAuth2DeviceCodeError

source code

-
-
- - - - - - - - - - - - - - - - - - - - -
-
-
-
-Error trying to retrieve a device code.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.OAuth2WebServerFlow-class.html b/docs/epy/oauth2client.client.OAuth2WebServerFlow-class.html deleted file mode 100644 index 012a35f..0000000 --- a/docs/epy/oauth2client.client.OAuth2WebServerFlow-class.html +++ /dev/null @@ -1,473 +0,0 @@ - - - - - oauth2client.client.OAuth2WebServerFlow - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class OAuth2WebServerFlow - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class OAuth2WebServerFlow

source code

-
-
- - - - - - - - -
-
-
-
-Does the Web Server Flow for OAuth 2.0.
-
-OAuth2WebServerFlow objects may be safely pickled and unpickled.
-
-
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - client_id, - client_secret, - scope, - redirect_uri=None, - user_agent=None, - auth_uri=GOOGLE_AUTH_URI, - token_uri=GOOGLE_TOKEN_URI, - revoke_uri=GOOGLE_REVOKE_URI, - login_hint=None, - device_uri=GOOGLE_DEVICE_URI, - **kwargs)
- Constructor for OAuth2WebServerFlow.
- source code - -
- -
-   - - - - - - -
step1_get_authorize_url(self, - redirect_uri=None)
- Returns a URI to redirect to the provider.
- source code - -
- -
-   - - - - - - -
step1_get_device_and_user_codes(self, - http=None)
- Returns a user code and the verification URL where to enter it
- source code - -
- -
-   - - - - - - -
step2_exchange(self, - code=None, - http=None, - device_flow_info=None)
- Exchanges a code for OAuth2Credentials.
- source code - -
- -
-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - client_id, - client_secret, - scope, - redirect_uri=None, - user_agent=None, - auth_uri=GOOGLE_AUTH_URI, - token_uri=GOOGLE_TOKEN_URI, - revoke_uri=GOOGLE_REVOKE_URI, - login_hint=None, - device_uri=GOOGLE_DEVICE_URI, - **kwargs) -
(Constructor) -

-
source code  -
- -
-Constructor for OAuth2WebServerFlow.
-
-The kwargs argument is used to set extra query parameters on the
-auth_uri. For example, the access_type and approval_prompt
-query parameters can be set via kwargs.
-
-Args:
-  client_id: string, client identifier.
-  client_secret: string client secret.
-  scope: string or iterable of strings, scope(s) of the credentials being
-    requested.
-  redirect_uri: string, Either the string 'urn:ietf:wg:oauth:2.0:oob' for
-    a non-web-based application, or a URI that handles the callback from
-    the authorization server.
-  user_agent: string, HTTP User-Agent to provide for this application.
-  auth_uri: string, URI for authorization endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  token_uri: string, URI for token endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  revoke_uri: string, URI for revoke endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  login_hint: string, Either an email address or domain. Passing this hint
-    will either pre-fill the email box on the sign-in form or select the
-    proper multi-login session, thereby simplifying the login flow.
-  device_uri: string, URI for device authorization endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  **kwargs: dict, The keyword arguments are all optional and required
-                    parameters for the OAuth calls.
-
-
-
-
Decorators:
-
    -
  • @util.positional(4)
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

step1_get_authorize_url(self, - redirect_uri=None) -

-
source code  -
- -
-Returns a URI to redirect to the provider.
-
-Args:
-  redirect_uri: string, Either the string 'urn:ietf:wg:oauth:2.0:oob' for
-    a non-web-based application, or a URI that handles the callback from
-    the authorization server. This parameter is deprecated, please move to
-    passing the redirect_uri in via the constructor.
-
-Returns:
-  A URI as a string to redirect the user to begin the authorization flow.
-
-
-
-
Decorators:
-
    -
  • @util.positional(1)
  • -
-
-
-
- -
- -
- - -
-

step1_get_device_and_user_codes(self, - http=None) -

-
source code  -
- -
-Returns a user code and the verification URL where to enter it
-
-Returns:
-  A user code as a string for the user to authorize the application
-  An URL as a string where the user has to enter the code
-
-
-
-
Decorators:
-
    -
  • @util.positional(1)
  • -
-
-
-
- -
- -
- - -
-

step2_exchange(self, - code=None, - http=None, - device_flow_info=None) -

-
source code  -
- -
-Exchanges a code for OAuth2Credentials.
-
-Args:
-
-  code: string, a dict-like object, or None. For a non-device
-      flow, this is either the response code as a string, or a
-      dictionary of query parameters to the redirect_uri. For a
-      device flow, this should be None.
-  http: httplib2.Http, optional http instance to use when fetching
-      credentials.
-  device_flow_info: DeviceFlowInfo, return value from step1 in the
-      case of a device flow.
-
-Returns:
-  An OAuth2Credentials object that can be used to authorize requests.
-
-Raises:
-  FlowExchangeError: if a problem occurred exchanging the code for a
-      refresh_token.
-  ValueError: if code and device_flow_info are both provided or both
-      missing.
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.SignedJwtAssertionCredentials-class.html b/docs/epy/oauth2client.client.SignedJwtAssertionCredentials-class.html deleted file mode 100644 index 6cb7de4..0000000 --- a/docs/epy/oauth2client.client.SignedJwtAssertionCredentials-class.html +++ /dev/null @@ -1,520 +0,0 @@ - - - - - oauth2client.client.SignedJwtAssertionCredentials - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class SignedJwtAssertionCredentials - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class SignedJwtAssertionCredentials

source code

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-Credentials object used for OAuth 2.0 Signed JWT assertion grants.
-
-This credential does not require a flow to instantiate because it
-represents a two legged flow, and therefore has all of the required
-information to generate and refresh its own access tokens.
-
-SignedJwtAssertionCredentials requires either PyOpenSSL, or PyCrypto
-2.6 or later. For App Engine you may also consider using
-AppAssertionCredentials.
-
-
- - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - service_account_name, - private_key, - scope, - private_key_password='notasecret', - user_agent=None, - token_uri=GOOGLE_TOKEN_URI, - revoke_uri=GOOGLE_REVOKE_URI, - **kwargs)
- Constructor for SignedJwtAssertionCredentials.
- source code - -
- -
-   - - - - - - -
_generate_assertion(self)
- Generate the assertion that will be used in the request.
- source code - -
- -
- -

Inherited from GoogleCredentials: - create_scoped, - create_scoped_required, - serialization_data -

-

Inherited from OAuth2Credentials: - __getstate__, - __setstate__, - access_token_expired, - apply, - authorize, - get_access_token, - refresh, - revoke, - set_store, - to_json -

- -

Inherited from Credentials (private): - _to_json -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-   - - - - - - -
from_json(cls, - s)
- Instantiate a Credentials object from a JSON description of it.
- source code - -
- -
-

Inherited from Credentials: - new_from_json -

-
- - - - - - - - - -
- - - - - -
Static Methods[hide private]
-
-

Inherited from GoogleCredentials: - from_stream, - get_application_default -

-
- - - - - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - MAX_TOKEN_LIFETIME_SECS = 3600 -
-

Inherited from Credentials: - NON_SERIALIZED_MEMBERS -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - service_account_name, - private_key, - scope, - private_key_password='notasecret', - user_agent=None, - token_uri=GOOGLE_TOKEN_URI, - revoke_uri=GOOGLE_REVOKE_URI, - **kwargs) -
(Constructor) -

-
source code  -
- -
-Constructor for SignedJwtAssertionCredentials.
-
-Args:
-  service_account_name: string, id for account, usually an email address.
-  private_key: string, private key in PKCS12 or PEM format.
-  scope: string or iterable of strings, scope(s) of the credentials being
-    requested.
-  private_key_password: string, password for private_key, unused if
-    private_key is in PEM format.
-  user_agent: string, HTTP User-Agent to provide for this application.
-  token_uri: string, URI for token endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  revoke_uri: string, URI for revoke endpoint.
-  kwargs: kwargs, Additional parameters to add to the JWT token, for
-    example sub=joe@xample.org.
-
-Raises:
-  CryptoUnavailableError if no crypto library is available.
-
-
-
-
Decorators:
-
    -
  • @util.positional(4)
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

from_json(cls, - s) -
Class Method -

-
source code  -
- -
-Instantiate a Credentials object from a JSON description of it. The JSON
-should have been produced by calling .to_json() on the object.
-
-Args:
-  data: dict, A deserialized JSON object.
-
-Returns:
-  An instance of a Credentials subclass.
-
-
-
-
Overrides: - Credentials.from_json -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

_generate_assertion(self) -

-
source code  -
- -
-Generate the assertion that will be used in the request.
-
-
-
-
Overrides: - AssertionCredentials._generate_assertion -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.Storage-class.html b/docs/epy/oauth2client.client.Storage-class.html deleted file mode 100644 index e74778b..0000000 --- a/docs/epy/oauth2client.client.Storage-class.html +++ /dev/null @@ -1,560 +0,0 @@ - - - - - oauth2client.client.Storage - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class Storage - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class Storage

source code

-
-
- - - - - - - - - - - -
-
-
-
-Base class for all Storage objects.
-
-Store and retrieve a single credential. This class supports locking
-such that multiple processes and threads can operate on a single
-store.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
acquire_lock(self)
- Acquires any lock necessary to access this Storage.
- source code - -
- -
-   - - - - - - -
release_lock(self)
- Release the Storage lock.
- source code - -
- -
-   - - - - - - -
locked_get(self)
- Retrieve credential.
- source code - -
- -
-   - - - - - - -
locked_put(self, - credentials)
- Write a credential.
- source code - -
- -
-   - - - - - - -
locked_delete(self)
- Delete a credential.
- source code - -
- -
-   - - - - - - -
get(self)
- Retrieve credential.
- source code - -
- -
-   - - - - - - -
put(self, - credentials)
- Write a credential.
- source code - -
- -
-   - - - - - - -
delete(self)
- Delete credential.
- source code - -
- -
-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __init__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

acquire_lock(self) -

-
source code  -
- -
-Acquires any lock necessary to access this Storage.
-
-This lock is not reentrant.
-
-
-
-
-
-
- -
- -
- - -
-

release_lock(self) -

-
source code  -
- -
-Release the Storage lock.
-
-Trying to release a lock that isn't held will result in a
-RuntimeError.
-
-
-
-
-
-
- -
- -
- - -
-

locked_get(self) -

-
source code  -
- -
-Retrieve credential.
-
-The Storage lock must be held when this is called.
-
-Returns:
-  oauth2client.client.Credentials
-
-
-
-
-
-
- -
- -
- - -
-

locked_put(self, - credentials) -

-
source code  -
- -
-Write a credential.
-
-The Storage lock must be held when this is called.
-
-Args:
-  credentials: Credentials, the credentials to store.
-
-
-
-
-
-
- -
- -
- - -
-

locked_delete(self) -

-
source code  -
- -
-Delete a credential.
-
-The Storage lock must be held when this is called.
-
-
-
-
-
-
- -
- -
- - -
-

get(self) -

-
source code  -
- -
-Retrieve credential.
-
-The Storage lock must *not* be held when this is called.
-
-Returns:
-  oauth2client.client.Credentials
-
-
-
-
-
-
- -
- -
- - -
-

put(self, - credentials) -

-
source code  -
- -
-Write a credential.
-
-The Storage lock must be held when this is called.
-
-Args:
-  credentials: Credentials, the credentials to store.
-
-
-
-
-
-
- -
- -
- - -
-

delete(self) -

-
source code  -
- -
-Delete credential.
-
-Frees any resources associated with storing the credential.
-The Storage lock must *not* be held when this is called.
-
-Returns:
-  None
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.TokenRevokeError-class.html b/docs/epy/oauth2client.client.TokenRevokeError-class.html deleted file mode 100644 index 63cf9e0..0000000 --- a/docs/epy/oauth2client.client.TokenRevokeError-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - oauth2client.client.TokenRevokeError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class TokenRevokeError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class TokenRevokeError

source code

-
-
- - - - - - - - - - - - - - - - - - - - -
-
-
-
-Error trying to revoke a token.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.UnknownClientSecretsFlowError-class.html b/docs/epy/oauth2client.client.UnknownClientSecretsFlowError-class.html deleted file mode 100644 index 897d8ff..0000000 --- a/docs/epy/oauth2client.client.UnknownClientSecretsFlowError-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - oauth2client.client.UnknownClientSecretsFlowError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class UnknownClientSecretsFlowError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class UnknownClientSecretsFlowError

source code

-
-
- - - - - - - - - - - - - - - - - - - - -
-
-
-
-The client secrets file called for an unknown type of OAuth 2.0 flow. 
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.client.VerifyJwtTokenError-class.html b/docs/epy/oauth2client.client.VerifyJwtTokenError-class.html deleted file mode 100644 index b0c102f..0000000 --- a/docs/epy/oauth2client.client.VerifyJwtTokenError-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - oauth2client.client.VerifyJwtTokenError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module client :: - Class VerifyJwtTokenError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class VerifyJwtTokenError

source code

-
-
- - - - - - - - - - - - - - - - - - - - -
-
-
-
-Could not retrieve certificates for validation.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.clientsecrets-module.html b/docs/epy/oauth2client.clientsecrets-module.html deleted file mode 100644 index eaa6e76..0000000 --- a/docs/epy/oauth2client.clientsecrets-module.html +++ /dev/null @@ -1,404 +0,0 @@ - - - - - oauth2client.clientsecrets - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module clientsecrets - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module clientsecrets

source code

-
-Utilities for reading OAuth 2.0 client secret files.
-
-A client_secrets.json file contains all the information needed to interact with
-an OAuth 2.0 protected service.
-
-
- -
-

Author: - jcgregorio@google.com (Joe Gregorio) -

-
- - - - - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - Error
- Base error for this module. -
-   - - InvalidClientSecretsError
- Format of ClientSecrets file is invalid. -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Functions[hide private]
-
-   - - - - - - -
_validate_clientsecrets(obj) - source code - -
- -
-   - - - - - - -
load(fp) - source code - -
- -
-   - - - - - - -
loads(s) - source code - -
- -
-   - - - - - - -
_loadfile(filename) - source code - -
- -
-   - - - - - - -
loadfile(filename, - cache=None)
- Loading of client_secrets JSON file, optionally backed by a cache.
- source code - -
- -
- - - - - - - - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - TYPE_WEB = 'web' -
-   - - TYPE_INSTALLED = 'installed' -
-   - - VALID_CLIENT = {TYPE_WEB: {'required': ['client_id', 'client_s... -
- - - - - - -
- - - - - -
Function Details[hide private]
-
- -
- -
- - -
-

loadfile(filename, - cache=None) -

-
source code  -
- -
-Loading of client_secrets JSON file, optionally backed by a cache.
-
-Typical cache storage would be App Engine memcache service,
-but you can pass in any other cache client that implements
-these methods:
-  - get(key, namespace=ns)
-  - set(key, value, namespace=ns)
-
-Usage:
-  # without caching
-  client_type, client_info = loadfile('secrets.json')
-  # using App Engine memcache service
-  from google.appengine.api import memcache
-  client_type, client_info = loadfile('secrets.json', cache=memcache)
-
-Args:
-  filename: string, Path to a client_secrets.json file on a filesystem.
-  cache: An optional cache service client that implements get() and set()
-    methods. If not specified, the file is always being loaded from
-    a filesystem.
-
-Raises:
-  InvalidClientSecretsError: In case of a validation error or some
-    I/O failure. Can happen only on cache miss.
-
-Returns:
-  (client_type, client_info) tuple, as _loadfile() normally would.
-  JSON contents is validated only during first load. Cache hits are not
-  validated.
-
-
-
-
-
-
-
- - - - - - -
- - - - - -
Variables Details[hide private]
-
- -
- -
-

VALID_CLIENT

- -
-
-
-
Value:
-
-{TYPE_WEB: {'required': ['client_id', 'client_secret', 'redirect_uris'\
-, 'auth_uri', 'token_uri',], 'string': ['client_id', 'client_secret',]\
-,}, TYPE_INSTALLED: {'required': ['client_id', 'client_secret', 'redir\
-ect_uris', 'auth_uri', 'token_uri',], 'string': ['client_id', 'client_\
-secret',],},}
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.clientsecrets-pysrc.html b/docs/epy/oauth2client.clientsecrets-pysrc.html deleted file mode 100644 index 1e2c816..0000000 --- a/docs/epy/oauth2client.clientsecrets-pysrc.html +++ /dev/null @@ -1,274 +0,0 @@ - - - - - oauth2client.clientsecrets - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module clientsecrets - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.clientsecrets

-
-  1  # Copyright 2014 Google Inc. All rights reserved. 
-  2  # 
-  3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  4  # you may not use this file except in compliance with the License. 
-  5  # You may obtain a copy of the License at 
-  6  # 
-  7  #      http://www.apache.org/licenses/LICENSE-2.0 
-  8  # 
-  9  # Unless required by applicable law or agreed to in writing, software 
- 10  # distributed under the License is distributed on an "AS IS" BASIS, 
- 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 12  # See the License for the specific language governing permissions and 
- 13  # limitations under the License. 
- 14   
- 15  """Utilities for reading OAuth 2.0 client secret files. 
- 16   
- 17  A client_secrets.json file contains all the information needed to interact with 
- 18  an OAuth 2.0 protected service. 
- 19  """ 
- 20   
- 21  __author__ = 'jcgregorio@google.com (Joe Gregorio)' 
- 22   
- 23  import json 
- 24  import six 
- 25   
- 26   
- 27  # Properties that make a client_secrets.json file valid. 
- 28  TYPE_WEB = 'web' 
- 29  TYPE_INSTALLED = 'installed' 
- 30   
- 31  VALID_CLIENT = { 
- 32      TYPE_WEB: { 
- 33          'required': [ 
- 34              'client_id', 
- 35              'client_secret', 
- 36              'redirect_uris', 
- 37              'auth_uri', 
- 38              'token_uri', 
- 39          ], 
- 40          'string': [ 
- 41              'client_id', 
- 42              'client_secret', 
- 43          ], 
- 44      }, 
- 45      TYPE_INSTALLED: { 
- 46          'required': [ 
- 47              'client_id', 
- 48              'client_secret', 
- 49              'redirect_uris', 
- 50              'auth_uri', 
- 51              'token_uri', 
- 52          ], 
- 53          'string': [ 
- 54              'client_id', 
- 55              'client_secret', 
- 56          ], 
- 57      }, 
- 58  } 
- 59   
- 60   
-
61 -class Error(Exception): -
62 """Base error for this module.""" - 63 pass -
64 - 65 -
66 -class InvalidClientSecretsError(Error): -
67 """Format of ClientSecrets file is invalid.""" - 68 pass -
69 - 70 -
71 -def _validate_clientsecrets(obj): -
72 if obj is None or len(obj) != 1: - 73 raise InvalidClientSecretsError('Invalid file format.') - 74 client_type = tuple(obj)[0] - 75 if client_type not in VALID_CLIENT: - 76 raise InvalidClientSecretsError('Unknown client type: %s.' % (client_type,)) - 77 client_info = obj[client_type] - 78 for prop_name in VALID_CLIENT[client_type]['required']: - 79 if prop_name not in client_info: - 80 raise InvalidClientSecretsError( - 81 'Missing property "%s" in a client type of "%s".' % (prop_name, - 82 client_type)) - 83 for prop_name in VALID_CLIENT[client_type]['string']: - 84 if client_info[prop_name].startswith('[['): - 85 raise InvalidClientSecretsError( - 86 'Property "%s" is not configured.' % prop_name) - 87 return client_type, client_info -
88 - 89 -
90 -def load(fp): -
91 obj = json.load(fp) - 92 return _validate_clientsecrets(obj) -
93 - 94 -
95 -def loads(s): -
96 obj = json.loads(s) - 97 return _validate_clientsecrets(obj) -
98 - 99 -
100 -def _loadfile(filename): -
101 try: -102 with open(filename, 'r') as fp: -103 obj = json.load(fp) -104 except IOError: -105 raise InvalidClientSecretsError('File not found: "%s"' % filename) -106 return _validate_clientsecrets(obj) -
107 -108 -
109 -def loadfile(filename, cache=None): -
110 """Loading of client_secrets JSON file, optionally backed by a cache. -111 -112 Typical cache storage would be App Engine memcache service, -113 but you can pass in any other cache client that implements -114 these methods: -115 - get(key, namespace=ns) -116 - set(key, value, namespace=ns) -117 -118 Usage: -119 # without caching -120 client_type, client_info = loadfile('secrets.json') -121 # using App Engine memcache service -122 from google.appengine.api import memcache -123 client_type, client_info = loadfile('secrets.json', cache=memcache) -124 -125 Args: -126 filename: string, Path to a client_secrets.json file on a filesystem. -127 cache: An optional cache service client that implements get() and set() -128 methods. If not specified, the file is always being loaded from -129 a filesystem. -130 -131 Raises: -132 InvalidClientSecretsError: In case of a validation error or some -133 I/O failure. Can happen only on cache miss. -134 -135 Returns: -136 (client_type, client_info) tuple, as _loadfile() normally would. -137 JSON contents is validated only during first load. Cache hits are not -138 validated. -139 """ -140 _SECRET_NAMESPACE = 'oauth2client:secrets#ns' -141 -142 if not cache: -143 return _loadfile(filename) -144 -145 obj = cache.get(filename, namespace=_SECRET_NAMESPACE) -146 if obj is None: -147 client_type, client_info = _loadfile(filename) -148 obj = {client_type: client_info} -149 cache.set(filename, obj, namespace=_SECRET_NAMESPACE) -150 -151 return next(six.iteritems(obj)) -
152 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.clientsecrets.Error-class.html b/docs/epy/oauth2client.clientsecrets.Error-class.html deleted file mode 100644 index 9d770e5..0000000 --- a/docs/epy/oauth2client.clientsecrets.Error-class.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - oauth2client.clientsecrets.Error - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module clientsecrets :: - Class Error - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class Error

source code

-
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-Base error for this module.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.clientsecrets.InvalidClientSecretsError-class.html b/docs/epy/oauth2client.clientsecrets.InvalidClientSecretsError-class.html deleted file mode 100644 index 9244853..0000000 --- a/docs/epy/oauth2client.clientsecrets.InvalidClientSecretsError-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - oauth2client.clientsecrets.InvalidClientSecretsError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module clientsecrets :: - Class InvalidClientSecretsError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class InvalidClientSecretsError

source code

-
-
- - - - - - - - - - - - - - - - - - - - -
-
-
-
-Format of ClientSecrets file is invalid.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.crypt-module.html b/docs/epy/oauth2client.crypt-module.html deleted file mode 100644 index 3f70fe0..0000000 --- a/docs/epy/oauth2client.crypt-module.html +++ /dev/null @@ -1,462 +0,0 @@ - - - - - oauth2client.crypt - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module crypt - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module crypt

source code

-
-Crypto-related routines for oauth2client.
-
-
- - - - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - AppIdentityError -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Functions[hide private]
-
-   - - - - - - -
_parse_pem_key(raw_key_input)
- Identify and extract PEM keys.
- source code - -
- -
-   - - - - - - -
_urlsafe_b64encode(raw_bytes) - source code - -
- -
-   - - - - - - -
_urlsafe_b64decode(b64string) - source code - -
- -
-   - - - - - - -
_json_encode(data) - source code - -
- -
-   - - - - - - -
make_signed_jwt(signer, - payload)
- Make a signed JWT.
- source code - -
- -
-   - - - - - - -
verify_signed_jwt_with_certs(jwt, - certs, - audience)
- Verify a JWT against public certs.
- source code - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - CLOCK_SKEW_SECS = 300 -
-   - - AUTH_TOKEN_LIFETIME_SECS = 300 -
-   - - MAX_TOKEN_LIFETIME_SECS = 86400 -
-   - - logger = logging.getLogger(__name__) -
-   - - OpenSSLVerifier = None -
-   - - OpenSSLSigner = None -
-   - - PyCryptoVerifier = None -
-   - - PyCryptoSigner = None -
-   - - Signer = None -
-   - - Verifier = None -
- - - - - - -
- - - - - -
Function Details[hide private]
-
- -
- -
- - -
-

_parse_pem_key(raw_key_input) -

-
source code  -
- -
-Identify and extract PEM keys.
-
-Determines whether the given key is in the format of PEM key, and extracts
-the relevant part of the key if it is.
-
-Args:
-  raw_key_input: The contents of a private key file (either PEM or PKCS12).
-
-Returns:
-  string, The actual key if the contents are from a PEM file, or else None.
-
-
-
-
-
-
- -
- -
- - -
-

make_signed_jwt(signer, - payload) -

-
source code  -
- -
-Make a signed JWT.
-
-See http://self-issued.info/docs/draft-jones-json-web-token.html.
-
-Args:
-  signer: crypt.Signer, Cryptographic signer.
-  payload: dict, Dictionary of data to convert to JSON and then sign.
-
-Returns:
-  string, The JWT for the payload.
-
-
-
-
-
-
- -
- -
- - -
-

verify_signed_jwt_with_certs(jwt, - certs, - audience) -

-
source code  -
- -
-Verify a JWT against public certs.
-
-See http://self-issued.info/docs/draft-jones-json-web-token.html.
-
-Args:
-  jwt: string, A JWT.
-  certs: dict, Dictionary where values of public keys in PEM format.
-  audience: string, The audience, 'aud', that this JWT should contain. If
-    None then the JWT's 'aud' parameter is not verified.
-
-Returns:
-  dict, The deserialized JSON payload in the JWT.
-
-Raises:
-  AppIdentityError if any checks are failed.
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.crypt-pysrc.html b/docs/epy/oauth2client.crypt-pysrc.html deleted file mode 100644 index 5736e7d..0000000 --- a/docs/epy/oauth2client.crypt-pysrc.html +++ /dev/null @@ -1,545 +0,0 @@ - - - - - oauth2client.crypt - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module crypt - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.crypt

-
-  1  # -*- coding: utf-8 -*- 
-  2  # 
-  3  # Copyright 2014 Google Inc. All rights reserved. 
-  4  # 
-  5  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  6  # you may not use this file except in compliance with the License. 
-  7  # You may obtain a copy of the License at 
-  8  # 
-  9  #      http://www.apache.org/licenses/LICENSE-2.0 
- 10  # 
- 11  # Unless required by applicable law or agreed to in writing, software 
- 12  # distributed under the License is distributed on an "AS IS" BASIS, 
- 13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 14  # See the License for the specific language governing permissions and 
- 15  # limitations under the License. 
- 16  """Crypto-related routines for oauth2client.""" 
- 17   
- 18  import base64 
- 19  import json 
- 20  import logging 
- 21  import sys 
- 22  import time 
- 23   
- 24  import six 
- 25   
- 26   
- 27  CLOCK_SKEW_SECS = 300  # 5 minutes in seconds 
- 28  AUTH_TOKEN_LIFETIME_SECS = 300  # 5 minutes in seconds 
- 29  MAX_TOKEN_LIFETIME_SECS = 86400  # 1 day in seconds 
- 30   
- 31   
- 32  logger = logging.getLogger(__name__) 
-
33 - 34 - 35 -class AppIdentityError(Exception): -
36 pass -
37 - 38 - 39 try: - 40 from OpenSSL import crypto -
41 - 42 - class OpenSSLVerifier(object): -
43 """Verifies the signature on a message.""" - 44 -
45 - def __init__(self, pubkey): -
46 """Constructor. - 47 - 48 Args: - 49 pubkey, OpenSSL.crypto.PKey, The public key to verify with. - 50 """ - 51 self._pubkey = pubkey -
52 -
53 - def verify(self, message, signature): -
54 """Verifies a message against a signature. - 55 - 56 Args: - 57 message: string, The message to verify. - 58 signature: string, The signature on the message. - 59 - 60 Returns: - 61 True if message was signed by the private key associated with the public - 62 key that this object was constructed with. - 63 """ - 64 try: - 65 if isinstance(message, six.text_type): - 66 message = message.encode('utf-8') - 67 crypto.verify(self._pubkey, signature, message, 'sha256') - 68 return True - 69 except: - 70 return False -
71 - 72 @staticmethod -
73 - def from_string(key_pem, is_x509_cert): -
74 """Construct a Verified instance from a string. - 75 - 76 Args: - 77 key_pem: string, public key in PEM format. - 78 is_x509_cert: bool, True if key_pem is an X509 cert, otherwise it is - 79 expected to be an RSA key in PEM format. - 80 - 81 Returns: - 82 Verifier instance. - 83 - 84 Raises: - 85 OpenSSL.crypto.Error if the key_pem can't be parsed. - 86 """ - 87 if is_x509_cert: - 88 pubkey = crypto.load_certificate(crypto.FILETYPE_PEM, key_pem) - 89 else: - 90 pubkey = crypto.load_privatekey(crypto.FILETYPE_PEM, key_pem) - 91 return OpenSSLVerifier(pubkey) -
92 -
93 - 94 - class OpenSSLSigner(object): -
95 """Signs messages with a private key.""" - 96 -
97 - def __init__(self, pkey): -
98 """Constructor. - 99 -100 Args: -101 pkey, OpenSSL.crypto.PKey (or equiv), The private key to sign with. -102 """ -103 self._key = pkey -
104 -
105 - def sign(self, message): -
106 """Signs a message. -107 -108 Args: -109 message: bytes, Message to be signed. -110 -111 Returns: -112 string, The signature of the message for the given key. -113 """ -114 if isinstance(message, six.text_type): -115 message = message.encode('utf-8') -116 return crypto.sign(self._key, message, 'sha256') -
117 -118 @staticmethod -
119 - def from_string(key, password=b'notasecret'): -
120 """Construct a Signer instance from a string. -121 -122 Args: -123 key: string, private key in PKCS12 or PEM format. -124 password: string, password for the private key file. -125 -126 Returns: -127 Signer instance. -128 -129 Raises: -130 OpenSSL.crypto.Error if the key can't be parsed. -131 """ -132 parsed_pem_key = _parse_pem_key(key) -133 if parsed_pem_key: -134 pkey = crypto.load_privatekey(crypto.FILETYPE_PEM, parsed_pem_key) -135 else: -136 if isinstance(password, six.text_type): -137 password = password.encode('utf-8') -138 pkey = crypto.load_pkcs12(key, password).get_privatekey() -139 return OpenSSLSigner(pkey) -
140 -141 except ImportError: -142 OpenSSLVerifier = None -143 OpenSSLSigner = None -144 -145 -146 try: -147 from Crypto.PublicKey import RSA -148 from Crypto.Hash import SHA256 -149 from Crypto.Signature import PKCS1_v1_5 -150 from Crypto.Util.asn1 import DerSequence -
151 -152 -153 - class PyCryptoVerifier(object): -
154 """Verifies the signature on a message.""" -155 -
156 - def __init__(self, pubkey): -
157 """Constructor. -158 -159 Args: -160 pubkey, OpenSSL.crypto.PKey (or equiv), The public key to verify with. -161 """ -162 self._pubkey = pubkey -
163 -
164 - def verify(self, message, signature): -
165 """Verifies a message against a signature. -166 -167 Args: -168 message: string, The message to verify. -169 signature: string, The signature on the message. -170 -171 Returns: -172 True if message was signed by the private key associated with the public -173 key that this object was constructed with. -174 """ -175 try: -176 return PKCS1_v1_5.new(self._pubkey).verify( -177 SHA256.new(message), signature) -178 except: -179 return False -
180 -181 @staticmethod -
182 - def from_string(key_pem, is_x509_cert): -
183 """Construct a Verified instance from a string. -184 -185 Args: -186 key_pem: string, public key in PEM format. -187 is_x509_cert: bool, True if key_pem is an X509 cert, otherwise it is -188 expected to be an RSA key in PEM format. -189 -190 Returns: -191 Verifier instance. -192 """ -193 if is_x509_cert: -194 if isinstance(key_pem, six.text_type): -195 key_pem = key_pem.encode('ascii') -196 pemLines = key_pem.replace(b' ', b'').split() -197 certDer = _urlsafe_b64decode(b''.join(pemLines[1:-1])) -198 certSeq = DerSequence() -199 certSeq.decode(certDer) -200 tbsSeq = DerSequence() -201 tbsSeq.decode(certSeq[0]) -202 pubkey = RSA.importKey(tbsSeq[6]) -203 else: -204 pubkey = RSA.importKey(key_pem) -205 return PyCryptoVerifier(pubkey) -
206 -
207 -208 - class PyCryptoSigner(object): -
209 """Signs messages with a private key.""" -210 -
211 - def __init__(self, pkey): -
212 """Constructor. -213 -214 Args: -215 pkey, OpenSSL.crypto.PKey (or equiv), The private key to sign with. -216 """ -217 self._key = pkey -
218 -
219 - def sign(self, message): -
220 """Signs a message. -221 -222 Args: -223 message: string, Message to be signed. -224 -225 Returns: -226 string, The signature of the message for the given key. -227 """ -228 if isinstance(message, six.text_type): -229 message = message.encode('utf-8') -230 return PKCS1_v1_5.new(self._key).sign(SHA256.new(message)) -
231 -232 @staticmethod -
233 - def from_string(key, password='notasecret'): -
234 """Construct a Signer instance from a string. -235 -236 Args: -237 key: string, private key in PEM format. -238 password: string, password for private key file. Unused for PEM files. -239 -240 Returns: -241 Signer instance. -242 -243 Raises: -244 NotImplementedError if they key isn't in PEM format. -245 """ -246 parsed_pem_key = _parse_pem_key(key) -247 if parsed_pem_key: -248 pkey = RSA.importKey(parsed_pem_key) -249 else: -250 raise NotImplementedError( -251 'PKCS12 format is not supported by the PyCrypto library. ' -252 'Try converting to a "PEM" ' -253 '(openssl pkcs12 -in xxxxx.p12 -nodes -nocerts > privatekey.pem) ' -254 'or using PyOpenSSL if native code is an option.') -255 return PyCryptoSigner(pkey) -
256 -257 except ImportError: -258 PyCryptoVerifier = None -259 PyCryptoSigner = None -260 -261 -262 if OpenSSLSigner: -263 Signer = OpenSSLSigner -264 Verifier = OpenSSLVerifier -265 elif PyCryptoSigner: -266 Signer = PyCryptoSigner -267 Verifier = PyCryptoVerifier -268 else: -269 raise ImportError('No encryption library found. Please install either ' -270 'PyOpenSSL, or PyCrypto 2.6 or later') -
271 -272 -273 -def _parse_pem_key(raw_key_input): -
274 """Identify and extract PEM keys. -275 -276 Determines whether the given key is in the format of PEM key, and extracts -277 the relevant part of the key if it is. -278 -279 Args: -280 raw_key_input: The contents of a private key file (either PEM or PKCS12). -281 -282 Returns: -283 string, The actual key if the contents are from a PEM file, or else None. -284 """ -285 offset = raw_key_input.find(b'-----BEGIN ') -286 if offset != -1: -287 return raw_key_input[offset:] -
288 -
289 -290 -def _urlsafe_b64encode(raw_bytes): -
291 if isinstance(raw_bytes, six.text_type): -292 raw_bytes = raw_bytes.encode('utf-8') -293 return base64.urlsafe_b64encode(raw_bytes).decode('ascii').rstrip('=') -
294 -
295 -296 -def _urlsafe_b64decode(b64string): -
297 # Guard against unicode strings, which base64 can't handle. -298 if isinstance(b64string, six.text_type): -299 b64string = b64string.encode('ascii') -300 padded = b64string + b'=' * (4 - len(b64string) % 4) -301 return base64.urlsafe_b64decode(padded) -
302 -
303 -304 -def _json_encode(data): -
305 return json.dumps(data, separators=(',', ':')) -
306 -
307 -308 -def make_signed_jwt(signer, payload): -
309 """Make a signed JWT. -310 -311 See http://self-issued.info/docs/draft-jones-json-web-token.html. -312 -313 Args: -314 signer: crypt.Signer, Cryptographic signer. -315 payload: dict, Dictionary of data to convert to JSON and then sign. -316 -317 Returns: -318 string, The JWT for the payload. -319 """ -320 header = {'typ': 'JWT', 'alg': 'RS256'} -321 -322 segments = [ -323 _urlsafe_b64encode(_json_encode(header)), -324 _urlsafe_b64encode(_json_encode(payload)), -325 ] -326 signing_input = '.'.join(segments) -327 -328 signature = signer.sign(signing_input) -329 segments.append(_urlsafe_b64encode(signature)) -330 -331 logger.debug(str(segments)) -332 -333 return '.'.join(segments) -
334 -
335 -336 -def verify_signed_jwt_with_certs(jwt, certs, audience): -
337 """Verify a JWT against public certs. -338 -339 See http://self-issued.info/docs/draft-jones-json-web-token.html. -340 -341 Args: -342 jwt: string, A JWT. -343 certs: dict, Dictionary where values of public keys in PEM format. -344 audience: string, The audience, 'aud', that this JWT should contain. If -345 None then the JWT's 'aud' parameter is not verified. -346 -347 Returns: -348 dict, The deserialized JSON payload in the JWT. -349 -350 Raises: -351 AppIdentityError if any checks are failed. -352 """ -353 segments = jwt.split('.') -354 -355 if len(segments) != 3: -356 raise AppIdentityError('Wrong number of segments in token: %s' % jwt) -357 signed = '%s.%s' % (segments[0], segments[1]) -358 -359 signature = _urlsafe_b64decode(segments[2]) -360 -361 # Parse token. -362 json_body = _urlsafe_b64decode(segments[1]) -363 try: -364 parsed = json.loads(json_body.decode('utf-8')) -365 except: -366 raise AppIdentityError('Can\'t parse token: %s' % json_body) -367 -368 # Check signature. -369 verified = False -370 for pem in certs.values(): -371 verifier = Verifier.from_string(pem, True) -372 if verifier.verify(signed, signature): -373 verified = True -374 break -375 if not verified: -376 raise AppIdentityError('Invalid token signature: %s' % jwt) -377 -378 # Check creation timestamp. -379 iat = parsed.get('iat') -380 if iat is None: -381 raise AppIdentityError('No iat field in token: %s' % json_body) -382 earliest = iat - CLOCK_SKEW_SECS -383 -384 # Check expiration timestamp. -385 now = int(time.time()) -386 exp = parsed.get('exp') -387 if exp is None: -388 raise AppIdentityError('No exp field in token: %s' % json_body) -389 if exp >= now + MAX_TOKEN_LIFETIME_SECS: -390 raise AppIdentityError('exp field too far in future: %s' % json_body) -391 latest = exp + CLOCK_SKEW_SECS -392 -393 if now < earliest: -394 raise AppIdentityError('Token used too early, %d < %d: %s' % -395 (now, earliest, json_body)) -396 if now > latest: -397 raise AppIdentityError('Token used too late, %d > %d: %s' % -398 (now, latest, json_body)) -399 -400 # Check audience. -401 if audience is not None: -402 aud = parsed.get('aud') -403 if aud is None: -404 raise AppIdentityError('No aud field in token: %s' % json_body) -405 if aud != audience: -406 raise AppIdentityError('Wrong recipient, %s != %s: %s' % -407 (aud, audience, json_body)) -408 -409 return parsed -
410 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.crypt.AppIdentityError-class.html b/docs/epy/oauth2client.crypt.AppIdentityError-class.html deleted file mode 100644 index 16c2139..0000000 --- a/docs/epy/oauth2client.crypt.AppIdentityError-class.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - oauth2client.crypt.AppIdentityError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module crypt :: - Class AppIdentityError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class AppIdentityError

source code

-
-
- - - - - - - - - - - - - - - - - - - -
-
-
- - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.django_orm-module.html b/docs/epy/oauth2client.django_orm-module.html deleted file mode 100644 index 6c50cf7..0000000 --- a/docs/epy/oauth2client.django_orm-module.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - oauth2client.django_orm - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module django_orm - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module django_orm

source code

-
-OAuth 2.0 utilities for Django.
-
-Utilities for using OAuth 2.0 in conjunction with
-the Django datastore.
-
-
- -
-

Author: - jcgregorio@google.com (Joe Gregorio) -

-
- - - - - - - - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - CredentialsField -
-   - - FlowField -
-   - - Storage
- Store and retrieve a single credential to and from -the datastore. -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.django_orm-pysrc.html b/docs/epy/oauth2client.django_orm-pysrc.html deleted file mode 100644 index fad01cb..0000000 --- a/docs/epy/oauth2client.django_orm-pysrc.html +++ /dev/null @@ -1,302 +0,0 @@ - - - - - oauth2client.django_orm - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module django_orm - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.django_orm

-
-  1  # Copyright 2014 Google Inc. All rights reserved. 
-  2  # 
-  3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  4  # you may not use this file except in compliance with the License. 
-  5  # You may obtain a copy of the License at 
-  6  # 
-  7  #      http://www.apache.org/licenses/LICENSE-2.0 
-  8  # 
-  9  # Unless required by applicable law or agreed to in writing, software 
- 10  # distributed under the License is distributed on an "AS IS" BASIS, 
- 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 12  # See the License for the specific language governing permissions and 
- 13  # limitations under the License. 
- 14   
- 15  """OAuth 2.0 utilities for Django. 
- 16   
- 17  Utilities for using OAuth 2.0 in conjunction with 
- 18  the Django datastore. 
- 19  """ 
- 20   
- 21  __author__ = 'jcgregorio@google.com (Joe Gregorio)' 
- 22   
- 23  import oauth2client 
- 24  import base64 
- 25  import pickle 
- 26   
- 27  from django.db import models 
- 28  from oauth2client.client import Storage as BaseStorage 
- 29   
-
30 -class CredentialsField(models.Field): -
31 - 32 __metaclass__ = models.SubfieldBase - 33 -
34 - def __init__(self, *args, **kwargs): -
35 if 'null' not in kwargs: - 36 kwargs['null'] = True - 37 super(CredentialsField, self).__init__(*args, **kwargs) -
38 -
39 - def get_internal_type(self): -
40 return "TextField" -
41 -
42 - def to_python(self, value): -
43 if value is None: - 44 return None - 45 if isinstance(value, oauth2client.client.Credentials): - 46 return value - 47 return pickle.loads(base64.b64decode(value)) -
48 -
49 - def get_db_prep_value(self, value, connection, prepared=False): -
50 if value is None: - 51 return None - 52 return base64.b64encode(pickle.dumps(value)) -
53 - 54 -
55 -class FlowField(models.Field): -
56 - 57 __metaclass__ = models.SubfieldBase - 58 -
59 - def __init__(self, *args, **kwargs): -
60 if 'null' not in kwargs: - 61 kwargs['null'] = True - 62 super(FlowField, self).__init__(*args, **kwargs) -
63 -
64 - def get_internal_type(self): -
65 return "TextField" -
66 -
67 - def to_python(self, value): -
68 if value is None: - 69 return None - 70 if isinstance(value, oauth2client.client.Flow): - 71 return value - 72 return pickle.loads(base64.b64decode(value)) -
73 -
74 - def get_db_prep_value(self, value, connection, prepared=False): -
75 if value is None: - 76 return None - 77 return base64.b64encode(pickle.dumps(value)) -
78 - 79 -
80 -class Storage(BaseStorage): -
81 """Store and retrieve a single credential to and from - 82 the datastore. - 83 - 84 This Storage helper presumes the Credentials - 85 have been stored as a CredenialsField - 86 on a db model class. - 87 """ - 88 -
89 - def __init__(self, model_class, key_name, key_value, property_name): -
90 """Constructor for Storage. - 91 - 92 Args: - 93 model: db.Model, model class - 94 key_name: string, key name for the entity that has the credentials - 95 key_value: string, key value for the entity that has the credentials - 96 property_name: string, name of the property that is an CredentialsProperty - 97 """ - 98 self.model_class = model_class - 99 self.key_name = key_name -100 self.key_value = key_value -101 self.property_name = property_name -
102 -
103 - def locked_get(self): -
104 """Retrieve Credential from datastore. -105 -106 Returns: -107 oauth2client.Credentials -108 """ -109 credential = None -110 -111 query = {self.key_name: self.key_value} -112 entities = self.model_class.objects.filter(**query) -113 if len(entities) > 0: -114 credential = getattr(entities[0], self.property_name) -115 if credential and hasattr(credential, 'set_store'): -116 credential.set_store(self) -117 return credential -
118 -
119 - def locked_put(self, credentials, overwrite=False): -
120 """Write a Credentials to the datastore. -121 -122 Args: -123 credentials: Credentials, the credentials to store. -124 overwrite: Boolean, indicates whether you would like these credentials to -125 overwrite any existing stored credentials. -126 """ -127 args = {self.key_name: self.key_value} -128 -129 if overwrite: -130 entity, unused_is_new = self.model_class.objects.get_or_create(**args) -131 else: -132 entity = self.model_class(**args) -133 -134 setattr(entity, self.property_name, credentials) -135 entity.save() -
136 -
137 - def locked_delete(self): -
138 """Delete Credentials from the datastore.""" -139 -140 query = {self.key_name: self.key_value} -141 entities = self.model_class.objects.filter(**query).delete() -
142 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.django_orm.CredentialsField-class.html b/docs/epy/oauth2client.django_orm.CredentialsField-class.html deleted file mode 100644 index 74105a7..0000000 --- a/docs/epy/oauth2client.django_orm.CredentialsField-class.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - oauth2client.django_orm.CredentialsField - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module django_orm :: - Class CredentialsField - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class CredentialsField

source code

-
-
- - - - - - - - -
-
-
- - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - *args, - **kwargs) - source code - -
- -
-   - - - - - - -
get_internal_type(self) - source code - -
- -
-   - - - - - - -
to_python(self, - value) - source code - -
- -
-   - - - - - - -
get_db_prep_value(self, - value, - connection, - prepared=False) - source code - -
- -
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - __metaclass__ = models.SubfieldBase -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.django_orm.FlowField-class.html b/docs/epy/oauth2client.django_orm.FlowField-class.html deleted file mode 100644 index 99e5e8e..0000000 --- a/docs/epy/oauth2client.django_orm.FlowField-class.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - oauth2client.django_orm.FlowField - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module django_orm :: - Class FlowField - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class FlowField

source code

-
-
- - - - - - - - -
-
-
- - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - *args, - **kwargs) - source code - -
- -
-   - - - - - - -
get_internal_type(self) - source code - -
- -
-   - - - - - - -
to_python(self, - value) - source code - -
- -
-   - - - - - - -
get_db_prep_value(self, - value, - connection, - prepared=False) - source code - -
- -
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - __metaclass__ = models.SubfieldBase -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.django_orm.Storage-class.html b/docs/epy/oauth2client.django_orm.Storage-class.html deleted file mode 100644 index 92b7453..0000000 --- a/docs/epy/oauth2client.django_orm.Storage-class.html +++ /dev/null @@ -1,415 +0,0 @@ - - - - - oauth2client.django_orm.Storage - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module django_orm :: - Class Storage - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class Storage

source code

-
-
- - - - - - - - - - - - - -
-
-
-
-Store and retrieve a single credential to and from
-the datastore.
-
-This Storage helper presumes the Credentials
-have been stored as a CredenialsField
-on a db model class.
-
-
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - model_class, - key_name, - key_value, - property_name)
- Constructor for Storage.
- source code - -
- -
-   - - - - - - -
locked_get(self)
- Retrieve Credential from datastore.
- source code - -
- -
-   - - - - - - -
locked_put(self, - credentials, - overwrite=False)
- Write a Credentials to the datastore.
- source code - -
- -
-   - - - - - - -
locked_delete(self)
- Delete Credentials from the datastore.
- source code - -
- -
-

Inherited from client.Storage: - acquire_lock, - delete, - get, - put, - release_lock -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - model_class, - key_name, - key_value, - property_name) -
(Constructor) -

-
source code  -
- -
-Constructor for Storage.
-
-Args:
-  model: db.Model, model class
-  key_name: string, key name for the entity that has the credentials
-  key_value: string, key value for the entity that has the credentials
-  property_name: string, name of the property that is an CredentialsProperty
-
-
-
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

locked_get(self) -

-
source code  -
- -
-Retrieve Credential from datastore.
-
-Returns:
-  oauth2client.Credentials
-
-
-
-
Overrides: - client.Storage.locked_get -
-
-
-
- -
- -
- - -
-

locked_put(self, - credentials, - overwrite=False) -

-
source code  -
- -
-Write a Credentials to the datastore.
-
-Args:
-  credentials: Credentials, the credentials to store.
-  overwrite: Boolean, indicates whether you would like these credentials to
-                      overwrite any existing stored credentials.
-
-
-
-
Overrides: - client.Storage.locked_put -
-
-
-
- -
- -
- - -
-

locked_delete(self) -

-
source code  -
- -
-Delete Credentials from the datastore.
-
-
-
-
Overrides: - client.Storage.locked_delete -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.file-module.html b/docs/epy/oauth2client.file-module.html deleted file mode 100644 index b061388..0000000 --- a/docs/epy/oauth2client.file-module.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - oauth2client.file - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module file - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module file

source code

-
-Utilities for OAuth.
-
-Utilities for making it easier to work with OAuth 2.0
-credentials.
-
-
- -
-

Author: - jcgregorio@google.com (Joe Gregorio) -

-
- - - - - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - CredentialsFileSymbolicLinkError
- Credentials files must not be symbolic links. -
-   - - Storage
- Store and retrieve a single credential to and from a file. -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.file-pysrc.html b/docs/epy/oauth2client.file-pysrc.html deleted file mode 100644 index 67b0171..0000000 --- a/docs/epy/oauth2client.file-pysrc.html +++ /dev/null @@ -1,252 +0,0 @@ - - - - - oauth2client.file - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module file - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.file

-
-  1  # Copyright 2014 Google Inc. All rights reserved. 
-  2  # 
-  3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  4  # you may not use this file except in compliance with the License. 
-  5  # You may obtain a copy of the License at 
-  6  # 
-  7  #      http://www.apache.org/licenses/LICENSE-2.0 
-  8  # 
-  9  # Unless required by applicable law or agreed to in writing, software 
- 10  # distributed under the License is distributed on an "AS IS" BASIS, 
- 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 12  # See the License for the specific language governing permissions and 
- 13  # limitations under the License. 
- 14   
- 15  """Utilities for OAuth. 
- 16   
- 17  Utilities for making it easier to work with OAuth 2.0 
- 18  credentials. 
- 19  """ 
- 20   
- 21  __author__ = 'jcgregorio@google.com (Joe Gregorio)' 
- 22   
- 23  import os 
- 24  import threading 
- 25   
- 26  from oauth2client.client import Credentials 
- 27  from oauth2client.client import Storage as BaseStorage 
- 28   
- 29   
-
30 -class CredentialsFileSymbolicLinkError(Exception): -
31 """Credentials files must not be symbolic links.""" -
32 - 33 -
34 -class Storage(BaseStorage): -
35 """Store and retrieve a single credential to and from a file.""" - 36 -
37 - def __init__(self, filename): -
38 self._filename = filename - 39 self._lock = threading.Lock() -
40 -
41 - def _validate_file(self): -
42 if os.path.islink(self._filename): - 43 raise CredentialsFileSymbolicLinkError( - 44 'File: %s is a symbolic link.' % self._filename) -
45 -
46 - def acquire_lock(self): -
47 """Acquires any lock necessary to access this Storage. - 48 - 49 This lock is not reentrant.""" - 50 self._lock.acquire() -
51 -
52 - def release_lock(self): -
53 """Release the Storage lock. - 54 - 55 Trying to release a lock that isn't held will result in a - 56 RuntimeError. - 57 """ - 58 self._lock.release() -
59 -
60 - def locked_get(self): -
61 """Retrieve Credential from file. - 62 - 63 Returns: - 64 oauth2client.client.Credentials - 65 - 66 Raises: - 67 CredentialsFileSymbolicLinkError if the file is a symbolic link. - 68 """ - 69 credentials = None - 70 self._validate_file() - 71 try: - 72 f = open(self._filename, 'rb') - 73 content = f.read() - 74 f.close() - 75 except IOError: - 76 return credentials - 77 - 78 try: - 79 credentials = Credentials.new_from_json(content) - 80 credentials.set_store(self) - 81 except ValueError: - 82 pass - 83 - 84 return credentials -
85 -
86 - def _create_file_if_needed(self): -
87 """Create an empty file if necessary. - 88 - 89 This method will not initialize the file. Instead it implements a - 90 simple version of "touch" to ensure the file has been created. - 91 """ - 92 if not os.path.exists(self._filename): - 93 old_umask = os.umask(0o177) - 94 try: - 95 open(self._filename, 'a+b').close() - 96 finally: - 97 os.umask(old_umask) -
98 -
99 - def locked_put(self, credentials): -
100 """Write Credentials to file. -101 -102 Args: -103 credentials: Credentials, the credentials to store. -104 -105 Raises: -106 CredentialsFileSymbolicLinkError if the file is a symbolic link. -107 """ -108 -109 self._create_file_if_needed() -110 self._validate_file() -111 f = open(self._filename, 'w') -112 f.write(credentials.to_json()) -113 f.close() -
114 -
115 - def locked_delete(self): -
116 """Delete Credentials file. -117 -118 Args: -119 credentials: Credentials, the credentials to store. -120 """ -121 -122 os.unlink(self._filename) -
123 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.file.CredentialsFileSymbolicLinkError-class.html b/docs/epy/oauth2client.file.CredentialsFileSymbolicLinkError-class.html deleted file mode 100644 index e046e30..0000000 --- a/docs/epy/oauth2client.file.CredentialsFileSymbolicLinkError-class.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - oauth2client.file.CredentialsFileSymbolicLinkError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module file :: - Class CredentialsFileSymbolicLinkError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class CredentialsFileSymbolicLinkError

source code

-
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-Credentials files must not be symbolic links.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.file.Storage-class.html b/docs/epy/oauth2client.file.Storage-class.html deleted file mode 100644 index 26a5daf..0000000 --- a/docs/epy/oauth2client.file.Storage-class.html +++ /dev/null @@ -1,549 +0,0 @@ - - - - - oauth2client.file.Storage - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module file :: - Class Storage - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class Storage

source code

-
-
- - - - - - - - - - - - - -
-
-
-
-Store and retrieve a single credential to and from a file.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - filename)
- x.__init__(...) initializes x; see help(type(x)) for signature
- source code - -
- -
-   - - - - - - -
_validate_file(self) - source code - -
- -
-   - - - - - - -
acquire_lock(self)
- Acquires any lock necessary to access this Storage.
- source code - -
- -
-   - - - - - - -
release_lock(self)
- Release the Storage lock.
- source code - -
- -
-   - - - - - - -
locked_get(self)
- Retrieve Credential from file.
- source code - -
- -
-   - - - - - - -
_create_file_if_needed(self)
- Create an empty file if necessary.
- source code - -
- -
-   - - - - - - -
locked_put(self, - credentials)
- Write Credentials to file.
- source code - -
- -
-   - - - - - - -
locked_delete(self)
- Delete Credentials file.
- source code - -
- -
-

Inherited from client.Storage: - delete, - get, - put -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - filename) -
(Constructor) -

-
source code  -
- -
-x.__init__(...) initializes x; see help(type(x)) for signature
-
-
-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

acquire_lock(self) -

-
source code  -
- -
-Acquires any lock necessary to access this Storage.
-
-This lock is not reentrant.
-
-
-
-
Overrides: - client.Storage.acquire_lock -
-
-
-
- -
- -
- - -
-

release_lock(self) -

-
source code  -
- -
-Release the Storage lock.
-
-Trying to release a lock that isn't held will result in a
-RuntimeError.
-
-
-
-
Overrides: - client.Storage.release_lock -
-
-
-
- -
- -
- - -
-

locked_get(self) -

-
source code  -
- -
-Retrieve Credential from file.
-
-Returns:
-  oauth2client.client.Credentials
-
-Raises:
-  CredentialsFileSymbolicLinkError if the file is a symbolic link.
-
-
-
-
Overrides: - client.Storage.locked_get -
-
-
-
- -
- -
- - -
-

_create_file_if_needed(self) -

-
source code  -
- -
-Create an empty file if necessary.
-
-This method will not initialize the file. Instead it implements a
-simple version of "touch" to ensure the file has been created.
-
-
-
-
-
-
- -
- -
- - -
-

locked_put(self, - credentials) -

-
source code  -
- -
-Write Credentials to file.
-
-Args:
-  credentials: Credentials, the credentials to store.
-
-Raises:
-  CredentialsFileSymbolicLinkError if the file is a symbolic link.
-
-
-
-
Overrides: - client.Storage.locked_put -
-
-
-
- -
- -
- - -
-

locked_delete(self) -

-
source code  -
- -
-Delete Credentials file.
-
-Args:
-  credentials: Credentials, the credentials to store.
-
-
-
-
Overrides: - client.Storage.locked_delete -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.gce-module.html b/docs/epy/oauth2client.gce-module.html deleted file mode 100644 index a99cc96..0000000 --- a/docs/epy/oauth2client.gce-module.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - oauth2client.gce - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module gce - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module gce

source code

-
-Utilities for Google Compute Engine
-
-Utilities for making it easier to use OAuth 2.0 on Google Compute Engine.
-
-
- -
-

Author: - jcgregorio@google.com (Joe Gregorio) -

-
- - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - AppAssertionCredentials
- Credentials object for Compute Engine Assertion Grants -
- - - - - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - logger = logging.getLogger(__name__) -
-   - - META = 'http://metadata.google.internal/0.1/meta-data/service-... -
- - - - - - -
- - - - - -
Variables Details[hide private]
-
- -
- -
-

META

- -
-
-
-
Value:
-
-'http://metadata.google.internal/0.1/meta-data/service-accounts/' 'def\
-ault/acquire{?scope}'
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.gce-pysrc.html b/docs/epy/oauth2client.gce-pysrc.html deleted file mode 100644 index 0af8b6a..0000000 --- a/docs/epy/oauth2client.gce-pysrc.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - - oauth2client.gce - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module gce - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.gce

-
-  1  # Copyright 2014 Google Inc. All rights reserved. 
-  2  # 
-  3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  4  # you may not use this file except in compliance with the License. 
-  5  # You may obtain a copy of the License at 
-  6  # 
-  7  #      http://www.apache.org/licenses/LICENSE-2.0 
-  8  # 
-  9  # Unless required by applicable law or agreed to in writing, software 
- 10  # distributed under the License is distributed on an "AS IS" BASIS, 
- 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 12  # See the License for the specific language governing permissions and 
- 13  # limitations under the License. 
- 14   
- 15  """Utilities for Google Compute Engine 
- 16   
- 17  Utilities for making it easier to use OAuth 2.0 on Google Compute Engine. 
- 18  """ 
- 19   
- 20  __author__ = 'jcgregorio@google.com (Joe Gregorio)' 
- 21   
- 22  import json 
- 23  import logging 
- 24  from six.moves import urllib 
- 25   
- 26  from oauth2client import util 
- 27  from oauth2client.client import AccessTokenRefreshError 
- 28  from oauth2client.client import AssertionCredentials 
- 29   
- 30  logger = logging.getLogger(__name__) 
- 31   
- 32  # URI Template for the endpoint that returns access_tokens. 
- 33  META = ('http://metadata.google.internal/0.1/meta-data/service-accounts/' 
- 34          'default/acquire{?scope}') 
-
35 - 36 - 37 -class AppAssertionCredentials(AssertionCredentials): -
38 """Credentials object for Compute Engine Assertion Grants - 39 - 40 This object will allow a Compute Engine instance to identify itself to - 41 Google and other OAuth 2.0 servers that can verify assertions. It can be used - 42 for the purpose of accessing data stored under an account assigned to the - 43 Compute Engine instance itself. - 44 - 45 This credential does not require a flow to instantiate because it represents - 46 a two legged flow, and therefore has all of the required information to - 47 generate and refresh its own access tokens. - 48 """ - 49 - 50 @util.positional(2) -
51 - def __init__(self, scope, **kwargs): -
52 """Constructor for AppAssertionCredentials - 53 - 54 Args: - 55 scope: string or iterable of strings, scope(s) of the credentials being - 56 requested. - 57 """ - 58 self.scope = util.scopes_to_string(scope) - 59 self.kwargs = kwargs - 60 - 61 # Assertion type is no longer used, but still in the parent class signature. - 62 super(AppAssertionCredentials, self).__init__(None) -
63 - 64 @classmethod -
65 - def from_json(cls, json_data): -
66 data = json.loads(json_data) - 67 return AppAssertionCredentials(data['scope']) -
68 -
69 - def _refresh(self, http_request): -
70 """Refreshes the access_token. - 71 - 72 Skip all the storage hoops and just refresh using the API. - 73 - 74 Args: - 75 http_request: callable, a callable that matches the method signature of - 76 httplib2.Http.request, used to make the refresh request. - 77 - 78 Raises: - 79 AccessTokenRefreshError: When the refresh fails. - 80 """ - 81 query = '?scope=%s' % urllib.parse.quote(self.scope, '') - 82 uri = META.replace('{?scope}', query) - 83 response, content = http_request(uri) - 84 if response.status == 200: - 85 try: - 86 d = json.loads(content) - 87 except Exception as e: - 88 raise AccessTokenRefreshError(str(e)) - 89 self.access_token = d['accessToken'] - 90 else: - 91 if response.status == 404: - 92 content += (' This can occur if a VM was created' - 93 ' with no service account or scopes.') - 94 raise AccessTokenRefreshError(content) -
95 - 96 @property -
97 - def serialization_data(self): -
98 raise NotImplementedError( - 99 'Cannot serialize credentials for GCE service accounts.') -
100 -
101 - def create_scoped_required(self): -
102 return not self.scope -
103 -
104 - def create_scoped(self, scopes): -
105 return AppAssertionCredentials(scopes, **self.kwargs) -
106 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.gce.AppAssertionCredentials-class.html b/docs/epy/oauth2client.gce.AppAssertionCredentials-class.html deleted file mode 100644 index f62ce72..0000000 --- a/docs/epy/oauth2client.gce.AppAssertionCredentials-class.html +++ /dev/null @@ -1,634 +0,0 @@ - - - - - oauth2client.gce.AppAssertionCredentials - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module gce :: - Class AppAssertionCredentials - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class AppAssertionCredentials

source code

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-Credentials object for Compute Engine Assertion Grants
-
-This object will allow a Compute Engine instance to identify itself to
-Google and other OAuth 2.0 servers that can verify assertions. It can be used
-for the purpose of accessing data stored under an account assigned to the
-Compute Engine instance itself.
-
-This credential does not require a flow to instantiate because it represents
-a two legged flow, and therefore has all of the required information to
-generate and refresh its own access tokens.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - scope, - **kwargs)
- Constructor for AppAssertionCredentials
- source code - -
- -
-   - - - - - - -
_refresh(self, - http_request)
- Refreshes the access_token.
- source code - -
- -
-   - - - - - - -
serialization_data(self)
- Get the fields and their values identifying the current credentials.
- source code - -
- -
-   - - - - - - -
create_scoped_required(self)
- Whether this Credentials object is scopeless.
- source code - -
- -
-   - - - - - - -
create_scoped(self, - scopes)
- Create a Credentials object for the given scopes.
- source code - -
- -
- -

Inherited from client.OAuth2Credentials: - __getstate__, - __setstate__, - access_token_expired, - apply, - authorize, - get_access_token, - refresh, - revoke, - set_store, - to_json -

- -

Inherited from client.Credentials (private): - _to_json -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-   - - - - - - -
from_json(cls, - json_data)
- Instantiate a Credentials object from a JSON description of it.
- source code - -
- -
-

Inherited from client.Credentials: - new_from_json -

-
- - - - - - - - - -
- - - - - -
Static Methods[hide private]
-
-

Inherited from client.GoogleCredentials: - from_stream, - get_application_default -

-
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-

Inherited from client.Credentials: - NON_SERIALIZED_MEMBERS -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - scope, - **kwargs) -
(Constructor) -

-
source code  -
- -
-Constructor for AppAssertionCredentials
-
-Args:
-  scope: string or iterable of strings, scope(s) of the credentials being
-    requested.
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

from_json(cls, - json_data) -
Class Method -

-
source code  -
- -
-Instantiate a Credentials object from a JSON description of it. The JSON
-should have been produced by calling .to_json() on the object.
-
-Args:
-  data: dict, A deserialized JSON object.
-
-Returns:
-  An instance of a Credentials subclass.
-
-
-
-
Overrides: - client.Credentials.from_json -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

_refresh(self, - http_request) -

-
source code  -
- -
-Refreshes the access_token.
-
-Skip all the storage hoops and just refresh using the API.
-
-Args:
-  http_request: callable, a callable that matches the method signature of
-    httplib2.Http.request, used to make the refresh request.
-
-Raises:
-  AccessTokenRefreshError: When the refresh fails.
-
-
-
-
Overrides: - client.OAuth2Credentials._refresh -
-
-
-
- -
- -
- - -
-

serialization_data(self) -

-
source code  -
- -
-Get the fields and their values identifying the current credentials.
-
-
-
-
Decorators:
-
    -
  • @property
  • -
-
Overrides: - client.GoogleCredentials.serialization_data -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

create_scoped_required(self) -

-
source code  -
- -
-Whether this Credentials object is scopeless.
-
-create_scoped(scopes) method needs to be called in order to create
-a Credentials object for API calls.
-
-
-
-
Overrides: - client.GoogleCredentials.create_scoped_required -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

create_scoped(self, - scopes) -

-
source code  -
- -
-Create a Credentials object for the given scopes.
-
-The Credentials type is preserved.
-
-
-
-
Overrides: - client.GoogleCredentials.create_scoped -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.keyring_storage-module.html b/docs/epy/oauth2client.keyring_storage-module.html deleted file mode 100644 index 6afddaf..0000000 --- a/docs/epy/oauth2client.keyring_storage-module.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - oauth2client.keyring_storage - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module keyring_storage - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module keyring_storage

source code

-
-A keyring based Storage.
-
-A Storage for Credentials that uses the keyring module.
-
-
- -
-

Author: - jcgregorio@google.com (Joe Gregorio) -

-
- - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - Storage
- Store and retrieve a single credential to and from the keyring. -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.keyring_storage-pysrc.html b/docs/epy/oauth2client.keyring_storage-pysrc.html deleted file mode 100644 index 77a371e..0000000 --- a/docs/epy/oauth2client.keyring_storage-pysrc.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - oauth2client.keyring_storage - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module keyring_storage - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.keyring_storage

-
-  1  # Copyright 2014 Google Inc. All rights reserved. 
-  2  # 
-  3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  4  # you may not use this file except in compliance with the License. 
-  5  # You may obtain a copy of the License at 
-  6  # 
-  7  #      http://www.apache.org/licenses/LICENSE-2.0 
-  8  # 
-  9  # Unless required by applicable law or agreed to in writing, software 
- 10  # distributed under the License is distributed on an "AS IS" BASIS, 
- 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 12  # See the License for the specific language governing permissions and 
- 13  # limitations under the License. 
- 14   
- 15  """A keyring based Storage. 
- 16   
- 17  A Storage for Credentials that uses the keyring module. 
- 18  """ 
- 19   
- 20  __author__ = 'jcgregorio@google.com (Joe Gregorio)' 
- 21   
- 22  import threading 
- 23   
- 24  import keyring 
- 25   
- 26  from oauth2client.client import Credentials 
- 27  from oauth2client.client import Storage as BaseStorage 
- 28   
- 29   
-
30 -class Storage(BaseStorage): -
31 """Store and retrieve a single credential to and from the keyring. - 32 - 33 To use this module you must have the keyring module installed. See - 34 <http://pypi.python.org/pypi/keyring/>. This is an optional module and is not - 35 installed with oauth2client by default because it does not work on all the - 36 platforms that oauth2client supports, such as Google App Engine. - 37 - 38 The keyring module <http://pypi.python.org/pypi/keyring/> is a cross-platform - 39 library for access the keyring capabilities of the local system. The user will - 40 be prompted for their keyring password when this module is used, and the - 41 manner in which the user is prompted will vary per platform. - 42 - 43 Usage: - 44 from oauth2client.keyring_storage import Storage - 45 - 46 s = Storage('name_of_application', 'user1') - 47 credentials = s.get() - 48 - 49 """ - 50 -
51 - def __init__(self, service_name, user_name): -
52 """Constructor. - 53 - 54 Args: - 55 service_name: string, The name of the service under which the credentials - 56 are stored. - 57 user_name: string, The name of the user to store credentials for. - 58 """ - 59 self._service_name = service_name - 60 self._user_name = user_name - 61 self._lock = threading.Lock() -
62 -
63 - def acquire_lock(self): -
64 """Acquires any lock necessary to access this Storage. - 65 - 66 This lock is not reentrant.""" - 67 self._lock.acquire() -
68 -
69 - def release_lock(self): -
70 """Release the Storage lock. - 71 - 72 Trying to release a lock that isn't held will result in a - 73 RuntimeError. - 74 """ - 75 self._lock.release() -
76 -
77 - def locked_get(self): -
78 """Retrieve Credential from file. - 79 - 80 Returns: - 81 oauth2client.client.Credentials - 82 """ - 83 credentials = None - 84 content = keyring.get_password(self._service_name, self._user_name) - 85 - 86 if content is not None: - 87 try: - 88 credentials = Credentials.new_from_json(content) - 89 credentials.set_store(self) - 90 except ValueError: - 91 pass - 92 - 93 return credentials -
94 -
95 - def locked_put(self, credentials): -
96 """Write Credentials to file. - 97 - 98 Args: - 99 credentials: Credentials, the credentials to store. -100 """ -101 keyring.set_password(self._service_name, self._user_name, -102 credentials.to_json()) -
103 -
104 - def locked_delete(self): -
105 """Delete Credentials file. -106 -107 Args: -108 credentials: Credentials, the credentials to store. -109 """ -110 keyring.set_password(self._service_name, self._user_name, '') -
111 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.keyring_storage.Storage-class.html b/docs/epy/oauth2client.keyring_storage.Storage-class.html deleted file mode 100644 index 2ddf9b9..0000000 --- a/docs/epy/oauth2client.keyring_storage.Storage-class.html +++ /dev/null @@ -1,507 +0,0 @@ - - - - - oauth2client.keyring_storage.Storage - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module keyring_storage :: - Class Storage - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class Storage

source code

-
-
- - - - - - - - - - - - - -
-
-
-
-Store and retrieve a single credential to and from the keyring.
-
-To use this module you must have the keyring module installed. See
-<http://pypi.python.org/pypi/keyring/>. This is an optional module and is not
-installed with oauth2client by default because it does not work on all the
-platforms that oauth2client supports, such as Google App Engine.
-
-The keyring module <http://pypi.python.org/pypi/keyring/> is a cross-platform
-library for access the keyring capabilities of the local system. The user will
-be prompted for their keyring password when this module is used, and the
-manner in which the user is prompted will vary per platform.
-
-Usage:
-  from oauth2client.keyring_storage import Storage
-
-  s = Storage('name_of_application', 'user1')
-  credentials = s.get()
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - service_name, - user_name)
- Constructor.
- source code - -
- -
-   - - - - - - -
acquire_lock(self)
- Acquires any lock necessary to access this Storage.
- source code - -
- -
-   - - - - - - -
release_lock(self)
- Release the Storage lock.
- source code - -
- -
-   - - - - - - -
locked_get(self)
- Retrieve Credential from file.
- source code - -
- -
-   - - - - - - -
locked_put(self, - credentials)
- Write Credentials to file.
- source code - -
- -
-   - - - - - - -
locked_delete(self)
- Delete Credentials file.
- source code - -
- -
-

Inherited from client.Storage: - delete, - get, - put -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - service_name, - user_name) -
(Constructor) -

-
source code  -
- -
-Constructor.
-
-Args:
-  service_name: string, The name of the service under which the credentials
-    are stored.
-  user_name: string, The name of the user to store credentials for.
-
-
-
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

acquire_lock(self) -

-
source code  -
- -
-Acquires any lock necessary to access this Storage.
-
-This lock is not reentrant.
-
-
-
-
Overrides: - client.Storage.acquire_lock -
-
-
-
- -
- -
- - -
-

release_lock(self) -

-
source code  -
- -
-Release the Storage lock.
-
-Trying to release a lock that isn't held will result in a
-RuntimeError.
-
-
-
-
Overrides: - client.Storage.release_lock -
-
-
-
- -
- -
- - -
-

locked_get(self) -

-
source code  -
- -
-Retrieve Credential from file.
-
-Returns:
-  oauth2client.client.Credentials
-
-
-
-
Overrides: - client.Storage.locked_get -
-
-
-
- -
- -
- - -
-

locked_put(self, - credentials) -

-
source code  -
- -
-Write Credentials to file.
-
-Args:
-  credentials: Credentials, the credentials to store.
-
-
-
-
Overrides: - client.Storage.locked_put -
-
-
-
- -
- -
- - -
-

locked_delete(self) -

-
source code  -
- -
-Delete Credentials file.
-
-Args:
-  credentials: Credentials, the credentials to store.
-
-
-
-
Overrides: - client.Storage.locked_delete -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.locked_file-module.html b/docs/epy/oauth2client.locked_file-module.html deleted file mode 100644 index 71c377c..0000000 --- a/docs/epy/oauth2client.locked_file-module.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - oauth2client.locked_file - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module locked_file - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module locked_file

source code

-
-Locked file interface that should work on Unix and Windows pythons.
-
-This module first tries to use fcntl locking to ensure serialized access
-to a file, then falls back on a lock file if that is unavialable.
-
-Usage:
-    f = LockedFile('filename', 'r+b', 'rb')
-    f.open_and_lock()
-    if f.is_locked():
-      print('Acquired filename with r+b mode')
-      f.file_handle().write('locked data')
-    else:
-      print('Acquired filename with rb mode')
-    f.unlock_and_close()
-
-
- -
-

Author: - cache@google.com (David T McWherter) -

-
- - - - - - - - - - - - - - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - CredentialsFileSymbolicLinkError
- Credentials files must not be symbolic links. -
-   - - AlreadyLockedException
- Trying to lock a file that has already been locked by the LockedFile. -
-   - - _Opener
- Base class for different locking primitives. -
-   - - _PosixOpener
- Lock files using Posix advisory lock files. -
-   - - LockedFile
- Represent a file that has exclusive access. -
- - - - - - - - - -
- - - - - -
Functions[hide private]
-
-   - - - - - - -
validate_file(filename) - source code - -
- -
- - - - - - - - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - logger = logging.getLogger(__name__) -
-   - - _FcntlOpener = None -
-   - - _Win32Opener = None -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.locked_file-pysrc.html b/docs/epy/oauth2client.locked_file-pysrc.html deleted file mode 100644 index 030c12f..0000000 --- a/docs/epy/oauth2client.locked_file-pysrc.html +++ /dev/null @@ -1,525 +0,0 @@ - - - - - oauth2client.locked_file - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module locked_file - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.locked_file

-
-  1  # Copyright 2014 Google Inc. All rights reserved. 
-  2  # 
-  3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  4  # you may not use this file except in compliance with the License. 
-  5  # You may obtain a copy of the License at 
-  6  # 
-  7  #      http://www.apache.org/licenses/LICENSE-2.0 
-  8  # 
-  9  # Unless required by applicable law or agreed to in writing, software 
- 10  # distributed under the License is distributed on an "AS IS" BASIS, 
- 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 12  # See the License for the specific language governing permissions and 
- 13  # limitations under the License. 
- 14   
- 15  """Locked file interface that should work on Unix and Windows pythons. 
- 16   
- 17  This module first tries to use fcntl locking to ensure serialized access 
- 18  to a file, then falls back on a lock file if that is unavialable. 
- 19   
- 20  Usage: 
- 21      f = LockedFile('filename', 'r+b', 'rb') 
- 22      f.open_and_lock() 
- 23      if f.is_locked(): 
- 24        print('Acquired filename with r+b mode') 
- 25        f.file_handle().write('locked data') 
- 26      else: 
- 27        print('Acquired filename with rb mode') 
- 28      f.unlock_and_close() 
- 29  """ 
- 30   
- 31  from __future__ import print_function 
- 32   
- 33  __author__ = 'cache@google.com (David T McWherter)' 
- 34   
- 35  import errno 
- 36  import logging 
- 37  import os 
- 38  import time 
- 39   
- 40  from oauth2client import util 
- 41   
- 42  logger = logging.getLogger(__name__) 
-
43 - 44 - 45 -class CredentialsFileSymbolicLinkError(Exception): -
46 """Credentials files must not be symbolic links.""" -
47 -
48 - 49 -class AlreadyLockedException(Exception): -
50 """Trying to lock a file that has already been locked by the LockedFile.""" - 51 pass -
52 -
53 - 54 -def validate_file(filename): -
55 if os.path.islink(filename): - 56 raise CredentialsFileSymbolicLinkError( - 57 'File: %s is a symbolic link.' % filename) -
58 -
59 -class _Opener(object): -
60 """Base class for different locking primitives.""" - 61 -
62 - def __init__(self, filename, mode, fallback_mode): -
63 """Create an Opener. - 64 - 65 Args: - 66 filename: string, The pathname of the file. - 67 mode: string, The preferred mode to access the file with. - 68 fallback_mode: string, The mode to use if locking fails. - 69 """ - 70 self._locked = False - 71 self._filename = filename - 72 self._mode = mode - 73 self._fallback_mode = fallback_mode - 74 self._fh = None - 75 self._lock_fd = None -
76 -
77 - def is_locked(self): -
78 """Was the file locked.""" - 79 return self._locked -
80 -
81 - def file_handle(self): -
82 """The file handle to the file. Valid only after opened.""" - 83 return self._fh -
84 -
85 - def filename(self): -
86 """The filename that is being locked.""" - 87 return self._filename -
88 -
89 - def open_and_lock(self, timeout, delay): -
90 """Open the file and lock it. - 91 - 92 Args: - 93 timeout: float, How long to try to lock for. - 94 delay: float, How long to wait between retries. - 95 """ - 96 pass -
97 -
98 - def unlock_and_close(self): -
99 """Unlock and close the file.""" -100 pass -
101 -
102 -103 -class _PosixOpener(_Opener): -
104 """Lock files using Posix advisory lock files.""" -105 -
106 - def open_and_lock(self, timeout, delay): -
107 """Open the file and lock it. -108 -109 Tries to create a .lock file next to the file we're trying to open. -110 -111 Args: -112 timeout: float, How long to try to lock for. -113 delay: float, How long to wait between retries. -114 -115 Raises: -116 AlreadyLockedException: if the lock is already acquired. -117 IOError: if the open fails. -118 CredentialsFileSymbolicLinkError if the file is a symbolic link. -119 """ -120 if self._locked: -121 raise AlreadyLockedException('File %s is already locked' % -122 self._filename) -123 self._locked = False -124 -125 validate_file(self._filename) -126 try: -127 self._fh = open(self._filename, self._mode) -128 except IOError as e: -129 # If we can't access with _mode, try _fallback_mode and don't lock. -130 if e.errno == errno.EACCES: -131 self._fh = open(self._filename, self._fallback_mode) -132 return -133 -134 lock_filename = self._posix_lockfile(self._filename) -135 start_time = time.time() -136 while True: -137 try: -138 self._lock_fd = os.open(lock_filename, -139 os.O_CREAT|os.O_EXCL|os.O_RDWR) -140 self._locked = True -141 break -142 -143 except OSError as e: -144 if e.errno != errno.EEXIST: -145 raise -146 if (time.time() - start_time) >= timeout: -147 logger.warn('Could not acquire lock %s in %s seconds', -148 lock_filename, timeout) -149 # Close the file and open in fallback_mode. -150 if self._fh: -151 self._fh.close() -152 self._fh = open(self._filename, self._fallback_mode) -153 return -154 time.sleep(delay) -
155 -
156 - def unlock_and_close(self): -
157 """Unlock a file by removing the .lock file, and close the handle.""" -158 if self._locked: -159 lock_filename = self._posix_lockfile(self._filename) -160 os.close(self._lock_fd) -161 os.unlink(lock_filename) -162 self._locked = False -163 self._lock_fd = None -164 if self._fh: -165 self._fh.close() -
166 -
167 - def _posix_lockfile(self, filename): -
168 """The name of the lock file to use for posix locking.""" -169 return '%s.lock' % filename -
170 -171 -172 try: -173 import fcntl -
174 -175 - class _FcntlOpener(_Opener): -
176 """Open, lock, and unlock a file using fcntl.lockf.""" -177 -
178 - def open_and_lock(self, timeout, delay): -
179 """Open the file and lock it. -180 -181 Args: -182 timeout: float, How long to try to lock for. -183 delay: float, How long to wait between retries -184 -185 Raises: -186 AlreadyLockedException: if the lock is already acquired. -187 IOError: if the open fails. -188 CredentialsFileSymbolicLinkError if the file is a symbolic link. -189 """ -190 if self._locked: -191 raise AlreadyLockedException('File %s is already locked' % -192 self._filename) -193 start_time = time.time() -194 -195 validate_file(self._filename) -196 try: -197 self._fh = open(self._filename, self._mode) -198 except IOError as e: -199 # If we can't access with _mode, try _fallback_mode and don't lock. -200 if e.errno in (errno.EPERM, errno.EACCES): -201 self._fh = open(self._filename, self._fallback_mode) -202 return -203 -204 # We opened in _mode, try to lock the file. -205 while True: -206 try: -207 fcntl.lockf(self._fh.fileno(), fcntl.LOCK_EX) -208 self._locked = True -209 return -210 except IOError as e: -211 # If not retrying, then just pass on the error. -212 if timeout == 0: -213 raise e -214 if e.errno != errno.EACCES: -215 raise e -216 # We could not acquire the lock. Try again. -217 if (time.time() - start_time) >= timeout: -218 logger.warn('Could not lock %s in %s seconds', -219 self._filename, timeout) -220 if self._fh: -221 self._fh.close() -222 self._fh = open(self._filename, self._fallback_mode) -223 return -224 time.sleep(delay) -
225 -
226 - def unlock_and_close(self): -
227 """Close and unlock the file using the fcntl.lockf primitive.""" -228 if self._locked: -229 fcntl.lockf(self._fh.fileno(), fcntl.LOCK_UN) -230 self._locked = False -231 if self._fh: -232 self._fh.close() -
233 except ImportError: -234 _FcntlOpener = None -235 -236 -237 try: -238 import pywintypes -239 import win32con -240 import win32file -
241 -242 - class _Win32Opener(_Opener): -
243 """Open, lock, and unlock a file using windows primitives.""" -244 -245 # Error #33: -246 # 'The process cannot access the file because another process' -247 FILE_IN_USE_ERROR = 33 -248 -249 # Error #158: -250 # 'The segment is already unlocked.' -251 FILE_ALREADY_UNLOCKED_ERROR = 158 -252 -
253 - def open_and_lock(self, timeout, delay): -
254 """Open the file and lock it. -255 -256 Args: -257 timeout: float, How long to try to lock for. -258 delay: float, How long to wait between retries -259 -260 Raises: -261 AlreadyLockedException: if the lock is already acquired. -262 IOError: if the open fails. -263 CredentialsFileSymbolicLinkError if the file is a symbolic link. -264 """ -265 if self._locked: -266 raise AlreadyLockedException('File %s is already locked' % -267 self._filename) -268 start_time = time.time() -269 -270 validate_file(self._filename) -271 try: -272 self._fh = open(self._filename, self._mode) -273 except IOError as e: -274 # If we can't access with _mode, try _fallback_mode and don't lock. -275 if e.errno == errno.EACCES: -276 self._fh = open(self._filename, self._fallback_mode) -277 return -278 -279 # We opened in _mode, try to lock the file. -280 while True: -281 try: -282 hfile = win32file._get_osfhandle(self._fh.fileno()) -283 win32file.LockFileEx( -284 hfile, -285 (win32con.LOCKFILE_FAIL_IMMEDIATELY| -286 win32con.LOCKFILE_EXCLUSIVE_LOCK), 0, -0x10000, -287 pywintypes.OVERLAPPED()) -288 self._locked = True -289 return -290 except pywintypes.error as e: -291 if timeout == 0: -292 raise e -293 -294 # If the error is not that the file is already in use, raise. -295 if e[0] != _Win32Opener.FILE_IN_USE_ERROR: -296 raise -297 -298 # We could not acquire the lock. Try again. -299 if (time.time() - start_time) >= timeout: -300 logger.warn('Could not lock %s in %s seconds' % ( -301 self._filename, timeout)) -302 if self._fh: -303 self._fh.close() -304 self._fh = open(self._filename, self._fallback_mode) -305 return -306 time.sleep(delay) -
307 -
308 - def unlock_and_close(self): -
309 """Close and unlock the file using the win32 primitive.""" -310 if self._locked: -311 try: -312 hfile = win32file._get_osfhandle(self._fh.fileno()) -313 win32file.UnlockFileEx(hfile, 0, -0x10000, pywintypes.OVERLAPPED()) -314 except pywintypes.error as e: -315 if e[0] != _Win32Opener.FILE_ALREADY_UNLOCKED_ERROR: -316 raise -317 self._locked = False -318 if self._fh: -319 self._fh.close() -
320 except ImportError: -321 _Win32Opener = None -
322 -323 -324 -class LockedFile(object): -
325 """Represent a file that has exclusive access.""" -326 -327 @util.positional(4) -
328 - def __init__(self, filename, mode, fallback_mode, use_native_locking=True): -
329 """Construct a LockedFile. -330 -331 Args: -332 filename: string, The path of the file to open. -333 mode: string, The mode to try to open the file with. -334 fallback_mode: string, The mode to use if locking fails. -335 use_native_locking: bool, Whether or not fcntl/win32 locking is used. -336 """ -337 opener = None -338 if not opener and use_native_locking: -339 if _Win32Opener: -340 opener = _Win32Opener(filename, mode, fallback_mode) -341 if _FcntlOpener: -342 opener = _FcntlOpener(filename, mode, fallback_mode) -343 -344 if not opener: -345 opener = _PosixOpener(filename, mode, fallback_mode) -346 -347 self._opener = opener -
348 -
349 - def filename(self): -
350 """Return the filename we were constructed with.""" -351 return self._opener._filename -
352 -
353 - def file_handle(self): -
354 """Return the file_handle to the opened file.""" -355 return self._opener.file_handle() -
356 -
357 - def is_locked(self): -
358 """Return whether we successfully locked the file.""" -359 return self._opener.is_locked() -
360 -
361 - def open_and_lock(self, timeout=0, delay=0.05): -
362 """Open the file, trying to lock it. -363 -364 Args: -365 timeout: float, The number of seconds to try to acquire the lock. -366 delay: float, The number of seconds to wait between retry attempts. -367 -368 Raises: -369 AlreadyLockedException: if the lock is already acquired. -370 IOError: if the open fails. -371 """ -372 self._opener.open_and_lock(timeout, delay) -
373 -
374 - def unlock_and_close(self): -
375 """Unlock and close a file.""" -376 self._opener.unlock_and_close() -
377 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.locked_file.AlreadyLockedException-class.html b/docs/epy/oauth2client.locked_file.AlreadyLockedException-class.html deleted file mode 100644 index de5515a..0000000 --- a/docs/epy/oauth2client.locked_file.AlreadyLockedException-class.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - oauth2client.locked_file.AlreadyLockedException - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module locked_file :: - Class AlreadyLockedException - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class AlreadyLockedException

source code

-
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-Trying to lock a file that has already been locked by the LockedFile.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.locked_file.CredentialsFileSymbolicLinkError-class.html b/docs/epy/oauth2client.locked_file.CredentialsFileSymbolicLinkError-class.html deleted file mode 100644 index 6a8de69..0000000 --- a/docs/epy/oauth2client.locked_file.CredentialsFileSymbolicLinkError-class.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - oauth2client.locked_file.CredentialsFileSymbolicLinkError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module locked_file :: - Class CredentialsFileSymbolicLinkError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class CredentialsFileSymbolicLinkError

source code

-
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-Credentials files must not be symbolic links.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.locked_file.LockedFile-class.html b/docs/epy/oauth2client.locked_file.LockedFile-class.html deleted file mode 100644 index 53452f7..0000000 --- a/docs/epy/oauth2client.locked_file.LockedFile-class.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - oauth2client.locked_file.LockedFile - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module locked_file :: - Class LockedFile - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class LockedFile

source code

-
-
- - - - - - - - - -
-
-
-
-Represent a file that has exclusive access.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - filename, - mode, - fallback_mode, - use_native_locking=True)
- Construct a LockedFile.
- source code - -
- -
-   - - - - - - -
filename(self)
- Return the filename we were constructed with.
- source code - -
- -
-   - - - - - - -
file_handle(self)
- Return the file_handle to the opened file.
- source code - -
- -
-   - - - - - - -
is_locked(self)
- Return whether we successfully locked the file.
- source code - -
- -
-   - - - - - - -
open_and_lock(self, - timeout=0, - delay=0.05)
- Open the file, trying to lock it.
- source code - -
- -
-   - - - - - - -
unlock_and_close(self)
- Unlock and close a file.
- source code - -
- -
-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - filename, - mode, - fallback_mode, - use_native_locking=True) -
(Constructor) -

-
source code  -
- -
-Construct a LockedFile.
-
-Args:
-  filename: string, The path of the file to open.
-  mode: string, The mode to try to open the file with.
-  fallback_mode: string, The mode to use if locking fails.
-  use_native_locking: bool, Whether or not fcntl/win32 locking is used.
-
-
-
-
Decorators:
-
    -
  • @util.positional(4)
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

open_and_lock(self, - timeout=0, - delay=0.05) -

-
source code  -
- -
-Open the file, trying to lock it.
-
-Args:
-  timeout: float, The number of seconds to try to acquire the lock.
-  delay: float, The number of seconds to wait between retry attempts.
-
-Raises:
-  AlreadyLockedException: if the lock is already acquired.
-  IOError: if the open fails.
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.locked_file._Opener-class.html b/docs/epy/oauth2client.locked_file._Opener-class.html deleted file mode 100644 index ce66634..0000000 --- a/docs/epy/oauth2client.locked_file._Opener-class.html +++ /dev/null @@ -1,395 +0,0 @@ - - - - - oauth2client.locked_file._Opener - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module locked_file :: - Class _Opener - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class _Opener

source code

-
-
- - - - - - - - - -
-
-
-
-Base class for different locking primitives.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - filename, - mode, - fallback_mode)
- Create an Opener.
- source code - -
- -
-   - - - - - - -
is_locked(self)
- Was the file locked.
- source code - -
- -
-   - - - - - - -
file_handle(self)
- The file handle to the file.
- source code - -
- -
-   - - - - - - -
filename(self)
- The filename that is being locked.
- source code - -
- -
-   - - - - - - -
open_and_lock(self, - timeout, - delay)
- Open the file and lock it.
- source code - -
- -
-   - - - - - - -
unlock_and_close(self)
- Unlock and close the file.
- source code - -
- -
-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - filename, - mode, - fallback_mode) -
(Constructor) -

-
source code  -
- -
-Create an Opener.
-
-Args:
-  filename: string, The pathname of the file.
-  mode: string, The preferred mode to access the file with.
-  fallback_mode: string, The mode to use if locking fails.
-
-
-
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

file_handle(self) -

-
source code  -
- -
-The file handle to the file. Valid only after opened.
-
-
-
-
-
-
- -
- -
- - -
-

open_and_lock(self, - timeout, - delay) -

-
source code  -
- -
-Open the file and lock it.
-
-Args:
-  timeout: float, How long to try to lock for.
-  delay: float, How long to wait between retries.
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.locked_file._PosixOpener-class.html b/docs/epy/oauth2client.locked_file._PosixOpener-class.html deleted file mode 100644 index df36174..0000000 --- a/docs/epy/oauth2client.locked_file._PosixOpener-class.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - oauth2client.locked_file._PosixOpener - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module locked_file :: - Class _PosixOpener - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class _PosixOpener

source code

-
-
- - - - - - - - - - -
-
-
-
-Lock files using Posix advisory lock files.
-
-
- - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
open_and_lock(self, - timeout, - delay)
- Open the file and lock it.
- source code - -
- -
-   - - - - - - -
unlock_and_close(self)
- Unlock a file by removing the .lock file, and close the handle.
- source code - -
- -
-   - - - - - - -
_posix_lockfile(self, - filename)
- The name of the lock file to use for posix locking.
- source code - -
- -
-

Inherited from _Opener: - __init__, - file_handle, - filename, - is_locked -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

open_and_lock(self, - timeout, - delay) -

-
source code  -
- -
-Open the file and lock it.
-
-Tries to create a .lock file next to the file we're trying to open.
-
-Args:
-  timeout: float, How long to try to lock for.
-  delay: float, How long to wait between retries.
-
-Raises:
-  AlreadyLockedException: if the lock is already acquired.
-  IOError: if the open fails.
-  CredentialsFileSymbolicLinkError if the file is a symbolic link.
-
-
-
-
Overrides: - _Opener.open_and_lock -
-
-
-
- -
- -
- - -
-

unlock_and_close(self) -

-
source code  -
- -
-Unlock a file by removing the .lock file, and close the handle.
-
-
-
-
Overrides: - _Opener.unlock_and_close -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.multistore_file-module.html b/docs/epy/oauth2client.multistore_file-module.html deleted file mode 100644 index 158cd04..0000000 --- a/docs/epy/oauth2client.multistore_file-module.html +++ /dev/null @@ -1,545 +0,0 @@ - - - - - oauth2client.multistore_file - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module multistore_file - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module multistore_file

source code

-
-Multi-credential file store with lock support.
-
-This module implements a JSON credential store where multiple
-credentials can be stored in one file. That file supports locking
-both in a single process and across processes.
-
-The credential themselves are keyed off of:
-* client_id
-* user_agent
-* scope
-
-The format of the stored data is like so:
-{
-  'file_version': 1,
-  'data': [
-    {
-      'key': {
-        'clientId': '<client id>',
-        'userAgent': '<user agent>',
-        'scope': '<scope>'
-      },
-      'credential': {
-        # JSON serialized Credentials.
-      }
-    }
-  ]
-}
-
-
- -
-

Author: - jbeda@google.com (Joe Beda) -

-
- - - - - - - - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - Error
- Base error for this module. -
-   - - NewerCredentialStoreError
- The credential store is a newer version that supported. -
-   - - _MultiStore
- A file backed store for multiple credentials. -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Functions[hide private]
-
-   - - - - - - -
get_credential_storage(filename, - client_id, - user_agent, - scope, - warn_on_readonly=True)
- Get a Storage instance for a credential.
- source code - -
- -
-   - - - - - - -
get_credential_storage_custom_string_key(filename, - key_string, - warn_on_readonly=True)
- Get a Storage instance for a credential using a single string as a key.
- source code - -
- -
-   - - - - - - -
get_credential_storage_custom_key(filename, - key_dict, - warn_on_readonly=True)
- Get a Storage instance for a credential using a dictionary as a key.
- source code - -
- -
-   - - - - - - -
get_all_credential_keys(filename, - warn_on_readonly=True)
- Gets all the registered credential keys in the given Multistore.
- source code - -
- -
-   - - - - - - -
_get_multistore(filename, - warn_on_readonly=True)
- A helper method to initialize the multistore with proper locking.
- source code - -
- -
- - - - - - - - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - logger = logging.getLogger(__name__) -
-   - - _multistores = {} -
-   - - _multistores_lock = threading.Lock() -
- - - - - - -
- - - - - -
Function Details[hide private]
-
- -
- -
- - -
-

get_credential_storage(filename, - client_id, - user_agent, - scope, - warn_on_readonly=True) -

-
source code  -
- -
-Get a Storage instance for a credential.
-
-Args:
-  filename: The JSON file storing a set of credentials
-  client_id: The client_id for the credential
-  user_agent: The user agent for the credential
-  scope: string or iterable of strings, Scope(s) being requested
-  warn_on_readonly: if True, log a warning if the store is readonly
-
-Returns:
-  An object derived from client.Storage for getting/setting the
-  credential.
-
-
-
-
Decorators:
-
    -
  • @util.positional(4)
  • -
-
-
-
- -
- -
- - -
-

get_credential_storage_custom_string_key(filename, - key_string, - warn_on_readonly=True) -

-
source code  -
- -
-Get a Storage instance for a credential using a single string as a key.
-
-Allows you to provide a string as a custom key that will be used for
-credential storage and retrieval.
-
-Args:
-  filename: The JSON file storing a set of credentials
-  key_string: A string to use as the key for storing this credential.
-  warn_on_readonly: if True, log a warning if the store is readonly
-
-Returns:
-  An object derived from client.Storage for getting/setting the
-  credential.
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
-
-
- -
- -
- - -
-

get_credential_storage_custom_key(filename, - key_dict, - warn_on_readonly=True) -

-
source code  -
- -
-Get a Storage instance for a credential using a dictionary as a key.
-
-Allows you to provide a dictionary as a custom key that will be used for
-credential storage and retrieval.
-
-Args:
-  filename: The JSON file storing a set of credentials
-  key_dict: A dictionary to use as the key for storing this credential. There
-    is no ordering of the keys in the dictionary. Logically equivalent
-    dictionaries will produce equivalent storage keys.
-  warn_on_readonly: if True, log a warning if the store is readonly
-
-Returns:
-  An object derived from client.Storage for getting/setting the
-  credential.
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
-
-
- -
- -
- - -
-

get_all_credential_keys(filename, - warn_on_readonly=True) -

-
source code  -
- -
-Gets all the registered credential keys in the given Multistore.
-
-Args:
-  filename: The JSON file storing a set of credentials
-  warn_on_readonly: if True, log a warning if the store is readonly
-
-Returns:
-  A list of the credential keys present in the file.  They are returned as
-  dictionaries that can be passed into get_credential_storage_custom_key to
-  get the actual credentials.
-
-
-
-
Decorators:
-
    -
  • @util.positional(1)
  • -
-
-
-
- -
- -
- - -
-

_get_multistore(filename, - warn_on_readonly=True) -

-
source code  -
- -
-A helper method to initialize the multistore with proper locking.
-
-Args:
-  filename: The JSON file storing a set of credentials
-  warn_on_readonly: if True, log a warning if the store is readonly
-
-Returns:
-  A multistore object
-
-
-
-
Decorators:
-
    -
  • @util.positional(1)
  • -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.multistore_file-pysrc.html b/docs/epy/oauth2client.multistore_file-pysrc.html deleted file mode 100644 index 763eeaf..0000000 --- a/docs/epy/oauth2client.multistore_file-pysrc.html +++ /dev/null @@ -1,647 +0,0 @@ - - - - - oauth2client.multistore_file - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module multistore_file - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.multistore_file

-
-  1  # Copyright 2014 Google Inc. All rights reserved. 
-  2  # 
-  3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  4  # you may not use this file except in compliance with the License. 
-  5  # You may obtain a copy of the License at 
-  6  # 
-  7  #      http://www.apache.org/licenses/LICENSE-2.0 
-  8  # 
-  9  # Unless required by applicable law or agreed to in writing, software 
- 10  # distributed under the License is distributed on an "AS IS" BASIS, 
- 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 12  # See the License for the specific language governing permissions and 
- 13  # limitations under the License. 
- 14   
- 15  """Multi-credential file store with lock support. 
- 16   
- 17  This module implements a JSON credential store where multiple 
- 18  credentials can be stored in one file. That file supports locking 
- 19  both in a single process and across processes. 
- 20   
- 21  The credential themselves are keyed off of: 
- 22  * client_id 
- 23  * user_agent 
- 24  * scope 
- 25   
- 26  The format of the stored data is like so: 
- 27  { 
- 28    'file_version': 1, 
- 29    'data': [ 
- 30      { 
- 31        'key': { 
- 32          'clientId': '<client id>', 
- 33          'userAgent': '<user agent>', 
- 34          'scope': '<scope>' 
- 35        }, 
- 36        'credential': { 
- 37          # JSON serialized Credentials. 
- 38        } 
- 39      } 
- 40    ] 
- 41  } 
- 42  """ 
- 43   
- 44  __author__ = 'jbeda@google.com (Joe Beda)' 
- 45   
- 46  import json 
- 47  import logging 
- 48  import os 
- 49  import threading 
- 50   
- 51  from oauth2client.client import Credentials 
- 52  from oauth2client.client import Storage as BaseStorage 
- 53  from oauth2client import util 
- 54  from oauth2client.locked_file import LockedFile 
- 55   
- 56  logger = logging.getLogger(__name__) 
- 57   
- 58  # A dict from 'filename'->_MultiStore instances 
- 59  _multistores = {} 
- 60  _multistores_lock = threading.Lock() 
-
61 - 62 - 63 -class Error(Exception): -
64 """Base error for this module.""" - 65 pass -
66 -
67 - 68 -class NewerCredentialStoreError(Error): -
69 """The credential store is a newer version that supported.""" - 70 pass -
71 -
72 - 73 @util.positional(4) - 74 -def get_credential_storage(filename, client_id, user_agent, scope, - 75 warn_on_readonly=True): -
76 """Get a Storage instance for a credential. - 77 - 78 Args: - 79 filename: The JSON file storing a set of credentials - 80 client_id: The client_id for the credential - 81 user_agent: The user agent for the credential - 82 scope: string or iterable of strings, Scope(s) being requested - 83 warn_on_readonly: if True, log a warning if the store is readonly - 84 - 85 Returns: - 86 An object derived from client.Storage for getting/setting the - 87 credential. - 88 """ - 89 # Recreate the legacy key with these specific parameters - 90 key = {'clientId': client_id, 'userAgent': user_agent, - 91 'scope': util.scopes_to_string(scope)} - 92 return get_credential_storage_custom_key( - 93 filename, key, warn_on_readonly=warn_on_readonly) -
94 -
95 - 96 @util.positional(2) - 97 -def get_credential_storage_custom_string_key( - 98 filename, key_string, warn_on_readonly=True): -
99 """Get a Storage instance for a credential using a single string as a key. -100 -101 Allows you to provide a string as a custom key that will be used for -102 credential storage and retrieval. -103 -104 Args: -105 filename: The JSON file storing a set of credentials -106 key_string: A string to use as the key for storing this credential. -107 warn_on_readonly: if True, log a warning if the store is readonly -108 -109 Returns: -110 An object derived from client.Storage for getting/setting the -111 credential. -112 """ -113 # Create a key dictionary that can be used -114 key_dict = {'key': key_string} -115 return get_credential_storage_custom_key( -116 filename, key_dict, warn_on_readonly=warn_on_readonly) -
117 -
118 -119 @util.positional(2) -120 -def get_credential_storage_custom_key( -121 filename, key_dict, warn_on_readonly=True): -
122 """Get a Storage instance for a credential using a dictionary as a key. -123 -124 Allows you to provide a dictionary as a custom key that will be used for -125 credential storage and retrieval. -126 -127 Args: -128 filename: The JSON file storing a set of credentials -129 key_dict: A dictionary to use as the key for storing this credential. There -130 is no ordering of the keys in the dictionary. Logically equivalent -131 dictionaries will produce equivalent storage keys. -132 warn_on_readonly: if True, log a warning if the store is readonly -133 -134 Returns: -135 An object derived from client.Storage for getting/setting the -136 credential. -137 """ -138 multistore = _get_multistore(filename, warn_on_readonly=warn_on_readonly) -139 key = util.dict_to_tuple_key(key_dict) -140 return multistore._get_storage(key) -
141 -
142 -143 @util.positional(1) -144 -def get_all_credential_keys(filename, warn_on_readonly=True): -
145 """Gets all the registered credential keys in the given Multistore. -146 -147 Args: -148 filename: The JSON file storing a set of credentials -149 warn_on_readonly: if True, log a warning if the store is readonly -150 -151 Returns: -152 A list of the credential keys present in the file. They are returned as -153 dictionaries that can be passed into get_credential_storage_custom_key to -154 get the actual credentials. -155 """ -156 multistore = _get_multistore(filename, warn_on_readonly=warn_on_readonly) -157 multistore._lock() -158 try: -159 return multistore._get_all_credential_keys() -160 finally: -161 multistore._unlock() -
162 -
163 -164 @util.positional(1) -165 -def _get_multistore(filename, warn_on_readonly=True): -
166 """A helper method to initialize the multistore with proper locking. -167 -168 Args: -169 filename: The JSON file storing a set of credentials -170 warn_on_readonly: if True, log a warning if the store is readonly -171 -172 Returns: -173 A multistore object -174 """ -175 filename = os.path.expanduser(filename) -176 _multistores_lock.acquire() -177 try: -178 multistore = _multistores.setdefault( -179 filename, _MultiStore(filename, warn_on_readonly=warn_on_readonly)) -180 finally: -181 _multistores_lock.release() -182 return multistore -
183 -
184 -185 -class _MultiStore(object): -
186 """A file backed store for multiple credentials.""" -187 -188 @util.positional(2) -
189 - def __init__(self, filename, warn_on_readonly=True): -
190 """Initialize the class. -191 -192 This will create the file if necessary. -193 """ -194 self._file = LockedFile(filename, 'r+', 'r') -195 self._thread_lock = threading.Lock() -196 self._read_only = False -197 self._warn_on_readonly = warn_on_readonly -198 -199 self._create_file_if_needed() -200 -201 # Cache of deserialized store. This is only valid after the -202 # _MultiStore is locked or _refresh_data_cache is called. This is -203 # of the form of: -204 # -205 # ((key, value), (key, value)...) -> OAuth2Credential -206 # -207 # If this is None, then the store hasn't been read yet. -208 self._data = None -
209 -
210 - class _Storage(BaseStorage): -
211 """A Storage object that knows how to read/write a single credential.""" -212 -
213 - def __init__(self, multistore, key): -
214 self._multistore = multistore -215 self._key = key -
216 -
217 - def acquire_lock(self): -
218 """Acquires any lock necessary to access this Storage. -219 -220 This lock is not reentrant. -221 """ -222 self._multistore._lock() -
223 -
224 - def release_lock(self): -
225 """Release the Storage lock. -226 -227 Trying to release a lock that isn't held will result in a -228 RuntimeError. -229 """ -230 self._multistore._unlock() -
231 -
232 - def locked_get(self): -
233 """Retrieve credential. -234 -235 The Storage lock must be held when this is called. -236 -237 Returns: -238 oauth2client.client.Credentials -239 """ -240 credential = self._multistore._get_credential(self._key) -241 if credential: -242 credential.set_store(self) -243 return credential -
244 -
245 - def locked_put(self, credentials): -
246 """Write a credential. -247 -248 The Storage lock must be held when this is called. -249 -250 Args: -251 credentials: Credentials, the credentials to store. -252 """ -253 self._multistore._update_credential(self._key, credentials) -
254 -
255 - def locked_delete(self): -
256 """Delete a credential. -257 -258 The Storage lock must be held when this is called. -259 -260 Args: -261 credentials: Credentials, the credentials to store. -262 """ -263 self._multistore._delete_credential(self._key) -
264 -
265 - def _create_file_if_needed(self): -
266 """Create an empty file if necessary. -267 -268 This method will not initialize the file. Instead it implements a -269 simple version of "touch" to ensure the file has been created. -270 """ -271 if not os.path.exists(self._file.filename()): -272 old_umask = os.umask(0o177) -273 try: -274 open(self._file.filename(), 'a+b').close() -275 finally: -276 os.umask(old_umask) -
277 -
278 - def _lock(self): -
279 """Lock the entire multistore.""" -280 self._thread_lock.acquire() -281 self._file.open_and_lock() -282 if not self._file.is_locked(): -283 self._read_only = True -284 if self._warn_on_readonly: -285 logger.warn('The credentials file (%s) is not writable. Opening in ' -286 'read-only mode. Any refreshed credentials will only be ' -287 'valid for this run.', self._file.filename()) -288 if os.path.getsize(self._file.filename()) == 0: -289 logger.debug('Initializing empty multistore file') -290 # The multistore is empty so write out an empty file. -291 self._data = {} -292 self._write() -293 elif not self._read_only or self._data is None: -294 # Only refresh the data if we are read/write or we haven't -295 # cached the data yet. If we are readonly, we assume is isn't -296 # changing out from under us and that we only have to read it -297 # once. This prevents us from whacking any new access keys that -298 # we have cached in memory but were unable to write out. -299 self._refresh_data_cache() -
300 -
301 - def _unlock(self): -
302 """Release the lock on the multistore.""" -303 self._file.unlock_and_close() -304 self._thread_lock.release() -
305 -
306 - def _locked_json_read(self): -
307 """Get the raw content of the multistore file. -308 -309 The multistore must be locked when this is called. -310 -311 Returns: -312 The contents of the multistore decoded as JSON. -313 """ -314 assert self._thread_lock.locked() -315 self._file.file_handle().seek(0) -316 return json.load(self._file.file_handle()) -
317 -
318 - def _locked_json_write(self, data): -
319 """Write a JSON serializable data structure to the multistore. -320 -321 The multistore must be locked when this is called. -322 -323 Args: -324 data: The data to be serialized and written. -325 """ -326 assert self._thread_lock.locked() -327 if self._read_only: -328 return -329 self._file.file_handle().seek(0) -330 json.dump(data, self._file.file_handle(), sort_keys=True, indent=2, separators=(',', ': ')) -331 self._file.file_handle().truncate() -
332 -
333 - def _refresh_data_cache(self): -
334 """Refresh the contents of the multistore. -335 -336 The multistore must be locked when this is called. -337 -338 Raises: -339 NewerCredentialStoreError: Raised when a newer client has written the -340 store. -341 """ -342 self._data = {} -343 try: -344 raw_data = self._locked_json_read() -345 except Exception: -346 logger.warn('Credential data store could not be loaded. ' -347 'Will ignore and overwrite.') -348 return -349 -350 version = 0 -351 try: -352 version = raw_data['file_version'] -353 except Exception: -354 logger.warn('Missing version for credential data store. It may be ' -355 'corrupt or an old version. Overwriting.') -356 if version > 1: -357 raise NewerCredentialStoreError( -358 'Credential file has file_version of %d. ' -359 'Only file_version of 1 is supported.' % version) -360 -361 credentials = [] -362 try: -363 credentials = raw_data['data'] -364 except (TypeError, KeyError): -365 pass -366 -367 for cred_entry in credentials: -368 try: -369 (key, credential) = self._decode_credential_from_json(cred_entry) -370 self._data[key] = credential -371 except: -372 # If something goes wrong loading a credential, just ignore it -373 logger.info('Error decoding credential, skipping', exc_info=True) -
374 -
375 - def _decode_credential_from_json(self, cred_entry): -
376 """Load a credential from our JSON serialization. -377 -378 Args: -379 cred_entry: A dict entry from the data member of our format -380 -381 Returns: -382 (key, cred) where the key is the key tuple and the cred is the -383 OAuth2Credential object. -384 """ -385 raw_key = cred_entry['key'] -386 key = util.dict_to_tuple_key(raw_key) -387 credential = None -388 credential = Credentials.new_from_json(json.dumps(cred_entry['credential'])) -389 return (key, credential) -
390 -
391 - def _write(self): -
392 """Write the cached data back out. -393 -394 The multistore must be locked. -395 """ -396 raw_data = {'file_version': 1} -397 raw_creds = [] -398 raw_data['data'] = raw_creds -399 for (cred_key, cred) in self._data.items(): -400 raw_key = dict(cred_key) -401 raw_cred = json.loads(cred.to_json()) -402 raw_creds.append({'key': raw_key, 'credential': raw_cred}) -403 self._locked_json_write(raw_data) -
404 -
405 - def _get_all_credential_keys(self): -
406 """Gets all the registered credential keys in the multistore. -407 -408 Returns: -409 A list of dictionaries corresponding to all the keys currently registered -410 """ -411 return [dict(key) for key in self._data.keys()] -
412 -
413 - def _get_credential(self, key): -
414 """Get a credential from the multistore. -415 -416 The multistore must be locked. -417 -418 Args: -419 key: The key used to retrieve the credential -420 -421 Returns: -422 The credential specified or None if not present -423 """ -424 return self._data.get(key, None) -
425 -
426 - def _update_credential(self, key, cred): -
427 """Update a credential and write the multistore. -428 -429 This must be called when the multistore is locked. -430 -431 Args: -432 key: The key used to retrieve the credential -433 cred: The OAuth2Credential to update/set -434 """ -435 self._data[key] = cred -436 self._write() -
437 -
438 - def _delete_credential(self, key): -
439 """Delete a credential and write the multistore. -440 -441 This must be called when the multistore is locked. -442 -443 Args: -444 key: The key used to retrieve the credential -445 """ -446 try: -447 del self._data[key] -448 except KeyError: -449 pass -450 self._write() -
451 -
452 - def _get_storage(self, key): -
453 """Get a Storage object to get/set a credential. -454 -455 This Storage is a 'view' into the multistore. -456 -457 Args: -458 key: The key used to retrieve the credential -459 -460 Returns: -461 A Storage object that can be used to get/set this cred -462 """ -463 return self._Storage(self, key) -
464 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.multistore_file.Error-class.html b/docs/epy/oauth2client.multistore_file.Error-class.html deleted file mode 100644 index e00044d..0000000 --- a/docs/epy/oauth2client.multistore_file.Error-class.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - oauth2client.multistore_file.Error - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module multistore_file :: - Class Error - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class Error

source code

-
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-Base error for this module.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.multistore_file.NewerCredentialStoreError-class.html b/docs/epy/oauth2client.multistore_file.NewerCredentialStoreError-class.html deleted file mode 100644 index 0ac415e..0000000 --- a/docs/epy/oauth2client.multistore_file.NewerCredentialStoreError-class.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - oauth2client.multistore_file.NewerCredentialStoreError - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module multistore_file :: - Class NewerCredentialStoreError - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class NewerCredentialStoreError

source code

-
-
- - - - - - - - - - - - - - - - - - - - -
-
-
-
-The credential store is a newer version that supported.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from exceptions.Exception: - __init__, - __new__ -

-

Inherited from exceptions.BaseException: - __delattr__, - __getattribute__, - __getitem__, - __getslice__, - __reduce__, - __repr__, - __setattr__, - __setstate__, - __str__, - __unicode__ -

-

Inherited from object: - __format__, - __hash__, - __reduce_ex__, - __sizeof__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from exceptions.BaseException: - args, - message -

-

Inherited from object: - __class__ -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.multistore_file._MultiStore-class.html b/docs/epy/oauth2client.multistore_file._MultiStore-class.html deleted file mode 100644 index 7fff4dd..0000000 --- a/docs/epy/oauth2client.multistore_file._MultiStore-class.html +++ /dev/null @@ -1,813 +0,0 @@ - - - - - oauth2client.multistore_file._MultiStore - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module multistore_file :: - Class _MultiStore - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class _MultiStore

source code

-
-
- - - - -
-
-
-
-A file backed store for multiple credentials.
-
-
- - - - - - - - - - -
- - - - - -
Nested Classes[hide private]
-
-   - - _Storage
- A Storage object that knows how to read/write a single credential. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - filename, - warn_on_readonly=True)
- Initialize the class.
- source code - -
- -
-   - - - - - - -
_create_file_if_needed(self)
- Create an empty file if necessary.
- source code - -
- -
-   - - - - - - -
_lock(self)
- Lock the entire multistore.
- source code - -
- -
-   - - - - - - -
_unlock(self)
- Release the lock on the multistore.
- source code - -
- -
-   - - - - - - -
_locked_json_read(self)
- Get the raw content of the multistore file.
- source code - -
- -
-   - - - - - - -
_locked_json_write(self, - data)
- Write a JSON serializable data structure to the multistore.
- source code - -
- -
-   - - - - - - -
_refresh_data_cache(self)
- Refresh the contents of the multistore.
- source code - -
- -
-   - - - - - - -
_decode_credential_from_json(self, - cred_entry)
- Load a credential from our JSON serialization.
- source code - -
- -
-   - - - - - - -
_write(self)
- Write the cached data back out.
- source code - -
- -
-   - - - - - - -
_get_all_credential_keys(self)
- Gets all the registered credential keys in the multistore.
- source code - -
- -
-   - - - - - - -
_get_credential(self, - key)
- Get a credential from the multistore.
- source code - -
- -
-   - - - - - - -
_update_credential(self, - key, - cred)
- Update a credential and write the multistore.
- source code - -
- -
-   - - - - - - -
_delete_credential(self, - key)
- Delete a credential and write the multistore.
- source code - -
- -
-   - - - - - - -
_get_storage(self, - key)
- Get a Storage object to get/set a credential.
- source code - -
- -
-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - filename, - warn_on_readonly=True) -
(Constructor) -

-
source code  -
- -
-Initialize the class.
-
-This will create the file if necessary.
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
Overrides: - object.__init__ -
-
-
-
- -
- -
- - -
-

_create_file_if_needed(self) -

-
source code  -
- -
-Create an empty file if necessary.
-
-This method will not initialize the file. Instead it implements a
-simple version of "touch" to ensure the file has been created.
-
-
-
-
-
-
- -
- -
- - -
-

_locked_json_read(self) -

-
source code  -
- -
-Get the raw content of the multistore file.
-
-The multistore must be locked when this is called.
-
-Returns:
-  The contents of the multistore decoded as JSON.
-
-
-
-
-
-
- -
- -
- - -
-

_locked_json_write(self, - data) -

-
source code  -
- -
-Write a JSON serializable data structure to the multistore.
-
-The multistore must be locked when this is called.
-
-Args:
-  data: The data to be serialized and written.
-
-
-
-
-
-
- -
- -
- - -
-

_refresh_data_cache(self) -

-
source code  -
- -
-Refresh the contents of the multistore.
-
-The multistore must be locked when this is called.
-
-Raises:
-  NewerCredentialStoreError: Raised when a newer client has written the
-    store.
-
-
-
-
-
-
- -
- -
- - -
-

_decode_credential_from_json(self, - cred_entry) -

-
source code  -
- -
-Load a credential from our JSON serialization.
-
-Args:
-  cred_entry: A dict entry from the data member of our format
-
-Returns:
-  (key, cred) where the key is the key tuple and the cred is the
-    OAuth2Credential object.
-
-
-
-
-
-
- -
- -
- - -
-

_write(self) -

-
source code  -
- -
-Write the cached data back out.
-
-The multistore must be locked.
-
-
-
-
-
-
- -
- -
- - -
-

_get_all_credential_keys(self) -

-
source code  -
- -
-Gets all the registered credential keys in the multistore.
-
-Returns:
-  A list of dictionaries corresponding to all the keys currently registered
-
-
-
-
-
-
- -
- -
- - -
-

_get_credential(self, - key) -

-
source code  -
- -
-Get a credential from the multistore.
-
-The multistore must be locked.
-
-Args:
-  key: The key used to retrieve the credential
-
-Returns:
-  The credential specified or None if not present
-
-
-
-
-
-
- -
- -
- - -
-

_update_credential(self, - key, - cred) -

-
source code  -
- -
-Update a credential and write the multistore.
-
-This must be called when the multistore is locked.
-
-Args:
-  key: The key used to retrieve the credential
-  cred: The OAuth2Credential to update/set
-
-
-
-
-
-
- -
- -
- - -
-

_delete_credential(self, - key) -

-
source code  -
- -
-Delete a credential and write the multistore.
-
-This must be called when the multistore is locked.
-
-Args:
-  key: The key used to retrieve the credential
-
-
-
-
-
-
- -
- -
- - -
-

_get_storage(self, - key) -

-
source code  -
- -
-Get a Storage object to get/set a credential.
-
-This Storage is a 'view' into the multistore.
-
-Args:
-  key: The key used to retrieve the credential
-
-Returns:
-  A Storage object that can be used to get/set this cred
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.multistore_file._MultiStore._Storage-class.html b/docs/epy/oauth2client.multistore_file._MultiStore._Storage-class.html deleted file mode 100644 index 33cacc9..0000000 --- a/docs/epy/oauth2client.multistore_file._MultiStore._Storage-class.html +++ /dev/null @@ -1,494 +0,0 @@ - - - - - oauth2client.multistore_file._MultiStore._Storage - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module multistore_file :: - Class _MultiStore :: - Class _Storage - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class _Storage

source code

-
-
- - - - - - - - - - - - - -
-
-
-
-A Storage object that knows how to read/write a single credential.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - multistore, - key)
- x.__init__(...) initializes x; see help(type(x)) for signature
- source code - -
- -
-   - - - - - - -
acquire_lock(self)
- Acquires any lock necessary to access this Storage.
- source code - -
- -
-   - - - - - - -
release_lock(self)
- Release the Storage lock.
- source code - -
- -
-   - - - - - - -
locked_get(self)
- Retrieve credential.
- source code - -
- -
-   - - - - - - -
locked_put(self, - credentials)
- Write a credential.
- source code - -
- -
-   - - - - - - -
locked_delete(self)
- Delete a credential.
- source code - -
- -
-

Inherited from client.Storage: - delete, - get, - put -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - multistore, - key) -
(Constructor) -

-
source code  -
- -
-x.__init__(...) initializes x; see help(type(x)) for signature
-
-
-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

acquire_lock(self) -

-
source code  -
- -
-Acquires any lock necessary to access this Storage.
-
-This lock is not reentrant.
-
-
-
-
Overrides: - client.Storage.acquire_lock -
-
-
-
- -
- -
- - -
-

release_lock(self) -

-
source code  -
- -
-Release the Storage lock.
-
-Trying to release a lock that isn't held will result in a
-RuntimeError.
-
-
-
-
Overrides: - client.Storage.release_lock -
-
-
-
- -
- -
- - -
-

locked_get(self) -

-
source code  -
- -
-Retrieve credential.
-
-The Storage lock must be held when this is called.
-
-Returns:
-  oauth2client.client.Credentials
-
-
-
-
Overrides: - client.Storage.locked_get -
-
-
-
- -
- -
- - -
-

locked_put(self, - credentials) -

-
source code  -
- -
-Write a credential.
-
-The Storage lock must be held when this is called.
-
-Args:
-  credentials: Credentials, the credentials to store.
-
-
-
-
Overrides: - client.Storage.locked_put -
-
-
-
- -
- -
- - -
-

locked_delete(self) -

-
source code  -
- -
-Delete a credential.
-
-The Storage lock must be held when this is called.
-
-Args:
-  credentials: Credentials, the credentials to store.
-
-
-
-
Overrides: - client.Storage.locked_delete -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.old_run-module.html b/docs/epy/oauth2client.old_run-module.html deleted file mode 100644 index d1fc7d8..0000000 --- a/docs/epy/oauth2client.old_run-module.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - oauth2client.old_run - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module old_run - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module old_run

source code

-
-This module holds the old run() function which is deprecated, the
-tools.run_flow() function should be used in its place.
-
-
- - - - - - - - - - -
- - - - - -
Functions[hide private]
-
-   - - - - - - -
run(flow, - storage, - http=None)
- Core code for a command-line application.
- source code - -
- -
- - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - FLAGS = gflags.FLAGS -
- - - - - - -
- - - - - -
Function Details[hide private]
-
- -
- -
- - -
-

run(flow, - storage, - http=None) -

-
source code  -
- -
-Core code for a command-line application.
-
-The run() function is called from your application and runs through all
-the steps to obtain credentials. It takes a Flow argument and attempts to
-open an authorization server page in the user's default web browser. The
-server asks the user to grant your application access to the user's data.
-If the user grants access, the run() function returns new credentials. The
-new credentials are also stored in the Storage argument, which updates the
-file associated with the Storage object.
-
-It presumes it is run from a command-line application and supports the
-following flags:
-
-  --auth_host_name: Host name to use when running a local web server
-    to handle redirects during OAuth authorization.
-    (default: 'localhost')
-
-  --auth_host_port: Port to use when running a local web server to handle
-  redirects during OAuth authorization.;
-    repeat this option to specify a list of values
-    (default: '[8080, 8090]')
-    (an integer)
-
-  --[no]auth_local_webserver: Run a local web server to handle redirects
-    during OAuth authorization.
-    (default: 'true')
-
-Since it uses flags make sure to initialize the gflags module before
-calling run().
-
-Args:
-  flow: Flow, an OAuth 2.0 Flow to step through.
-  storage: Storage, a Storage to store the credential in.
-  http: An instance of httplib2.Http.request
-       or something that acts like it.
-
-Returns:
-  Credentials, the obtained credential.
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.old_run-pysrc.html b/docs/epy/oauth2client.old_run-pysrc.html deleted file mode 100644 index c2e9aef..0000000 --- a/docs/epy/oauth2client.old_run-pysrc.html +++ /dev/null @@ -1,272 +0,0 @@ - - - - - oauth2client.old_run - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module old_run - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.old_run

-
-  1  # Copyright 2014 Google Inc. All rights reserved. 
-  2  # 
-  3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  4  # you may not use this file except in compliance with the License. 
-  5  # You may obtain a copy of the License at 
-  6  # 
-  7  #      http://www.apache.org/licenses/LICENSE-2.0 
-  8  # 
-  9  # Unless required by applicable law or agreed to in writing, software 
- 10  # distributed under the License is distributed on an "AS IS" BASIS, 
- 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 12  # See the License for the specific language governing permissions and 
- 13  # limitations under the License. 
- 14   
- 15  """This module holds the old run() function which is deprecated, the 
- 16  tools.run_flow() function should be used in its place.""" 
- 17   
- 18  from __future__ import print_function 
- 19   
- 20  import logging 
- 21  import socket 
- 22  import sys 
- 23  import webbrowser 
- 24   
- 25  import gflags 
- 26   
- 27  from oauth2client import client 
- 28  from oauth2client import util 
- 29  from oauth2client.tools import ClientRedirectHandler 
- 30  from oauth2client.tools import ClientRedirectServer 
- 31   
- 32   
- 33  FLAGS = gflags.FLAGS 
- 34   
- 35  gflags.DEFINE_boolean('auth_local_webserver', True, 
- 36                        ('Run a local web server to handle redirects during ' 
- 37                         'OAuth authorization.')) 
- 38   
- 39  gflags.DEFINE_string('auth_host_name', 'localhost', 
- 40                       ('Host name to use when running a local web server to ' 
- 41                        'handle redirects during OAuth authorization.')) 
- 42   
- 43  gflags.DEFINE_multi_int('auth_host_port', [8080, 8090], 
- 44                          ('Port to use when running a local web server to ' 
- 45                           'handle redirects during OAuth authorization.')) 
-
46 - 47 - 48 @util.positional(2) - 49 -def run(flow, storage, http=None): -
50 """Core code for a command-line application. - 51 - 52 The run() function is called from your application and runs through all - 53 the steps to obtain credentials. It takes a Flow argument and attempts to - 54 open an authorization server page in the user's default web browser. The - 55 server asks the user to grant your application access to the user's data. - 56 If the user grants access, the run() function returns new credentials. The - 57 new credentials are also stored in the Storage argument, which updates the - 58 file associated with the Storage object. - 59 - 60 It presumes it is run from a command-line application and supports the - 61 following flags: - 62 - 63 --auth_host_name: Host name to use when running a local web server - 64 to handle redirects during OAuth authorization. - 65 (default: 'localhost') - 66 - 67 --auth_host_port: Port to use when running a local web server to handle - 68 redirects during OAuth authorization.; - 69 repeat this option to specify a list of values - 70 (default: '[8080, 8090]') - 71 (an integer) - 72 - 73 --[no]auth_local_webserver: Run a local web server to handle redirects - 74 during OAuth authorization. - 75 (default: 'true') - 76 - 77 Since it uses flags make sure to initialize the gflags module before - 78 calling run(). - 79 - 80 Args: - 81 flow: Flow, an OAuth 2.0 Flow to step through. - 82 storage: Storage, a Storage to store the credential in. - 83 http: An instance of httplib2.Http.request - 84 or something that acts like it. - 85 - 86 Returns: - 87 Credentials, the obtained credential. - 88 """ - 89 logging.warning('This function, oauth2client.tools.run(), and the use of ' - 90 'the gflags library are deprecated and will be removed in a future ' - 91 'version of the library.') - 92 if FLAGS.auth_local_webserver: - 93 success = False - 94 port_number = 0 - 95 for port in FLAGS.auth_host_port: - 96 port_number = port - 97 try: - 98 httpd = ClientRedirectServer((FLAGS.auth_host_name, port), - 99 ClientRedirectHandler) -100 except socket.error as e: -101 pass -102 else: -103 success = True -104 break -105 FLAGS.auth_local_webserver = success -106 if not success: -107 print('Failed to start a local webserver listening on either port 8080') -108 print('or port 9090. Please check your firewall settings and locally') -109 print('running programs that may be blocking or using those ports.') -110 print() -111 print('Falling back to --noauth_local_webserver and continuing with') -112 print('authorization.') -113 print() -114 -115 if FLAGS.auth_local_webserver: -116 oauth_callback = 'http://%s:%s/' % (FLAGS.auth_host_name, port_number) -117 else: -118 oauth_callback = client.OOB_CALLBACK_URN -119 flow.redirect_uri = oauth_callback -120 authorize_url = flow.step1_get_authorize_url() -121 -122 if FLAGS.auth_local_webserver: -123 webbrowser.open(authorize_url, new=1, autoraise=True) -124 print('Your browser has been opened to visit:') -125 print() -126 print(' ' + authorize_url) -127 print() -128 print('If your browser is on a different machine then exit and re-run') -129 print('this application with the command-line parameter ') -130 print() -131 print(' --noauth_local_webserver') -132 print() -133 else: -134 print('Go to the following link in your browser:') -135 print() -136 print(' ' + authorize_url) -137 print() -138 -139 code = None -140 if FLAGS.auth_local_webserver: -141 httpd.handle_request() -142 if 'error' in httpd.query_params: -143 sys.exit('Authentication request was rejected.') -144 if 'code' in httpd.query_params: -145 code = httpd.query_params['code'] -146 else: -147 print('Failed to find "code" in the query parameters of the redirect.') -148 sys.exit('Try running with --noauth_local_webserver.') -149 else: -150 code = raw_input('Enter verification code: ').strip() -151 -152 try: -153 credential = flow.step2_exchange(code, http=http) -154 except client.FlowExchangeError as e: -155 sys.exit('Authentication has failed: %s' % e) -156 -157 storage.put(credential) -158 credential.set_store(storage) -159 print('Authentication successful.') -160 -161 return credential -
162 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.service_account-module.html b/docs/epy/oauth2client.service_account-module.html deleted file mode 100644 index 77efb4a..0000000 --- a/docs/epy/oauth2client.service_account-module.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - oauth2client.service_account - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module service_account - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module service_account

source code

-
-A service account credentials class.
-
-This credentials class is implemented on top of rsa library.
-
-
- - - - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - _ServiceAccountCredentials
- Class representing a service account (signed JWT) credential. -
- - - - - - - - - - - - -
- - - - - -
Functions[hide private]
-
-   - - - - - - -
_urlsafe_b64encode(data) - source code - -
- -
-   - - - - - - -
_get_private_key(private_key_pkcs8_text)
- Get an RSA private key object from a pkcs8 representation.
- source code - -
- -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.service_account-pysrc.html b/docs/epy/oauth2client.service_account-pysrc.html deleted file mode 100644 index 611605b..0000000 --- a/docs/epy/oauth2client.service_account-pysrc.html +++ /dev/null @@ -1,276 +0,0 @@ - - - - - oauth2client.service_account - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module service_account - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.service_account

-
-  1  # Copyright 2014 Google Inc. All rights reserved. 
-  2  # 
-  3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  4  # you may not use this file except in compliance with the License. 
-  5  # You may obtain a copy of the License at 
-  6  # 
-  7  #      http://www.apache.org/licenses/LICENSE-2.0 
-  8  # 
-  9  # Unless required by applicable law or agreed to in writing, software 
- 10  # distributed under the License is distributed on an "AS IS" BASIS, 
- 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 12  # See the License for the specific language governing permissions and 
- 13  # limitations under the License. 
- 14   
- 15  """A service account credentials class. 
- 16   
- 17  This credentials class is implemented on top of rsa library. 
- 18  """ 
- 19   
- 20  import base64 
- 21  import json 
- 22  import time 
- 23   
- 24  from pyasn1.codec.ber import decoder 
- 25  from pyasn1_modules.rfc5208 import PrivateKeyInfo 
- 26  import rsa 
- 27   
- 28  from oauth2client import GOOGLE_REVOKE_URI 
- 29  from oauth2client import GOOGLE_TOKEN_URI 
- 30  from oauth2client import util 
- 31  from oauth2client.client import AssertionCredentials 
-
32 - 33 - 34 -class _ServiceAccountCredentials(AssertionCredentials): -
35 """Class representing a service account (signed JWT) credential.""" - 36 - 37 MAX_TOKEN_LIFETIME_SECS = 3600 # 1 hour in seconds - 38 -
39 - def __init__(self, service_account_id, service_account_email, private_key_id, - 40 private_key_pkcs8_text, scopes, user_agent=None, - 41 token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, - 42 **kwargs): -
43 - 44 super(_ServiceAccountCredentials, self).__init__( - 45 None, user_agent=user_agent, token_uri=token_uri, revoke_uri=revoke_uri) - 46 - 47 self._service_account_id = service_account_id - 48 self._service_account_email = service_account_email - 49 self._private_key_id = private_key_id - 50 self._private_key = _get_private_key(private_key_pkcs8_text) - 51 self._private_key_pkcs8_text = private_key_pkcs8_text - 52 self._scopes = util.scopes_to_string(scopes) - 53 self._user_agent = user_agent - 54 self._token_uri = token_uri - 55 self._revoke_uri = revoke_uri - 56 self._kwargs = kwargs -
57 -
58 - def _generate_assertion(self): -
59 """Generate the assertion that will be used in the request.""" - 60 - 61 header = { - 62 'alg': 'RS256', - 63 'typ': 'JWT', - 64 'kid': self._private_key_id - 65 } - 66 - 67 now = int(time.time()) - 68 payload = { - 69 'aud': self._token_uri, - 70 'scope': self._scopes, - 71 'iat': now, - 72 'exp': now + _ServiceAccountCredentials.MAX_TOKEN_LIFETIME_SECS, - 73 'iss': self._service_account_email - 74 } - 75 payload.update(self._kwargs) - 76 - 77 assertion_input = '%s.%s' % ( - 78 _urlsafe_b64encode(header), - 79 _urlsafe_b64encode(payload)) - 80 assertion_input = assertion_input.encode('utf-8') - 81 - 82 # Sign the assertion. - 83 signature = bytes.decode(base64.urlsafe_b64encode(rsa.pkcs1.sign( - 84 assertion_input, self._private_key, 'SHA-256'))).rstrip('=') - 85 - 86 return '%s.%s' % (assertion_input, signature) -
87 -
88 - def sign_blob(self, blob): -
89 # Ensure that it is bytes - 90 try: - 91 blob = blob.encode('utf-8') - 92 except AttributeError: - 93 pass - 94 return (self._private_key_id, - 95 rsa.pkcs1.sign(blob, self._private_key, 'SHA-256')) -
96 - 97 @property -
98 - def service_account_email(self): -
99 return self._service_account_email -
100 -101 @property -
102 - def serialization_data(self): -
103 return { -104 'type': 'service_account', -105 'client_id': self._service_account_id, -106 'client_email': self._service_account_email, -107 'private_key_id': self._private_key_id, -108 'private_key': self._private_key_pkcs8_text -109 } -
110 -
111 - def create_scoped_required(self): -
112 return not self._scopes -
113 -
114 - def create_scoped(self, scopes): -
115 return _ServiceAccountCredentials(self._service_account_id, -116 self._service_account_email, -117 self._private_key_id, -118 self._private_key_pkcs8_text, -119 scopes, -120 user_agent=self._user_agent, -121 token_uri=self._token_uri, -122 revoke_uri=self._revoke_uri, -123 **self._kwargs) -
124 -
125 -126 -def _urlsafe_b64encode(data): -
127 return base64.urlsafe_b64encode( -128 json.dumps(data, separators=(',', ':')).encode('UTF-8')).rstrip(b'=') -
129 -
130 -131 -def _get_private_key(private_key_pkcs8_text): -
132 """Get an RSA private key object from a pkcs8 representation.""" -133 -134 der = rsa.pem.load_pem(private_key_pkcs8_text, 'PRIVATE KEY') -135 asn1_private_key, _ = decoder.decode(der, asn1Spec=PrivateKeyInfo()) -136 return rsa.PrivateKey.load_pkcs1( -137 asn1_private_key.getComponentByName('privateKey').asOctets(), -138 format='DER') -
139 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.service_account._ServiceAccountCredentials-class.html b/docs/epy/oauth2client.service_account._ServiceAccountCredentials-class.html deleted file mode 100644 index 5b98374..0000000 --- a/docs/epy/oauth2client.service_account._ServiceAccountCredentials-class.html +++ /dev/null @@ -1,645 +0,0 @@ - - - - - oauth2client.service_account._ServiceAccountCredentials - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module service_account :: - Class _ServiceAccountCredentials - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class _ServiceAccountCredentials

source code

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-Class representing a service account (signed JWT) credential.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
__init__(self, - service_account_id, - service_account_email, - private_key_id, - private_key_pkcs8_text, - scopes, - user_agent=None, - token_uri=GOOGLE_TOKEN_URI, - revoke_uri=GOOGLE_REVOKE_URI, - **kwargs)
- Constructor for AssertionFlowCredentials.
- source code - -
- -
-   - - - - - - -
_generate_assertion(self)
- Generate the assertion that will be used in the request.
- source code - -
- -
-   - - - - - - -
sign_blob(self, - blob) - source code - -
- -
-   - - - - - - -
service_account_email(self) - source code - -
- -
-   - - - - - - -
serialization_data(self)
- Get the fields and their values identifying the current credentials.
- source code - -
- -
-   - - - - - - -
create_scoped_required(self)
- Whether this Credentials object is scopeless.
- source code - -
- -
-   - - - - - - -
create_scoped(self, - scopes)
- Create a Credentials object for the given scopes.
- source code - -
- -
- -

Inherited from client.OAuth2Credentials: - __getstate__, - __setstate__, - access_token_expired, - apply, - authorize, - get_access_token, - refresh, - revoke, - set_store, - to_json -

- -

Inherited from client.Credentials (private): - _to_json -

-

Inherited from object: - __delattr__, - __format__, - __getattribute__, - __hash__, - __new__, - __reduce__, - __reduce_ex__, - __repr__, - __setattr__, - __sizeof__, - __str__, - __subclasshook__ -

-
- - - - - - - - - -
- - - - - -
Class Methods[hide private]
-
-

Inherited from client.OAuth2Credentials: - from_json -

-

Inherited from client.Credentials: - new_from_json -

-
- - - - - - - - - -
- - - - - -
Static Methods[hide private]
-
-

Inherited from client.GoogleCredentials: - from_stream, - get_application_default -

-
- - - - - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - MAX_TOKEN_LIFETIME_SECS = 3600 -
-

Inherited from client.Credentials: - NON_SERIALIZED_MEMBERS -

-
- - - - - - - - - -
- - - - - -
Properties[hide private]
-
-

Inherited from object: - __class__ -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

__init__(self, - service_account_id, - service_account_email, - private_key_id, - private_key_pkcs8_text, - scopes, - user_agent=None, - token_uri=GOOGLE_TOKEN_URI, - revoke_uri=GOOGLE_REVOKE_URI, - **kwargs) -
(Constructor) -

-
source code  -
- -
-Constructor for AssertionFlowCredentials.
-
-Args:
-  assertion_type: string, assertion type that will be declared to the auth
-    server
-  user_agent: string, The HTTP User-Agent to provide for this application.
-  token_uri: string, URI for token endpoint. For convenience
-    defaults to Google's endpoints but any OAuth 2.0 provider can be used.
-  revoke_uri: string, URI for revoke endpoint.
-
-
-
-
Overrides: - object.__init__ -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

_generate_assertion(self) -

-
source code  -
- -
-Generate the assertion that will be used in the request.
-
-
-
-
Overrides: - client.AssertionCredentials._generate_assertion -
-
-
-
- -
- -
- - -
-

service_account_email(self) -

-
source code  -
- - -
-
Decorators:
-
    -
  • @property
  • -
-
-
-
- -
- -
- - -
-

serialization_data(self) -

-
source code  -
- -
-Get the fields and their values identifying the current credentials.
-
-
-
-
Decorators:
-
    -
  • @property
  • -
-
Overrides: - client.GoogleCredentials.serialization_data -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

create_scoped_required(self) -

-
source code  -
- -
-Whether this Credentials object is scopeless.
-
-create_scoped(scopes) method needs to be called in order to create
-a Credentials object for API calls.
-
-
-
-
Overrides: - client.GoogleCredentials.create_scoped_required -
(inherited documentation)
- -
-
-
- -
- -
- - -
-

create_scoped(self, - scopes) -

-
source code  -
- -
-Create a Credentials object for the given scopes.
-
-The Credentials type is preserved.
-
-
-
-
Overrides: - client.GoogleCredentials.create_scoped -
(inherited documentation)
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.tools-module.html b/docs/epy/oauth2client.tools-module.html deleted file mode 100644 index 27973ac..0000000 --- a/docs/epy/oauth2client.tools-module.html +++ /dev/null @@ -1,416 +0,0 @@ - - - - - oauth2client.tools - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module tools - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module tools

source code

-
-Command-line tools for authenticating via OAuth 2.0
-
-Do the OAuth 2.0 Web Server dance for a command line application. Stores the
-generated credentials in a common file that is used by other example apps in
-the same directory.
-
-
- -
-

Author: - jcgregorio@google.com (Joe Gregorio) -

-
- - - - - - - - - - - -
- - - - - -
Classes[hide private]
-
-   - - ClientRedirectServer
- A server to handle OAuth 2.0 redirects back to localhost. -
-   - - ClientRedirectHandler
- A handler for OAuth 2.0 redirects back to localhost. -
- - - - - - - - - - - - - - - - - - -
- - - - - -
Functions[hide private]
-
-   - - - - - - -
_CreateArgumentParser() - source code - -
- -
-   - - - - - - -
run_flow(flow, - storage, - flags, - http=None)
- Core code for a command-line application.
- source code - -
- -
-   - - - - - - -
message_if_missing(filename)
- Helpful message to display if the CLIENT_SECRETS file is missing.
- source code - -
- -
-   - - - - - - -
run(*args, - **kwargs) - source code - -
- -
- - - - - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - _CLIENT_SECRETS_MESSAGE = """WARNING: Please configure OAuth ... -
-   - - argparser = _CreateArgumentParser() -
- - - - - - -
- - - - - -
Function Details[hide private]
-
- -
- -
- - -
-

run_flow(flow, - storage, - flags, - http=None) -

-
source code  -
- -
-Core code for a command-line application.
-
-The run() function is called from your application and runs through all the
-steps to obtain credentials. It takes a Flow argument and attempts to open an
-authorization server page in the user's default web browser. The server asks
-the user to grant your application access to the user's data. If the user
-grants access, the run() function returns new credentials. The new credentials
-are also stored in the Storage argument, which updates the file associated
-with the Storage object.
-
-It presumes it is run from a command-line application and supports the
-following flags:
-
-  --auth_host_name: Host name to use when running a local web server
-    to handle redirects during OAuth authorization.
-    (default: 'localhost')
-
-  --auth_host_port: Port to use when running a local web server to handle
-    redirects during OAuth authorization.;
-    repeat this option to specify a list of values
-    (default: '[8080, 8090]')
-    (an integer)
-
-  --[no]auth_local_webserver: Run a local web server to handle redirects
-    during OAuth authorization.
-    (default: 'true')
-
-The tools module defines an ArgumentParser the already contains the flag
-definitions that run() requires. You can pass that ArgumentParser to your
-ArgumentParser constructor:
-
-  parser = argparse.ArgumentParser(description=__doc__,
-      formatter_class=argparse.RawDescriptionHelpFormatter,
-      parents=[tools.argparser])
-  flags = parser.parse_args(argv)
-
-Args:
-  flow: Flow, an OAuth 2.0 Flow to step through.
-  storage: Storage, a Storage to store the credential in.
-  flags: argparse.ArgumentParser, the command-line flags.
-  http: An instance of httplib2.Http.request
-       or something that acts like it.
-
-Returns:
-  Credentials, the obtained credential.
-
-
-
-
Decorators:
-
    -
  • @util.positional(3)
  • -
-
-
-
-
- - - - - - -
- - - - - -
Variables Details[hide private]
-
- -
- -
-

_CLIENT_SECRETS_MESSAGE

- -
-
-
-
Value:
-
-"""WARNING: Please configure OAuth 2.0
-
-To make this sample run you will need to populate the client_secrets.j\
-son file
-found at:
-
-   %s
-
-...
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.tools-pysrc.html b/docs/epy/oauth2client.tools-pysrc.html deleted file mode 100644 index 909cb2c..0000000 --- a/docs/epy/oauth2client.tools-pysrc.html +++ /dev/null @@ -1,358 +0,0 @@ - - - - - oauth2client.tools - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module tools - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.tools

-
-  1  # Copyright 2014 Google Inc. All rights reserved. 
-  2  # 
-  3  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  4  # you may not use this file except in compliance with the License. 
-  5  # You may obtain a copy of the License at 
-  6  # 
-  7  #      http://www.apache.org/licenses/LICENSE-2.0 
-  8  # 
-  9  # Unless required by applicable law or agreed to in writing, software 
- 10  # distributed under the License is distributed on an "AS IS" BASIS, 
- 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 12  # See the License for the specific language governing permissions and 
- 13  # limitations under the License. 
- 14   
- 15  """Command-line tools for authenticating via OAuth 2.0 
- 16   
- 17  Do the OAuth 2.0 Web Server dance for a command line application. Stores the 
- 18  generated credentials in a common file that is used by other example apps in 
- 19  the same directory. 
- 20  """ 
- 21   
- 22  from __future__ import print_function 
- 23   
- 24  __author__ = 'jcgregorio@google.com (Joe Gregorio)' 
- 25  __all__ = ['argparser', 'run_flow', 'run', 'message_if_missing'] 
- 26   
- 27  import BaseHTTPServer 
- 28  import logging 
- 29  import socket 
- 30  import sys 
- 31  import webbrowser 
- 32   
- 33  from six.moves import urllib 
- 34   
- 35  from oauth2client import client 
- 36  from oauth2client import util 
- 37   
- 38   
- 39  _CLIENT_SECRETS_MESSAGE = """WARNING: Please configure OAuth 2.0 
- 40   
- 41  To make this sample run you will need to populate the client_secrets.json file 
- 42  found at: 
- 43   
- 44     %s 
- 45   
- 46  with information from the APIs Console <https://code.google.com/apis/console>. 
- 47   
- 48  """ 
- 49   
- 50  # argparser is an ArgumentParser that contains command-line options expected 
- 51  # by tools.run(). Pass it in as part of the 'parents' argument to your own 
- 52  # ArgumentParser. 
- 53  argparser = _CreateArgumentParser() 
-
54 - 55 -def _CreateArgumentParser(): -
56 try: - 57 import argparse - 58 except ImportError: - 59 return None - 60 argparser = argparse.ArgumentParser(add_help=False) - 61 argparser.add_argument('--auth_host_name', default='localhost', - 62 help='Hostname when running a local web server.') - 63 argparser.add_argument('--noauth_local_webserver', action='store_true', - 64 default=False, help='Do not run a local web server.') - 65 argparser.add_argument('--auth_host_port', default=[8080, 8090], type=int, - 66 nargs='*', help='Port web server should listen on.') - 67 argparser.add_argument('--logging_level', default='ERROR', - 68 choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', - 69 'CRITICAL'], - 70 help='Set the logging level of detail.') - 71 return argparser -
72 -
73 - 74 -class ClientRedirectServer(BaseHTTPServer.HTTPServer): -
75 """A server to handle OAuth 2.0 redirects back to localhost. - 76 - 77 Waits for a single request and parses the query parameters - 78 into query_params and then stops serving. - 79 """ - 80 query_params = {} -
81 -
82 - 83 -class ClientRedirectHandler(BaseHTTPServer.BaseHTTPRequestHandler): -
84 """A handler for OAuth 2.0 redirects back to localhost. - 85 - 86 Waits for a single request and parses the query parameters - 87 into the servers query_params and then stops serving. - 88 """ - 89 -
90 - def do_GET(self): -
91 """Handle a GET request. - 92 - 93 Parses the query parameters and prints a message - 94 if the flow has completed. Note that we can't detect - 95 if an error occurred. - 96 """ - 97 self.send_response(200) - 98 self.send_header("Content-type", "text/html") - 99 self.end_headers() -100 query = self.path.split('?', 1)[-1] -101 query = dict(urllib.parse.parse_qsl(query)) -102 self.server.query_params = query -103 self.wfile.write("<html><head><title>Authentication Status</title></head>") -104 self.wfile.write("<body><p>The authentication flow has completed.</p>") -105 self.wfile.write("</body></html>") -
106 -
107 - def log_message(self, format, *args): -
108 """Do not log messages to stdout while running as command line program.""" -
109 -
110 -111 @util.positional(3) -112 -def run_flow(flow, storage, flags, http=None): -
113 """Core code for a command-line application. -114 -115 The run() function is called from your application and runs through all the -116 steps to obtain credentials. It takes a Flow argument and attempts to open an -117 authorization server page in the user's default web browser. The server asks -118 the user to grant your application access to the user's data. If the user -119 grants access, the run() function returns new credentials. The new credentials -120 are also stored in the Storage argument, which updates the file associated -121 with the Storage object. -122 -123 It presumes it is run from a command-line application and supports the -124 following flags: -125 -126 --auth_host_name: Host name to use when running a local web server -127 to handle redirects during OAuth authorization. -128 (default: 'localhost') -129 -130 --auth_host_port: Port to use when running a local web server to handle -131 redirects during OAuth authorization.; -132 repeat this option to specify a list of values -133 (default: '[8080, 8090]') -134 (an integer) -135 -136 --[no]auth_local_webserver: Run a local web server to handle redirects -137 during OAuth authorization. -138 (default: 'true') -139 -140 The tools module defines an ArgumentParser the already contains the flag -141 definitions that run() requires. You can pass that ArgumentParser to your -142 ArgumentParser constructor: -143 -144 parser = argparse.ArgumentParser(description=__doc__, -145 formatter_class=argparse.RawDescriptionHelpFormatter, -146 parents=[tools.argparser]) -147 flags = parser.parse_args(argv) -148 -149 Args: -150 flow: Flow, an OAuth 2.0 Flow to step through. -151 storage: Storage, a Storage to store the credential in. -152 flags: argparse.ArgumentParser, the command-line flags. -153 http: An instance of httplib2.Http.request -154 or something that acts like it. -155 -156 Returns: -157 Credentials, the obtained credential. -158 """ -159 logging.getLogger().setLevel(getattr(logging, flags.logging_level)) -160 if not flags.noauth_local_webserver: -161 success = False -162 port_number = 0 -163 for port in flags.auth_host_port: -164 port_number = port -165 try: -166 httpd = ClientRedirectServer((flags.auth_host_name, port), -167 ClientRedirectHandler) -168 except socket.error: -169 pass -170 else: -171 success = True -172 break -173 flags.noauth_local_webserver = not success -174 if not success: -175 print('Failed to start a local webserver listening on either port 8080') -176 print('or port 9090. Please check your firewall settings and locally') -177 print('running programs that may be blocking or using those ports.') -178 print() -179 print('Falling back to --noauth_local_webserver and continuing with') -180 print('authorization.') -181 print() -182 -183 if not flags.noauth_local_webserver: -184 oauth_callback = 'http://%s:%s/' % (flags.auth_host_name, port_number) -185 else: -186 oauth_callback = client.OOB_CALLBACK_URN -187 flow.redirect_uri = oauth_callback -188 authorize_url = flow.step1_get_authorize_url() -189 -190 if not flags.noauth_local_webserver: -191 webbrowser.open(authorize_url, new=1, autoraise=True) -192 print('Your browser has been opened to visit:') -193 print() -194 print(' ' + authorize_url) -195 print() -196 print('If your browser is on a different machine then exit and re-run this') -197 print('application with the command-line parameter ') -198 print() -199 print(' --noauth_local_webserver') -200 print() -201 else: -202 print('Go to the following link in your browser:') -203 print() -204 print(' ' + authorize_url) -205 print() -206 -207 code = None -208 if not flags.noauth_local_webserver: -209 httpd.handle_request() -210 if 'error' in httpd.query_params: -211 sys.exit('Authentication request was rejected.') -212 if 'code' in httpd.query_params: -213 code = httpd.query_params['code'] -214 else: -215 print('Failed to find "code" in the query parameters of the redirect.') -216 sys.exit('Try running with --noauth_local_webserver.') -217 else: -218 code = raw_input('Enter verification code: ').strip() -219 -220 try: -221 credential = flow.step2_exchange(code, http=http) -222 except client.FlowExchangeError as e: -223 sys.exit('Authentication has failed: %s' % e) -224 -225 storage.put(credential) -226 credential.set_store(storage) -227 print('Authentication successful.') -228 -229 return credential -
230 -
231 -232 -def message_if_missing(filename): -
233 """Helpful message to display if the CLIENT_SECRETS file is missing.""" -234 -235 return _CLIENT_SECRETS_MESSAGE % filename -
236 -237 try: -238 from oauth2client.old_run import run -239 from oauth2client.old_run import FLAGS -240 except ImportError: -
241 - def run(*args, **kwargs): -
242 raise NotImplementedError( -243 'The gflags library must be installed to use tools.run(). ' -244 'Please install gflags or preferrably switch to using ' -245 'tools.run_flow().') -
246 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.tools.ClientRedirectHandler-class.html b/docs/epy/oauth2client.tools.ClientRedirectHandler-class.html deleted file mode 100644 index 050e6a6..0000000 --- a/docs/epy/oauth2client.tools.ClientRedirectHandler-class.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - oauth2client.tools.ClientRedirectHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module tools :: - Class ClientRedirectHandler - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class ClientRedirectHandler

source code

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-A handler for OAuth 2.0 redirects back to localhost.
-
-Waits for a single request and parses the query parameters
-into the servers query_params and then stops serving.
-
-
- - - - - - - - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-   - - - - - - -
do_GET(self)
- Handle a GET request.
- source code - -
- -
-   - - - - - - -
log_message(self, - format, - *args)
- Do not log messages to stdout while running as command line program.
- source code - -
- -
-

Inherited from BaseHTTPServer.BaseHTTPRequestHandler: - address_string, - date_time_string, - end_headers, - handle, - handle_one_request, - log_date_time_string, - log_error, - log_request, - parse_request, - send_error, - send_header, - send_response, - version_string -

-

Inherited from SocketServer.StreamRequestHandler: - finish, - setup -

-

Inherited from SocketServer.BaseRequestHandler: - __init__ -

-
- - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-

Inherited from BaseHTTPServer.BaseHTTPRequestHandler: - MessageClass, - default_request_version, - error_content_type, - error_message_format, - monthname, - protocol_version, - responses, - server_version, - sys_version, - weekdayname -

-

Inherited from SocketServer.StreamRequestHandler: - disable_nagle_algorithm, - rbufsize, - timeout, - wbufsize -

-
- - - - - - -
- - - - - -
Method Details[hide private]
-
- -
- -
- - -
-

do_GET(self) -

-
source code  -
- -
-Handle a GET request.
-
-Parses the query parameters and prints a message
-if the flow has completed. Note that we can't detect
-if an error occurred.
-
-
-
-
-
-
- -
- -
- - -
-

log_message(self, - format, - *args) -

-
source code  -
- -
-Do not log messages to stdout while running as command line program.
-
-
-
-
Overrides: - BaseHTTPServer.BaseHTTPRequestHandler.log_message -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.tools.ClientRedirectServer-class.html b/docs/epy/oauth2client.tools.ClientRedirectServer-class.html deleted file mode 100644 index c94c329..0000000 --- a/docs/epy/oauth2client.tools.ClientRedirectServer-class.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - - oauth2client.tools.ClientRedirectServer - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module tools :: - Class ClientRedirectServer - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Class ClientRedirectServer

source code

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-A server to handle OAuth 2.0 redirects back to localhost.
-
-Waits for a single request and parses the query parameters
-into query_params and then stops serving.
-
-
- - - - - - - - - - -
- - - - - -
Instance Methods[hide private]
-
-

Inherited from BaseHTTPServer.HTTPServer: - server_bind -

-

Inherited from SocketServer.TCPServer: - __init__, - close_request, - fileno, - get_request, - server_activate, - server_close, - shutdown_request -

-

Inherited from SocketServer.BaseServer: - finish_request, - handle_error, - handle_request, - handle_timeout, - process_request, - serve_forever, - shutdown, - verify_request -

-

Inherited from SocketServer.BaseServer (private): - _handle_request_noblock -

-
- - - - - - - - - - - - -
- - - - - -
Class Variables[hide private]
-
-   - - query_params = {} -
-

Inherited from BaseHTTPServer.HTTPServer: - allow_reuse_address -

-

Inherited from SocketServer.TCPServer: - address_family, - request_queue_size, - socket_type -

-

Inherited from SocketServer.BaseServer: - timeout -

-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.util-module.html b/docs/epy/oauth2client.util-module.html deleted file mode 100644 index e0c69ba..0000000 --- a/docs/epy/oauth2client.util-module.html +++ /dev/null @@ -1,505 +0,0 @@ - - - - - oauth2client.util - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module util - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module util

source code

-
-Common utility library.
-
-
- -
-
Authors:
-
- rafek@google.com (Rafe Kaplan), - guido@google.com (Guido van Rossum) -
-
-
- - - - - - - - - - - - - - - - - -
- - - - - -
Functions[hide private]
-
-   - - - - - - -
positional(max_positional_args)
- A decorator to declare that only the first N arguments my be positional.
- source code - -
- -
-   - - - - - - -
scopes_to_string(scopes)
- Converts scope value to a string.
- source code - -
- -
-   - - - - - - -
dict_to_tuple_key(dictionary)
- Converts a dictionary to a tuple that can be used as an immutable key.
- source code - -
- -
-   - - - - - - -
_add_query_parameter(url, - name, - value)
- Adds a query parameter to a url.
- source code - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - logger = logging.getLogger(__name__) -
-   - - POSITIONAL_WARNING = 'WARNING' -
-   - - POSITIONAL_EXCEPTION = 'EXCEPTION' -
-   - - POSITIONAL_IGNORE = 'IGNORE' -
-   - - POSITIONAL_SET = frozenset([POSITIONAL_WARNING, POSITIONAL_EXC... -
-   - - positional_parameters_enforcement = 'WARNING' -
- - - - - - -
- - - - - -
Function Details[hide private]
-
- -
- -
- - -
-

positional(max_positional_args) -

-
source code  -
- -
-A decorator to declare that only the first N arguments my be positional.
-
-This decorator makes it easy to support Python 3 style key-word only
-parameters. For example, in Python 3 it is possible to write:
-
-  def fn(pos1, *, kwonly1=None, kwonly1=None):
-    ...
-
-All named parameters after * must be a keyword:
-
-  fn(10, 'kw1', 'kw2')  # Raises exception.
-  fn(10, kwonly1='kw1')  # Ok.
-
-Example:
-  To define a function like above, do:
-
-    @positional(1)
-    def fn(pos1, kwonly1=None, kwonly2=None):
-      ...
-
-  If no default value is provided to a keyword argument, it becomes a required
-  keyword argument:
-
-    @positional(0)
-    def fn(required_kw):
-      ...
-
-  This must be called with the keyword parameter:
-
-    fn()  # Raises exception.
-    fn(10)  # Raises exception.
-    fn(required_kw=10)  # Ok.
-
-  When defining instance or class methods always remember to account for
-  'self' and 'cls':
-
-    class MyClass(object):
-
-      @positional(2)
-      def my_method(self, pos1, kwonly1=None):
-        ...
-
-      @classmethod
-      @positional(2)
-      def my_method(cls, pos1, kwonly1=None):
-        ...
-
-The positional decorator behavior is controlled by
-util.positional_parameters_enforcement, which may be set to
-POSITIONAL_EXCEPTION, POSITIONAL_WARNING or POSITIONAL_IGNORE to raise an
-exception, log a warning, or do nothing, respectively, if a declaration is
-violated.
-
-Args:
-  max_positional_arguments: Maximum number of positional arguments. All
-    parameters after the this index must be keyword only.
-
-Returns:
-  A decorator that prevents using arguments after max_positional_args from
-  being used as positional parameters.
-
-Raises:
-  TypeError if a key-word only argument is provided as a positional
-  parameter, but only if util.positional_parameters_enforcement is set to
-  POSITIONAL_EXCEPTION.
-
-
-
-
-
-
- -
- -
- - -
-

scopes_to_string(scopes) -

-
source code  -
- -
-Converts scope value to a string.
-
-If scopes is a string then it is simply passed through. If scopes is an
-iterable then a string is returned that is all the individual scopes
-concatenated with spaces.
-
-Args:
-  scopes: string or iterable of strings, the scopes.
-
-Returns:
-  The scopes formatted as a single string.
-
-
-
-
-
-
- -
- -
- - -
-

dict_to_tuple_key(dictionary) -

-
source code  -
- -
-Converts a dictionary to a tuple that can be used as an immutable key.
-
-The resulting key is always sorted so that logically equivalent dictionaries
-always produce an identical tuple for a key.
-
-Args:
-  dictionary: the dictionary to use as the key.
-
-Returns:
-  A tuple representing the dictionary in it's naturally sorted ordering.
-
-
-
-
-
-
- -
- -
- - -
-

_add_query_parameter(url, - name, - value) -

-
source code  -
- -
-Adds a query parameter to a url.
-
-Replaces the current value if it already exists in the URL.
-
-Args:
-  url: string, url to add the query parameter to.
-  name: string, query parameter name.
-  value: string, query parameter value.
-
-Returns:
-  Updated query parameter. Does not update the url if value is None.
-
-
-
-
-
-
-
- - - - - - -
- - - - - -
Variables Details[hide private]
-
- -
- -
-

POSITIONAL_SET

- -
-
-
-
Value:
-
-frozenset([POSITIONAL_WARNING, POSITIONAL_EXCEPTION, POSITIONAL_IGNORE\
-])
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.util-pysrc.html b/docs/epy/oauth2client.util-pysrc.html deleted file mode 100644 index dda7c7c..0000000 --- a/docs/epy/oauth2client.util-pysrc.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - - oauth2client.util - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module util - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.util

-
-  1  #!/usr/bin/env python 
-  2  # 
-  3  # Copyright 2014 Google Inc. All rights reserved. 
-  4  # 
-  5  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  6  # you may not use this file except in compliance with the License. 
-  7  # You may obtain a copy of the License at 
-  8  # 
-  9  #     http://www.apache.org/licenses/LICENSE-2.0 
- 10  # 
- 11  # Unless required by applicable law or agreed to in writing, software 
- 12  # distributed under the License is distributed on an "AS IS" BASIS, 
- 13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 14  # See the License for the specific language governing permissions and 
- 15  # limitations under the License. 
- 16  # 
- 17   
- 18  """Common utility library.""" 
- 19   
- 20  __author__ = [ 
- 21      'rafek@google.com (Rafe Kaplan)', 
- 22      'guido@google.com (Guido van Rossum)', 
- 23  ] 
- 24   
- 25  __all__ = [ 
- 26      'positional', 
- 27      'POSITIONAL_WARNING', 
- 28      'POSITIONAL_EXCEPTION', 
- 29      'POSITIONAL_IGNORE', 
- 30  ] 
- 31   
- 32  import inspect 
- 33  import logging 
- 34  import sys 
- 35  import types 
- 36   
- 37  import six 
- 38  from six.moves import urllib 
- 39   
- 40   
- 41  logger = logging.getLogger(__name__) 
- 42   
- 43  POSITIONAL_WARNING = 'WARNING' 
- 44  POSITIONAL_EXCEPTION = 'EXCEPTION' 
- 45  POSITIONAL_IGNORE = 'IGNORE' 
- 46  POSITIONAL_SET = frozenset([POSITIONAL_WARNING, POSITIONAL_EXCEPTION, 
- 47                              POSITIONAL_IGNORE]) 
- 48   
- 49  positional_parameters_enforcement = POSITIONAL_WARNING 
- 50   
-
51 -def positional(max_positional_args): -
52 """A decorator to declare that only the first N arguments my be positional. - 53 - 54 This decorator makes it easy to support Python 3 style key-word only - 55 parameters. For example, in Python 3 it is possible to write: - 56 - 57 def fn(pos1, *, kwonly1=None, kwonly1=None): - 58 ... - 59 - 60 All named parameters after * must be a keyword: - 61 - 62 fn(10, 'kw1', 'kw2') # Raises exception. - 63 fn(10, kwonly1='kw1') # Ok. - 64 - 65 Example: - 66 To define a function like above, do: - 67 - 68 @positional(1) - 69 def fn(pos1, kwonly1=None, kwonly2=None): - 70 ... - 71 - 72 If no default value is provided to a keyword argument, it becomes a required - 73 keyword argument: - 74 - 75 @positional(0) - 76 def fn(required_kw): - 77 ... - 78 - 79 This must be called with the keyword parameter: - 80 - 81 fn() # Raises exception. - 82 fn(10) # Raises exception. - 83 fn(required_kw=10) # Ok. - 84 - 85 When defining instance or class methods always remember to account for - 86 'self' and 'cls': - 87 - 88 class MyClass(object): - 89 - 90 @positional(2) - 91 def my_method(self, pos1, kwonly1=None): - 92 ... - 93 - 94 @classmethod - 95 @positional(2) - 96 def my_method(cls, pos1, kwonly1=None): - 97 ... - 98 - 99 The positional decorator behavior is controlled by -100 util.positional_parameters_enforcement, which may be set to -101 POSITIONAL_EXCEPTION, POSITIONAL_WARNING or POSITIONAL_IGNORE to raise an -102 exception, log a warning, or do nothing, respectively, if a declaration is -103 violated. -104 -105 Args: -106 max_positional_arguments: Maximum number of positional arguments. All -107 parameters after the this index must be keyword only. -108 -109 Returns: -110 A decorator that prevents using arguments after max_positional_args from -111 being used as positional parameters. -112 -113 Raises: -114 TypeError if a key-word only argument is provided as a positional -115 parameter, but only if util.positional_parameters_enforcement is set to -116 POSITIONAL_EXCEPTION. -117 """ -118 def positional_decorator(wrapped): -119 def positional_wrapper(*args, **kwargs): -120 if len(args) > max_positional_args: -121 plural_s = '' -122 if max_positional_args != 1: -123 plural_s = 's' -124 message = '%s() takes at most %d positional argument%s (%d given)' % ( -125 wrapped.__name__, max_positional_args, plural_s, len(args)) -126 if positional_parameters_enforcement == POSITIONAL_EXCEPTION: -127 raise TypeError(message) -128 elif positional_parameters_enforcement == POSITIONAL_WARNING: -129 logger.warning(message) -130 else: # IGNORE -131 pass -132 return wrapped(*args, **kwargs) -
133 return positional_wrapper -134 -135 if isinstance(max_positional_args, six.integer_types): -136 return positional_decorator -137 else: -138 args, _, _, defaults = inspect.getargspec(max_positional_args) -139 return positional(len(args) - len(defaults))(max_positional_args) -140 -141 -
142 -def scopes_to_string(scopes): -
143 """Converts scope value to a string. -144 -145 If scopes is a string then it is simply passed through. If scopes is an -146 iterable then a string is returned that is all the individual scopes -147 concatenated with spaces. -148 -149 Args: -150 scopes: string or iterable of strings, the scopes. -151 -152 Returns: -153 The scopes formatted as a single string. -154 """ -155 try: -156 is_string = isinstance(scopes, basestring) -157 except NameError: -158 is_string = isinstance(scopes, str) -159 if is_string: -160 return scopes -161 else: -162 return ' '.join(scopes) -
163 -164 -
165 -def dict_to_tuple_key(dictionary): -
166 """Converts a dictionary to a tuple that can be used as an immutable key. -167 -168 The resulting key is always sorted so that logically equivalent dictionaries -169 always produce an identical tuple for a key. -170 -171 Args: -172 dictionary: the dictionary to use as the key. -173 -174 Returns: -175 A tuple representing the dictionary in it's naturally sorted ordering. -176 """ -177 return tuple(sorted(dictionary.items())) -
178 -179 -
180 -def _add_query_parameter(url, name, value): -
181 """Adds a query parameter to a url. -182 -183 Replaces the current value if it already exists in the URL. -184 -185 Args: -186 url: string, url to add the query parameter to. -187 name: string, query parameter name. -188 value: string, query parameter value. -189 -190 Returns: -191 Updated query parameter. Does not update the url if value is None. -192 """ -193 if value is None: -194 return url -195 else: -196 parsed = list(urllib.parse.urlparse(url)) -197 q = dict(urllib.parse.parse_qsl(parsed[4])) -198 q[name] = value -199 parsed[4] = urllib.parse.urlencode(q) -200 return urllib.parse.urlunparse(parsed) -
201 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.xsrfutil-module.html b/docs/epy/oauth2client.xsrfutil-module.html deleted file mode 100644 index 29ed128..0000000 --- a/docs/epy/oauth2client.xsrfutil-module.html +++ /dev/null @@ -1,326 +0,0 @@ - - - - - oauth2client.xsrfutil - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module xsrfutil - - - - - - -
[hide private]
[frames] | no frames]
-
- -

Module xsrfutil

source code

-
-Helper methods for creating & verifying XSRF tokens.
-
-
- -
-
Authors:
-
- "Doug Coker" <dcoker@google.com>, - "Joe Gregorio" <jcgregorio@google.com> -
-
-
- - - - - - - - - - - - - - -
- - - - - -
Functions[hide private]
-
-   - - - - - - -
_force_bytes(s) - source code - -
- -
-   - - - - - - -
generate_token(key, - user_id, - action_id="", - when=None)
- Generates a URL-safe token for the given user, action, time tuple.
- source code - -
- -
-   - - - - - - -
validate_token(key, - token, - user_id, - action_id="", - current_time=None)
- Validates that the given token authorizes the user for the action.
- source code - -
- -
- - - - - - - - - - - - -
- - - - - -
Variables[hide private]
-
-   - - DELIMITER = b':' -
-   - - DEFAULT_TIMEOUT_SECS = 1* 60* 60 -
- - - - - - -
- - - - - -
Function Details[hide private]
-
- -
- -
- - -
-

generate_token(key, - user_id, - action_id="", - when=None) -

-
source code  -
- -
-Generates a URL-safe token for the given user, action, time tuple.
-
-Args:
-  key: secret key to use.
-  user_id: the user ID of the authenticated user.
-  action_id: a string identifier of the action they requested
-    authorization for.
-  when: the time in seconds since the epoch at which the user was
-    authorized for this action. If not set the current time is used.
-
-Returns:
-  A string XSRF protection token.
-
-
-
-
Decorators:
-
    -
  • @util.positional(2)
  • -
-
-
-
- -
- -
- - -
-

validate_token(key, - token, - user_id, - action_id="", - current_time=None) -

-
source code  -
- -
-Validates that the given token authorizes the user for the action.
-
-Tokens are invalid if the time of issue is too old or if the token
-does not match what generateToken outputs (i.e. the token was forged).
-
-Args:
-  key: secret key to use.
-  token: a string of the token generated by generateToken.
-  user_id: the user ID of the authenticated user.
-  action_id: a string identifier of the action they requested
-    authorization for.
-
-Returns:
-  A boolean - True if the user is authorized for the action, False
-  otherwise.
-
-
-
-
Decorators:
-
    -
  • @util.positional(3)
  • -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/oauth2client.xsrfutil-pysrc.html b/docs/epy/oauth2client.xsrfutil-pysrc.html deleted file mode 100644 index 5e974f6..0000000 --- a/docs/epy/oauth2client.xsrfutil-pysrc.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - oauth2client.xsrfutil - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Package oauth2client :: - Module xsrfutil - - - - - - -
[hide private]
[frames] | no frames]
-
-

Source Code for Module oauth2client.xsrfutil

-
-  1  # 
-  2  # Copyright 2014 the Melange authors. 
-  3  # 
-  4  # Licensed under the Apache License, Version 2.0 (the "License"); 
-  5  # you may not use this file except in compliance with the License. 
-  6  # You may obtain a copy of the License at 
-  7  # 
-  8  #   http://www.apache.org/licenses/LICENSE-2.0 
-  9  # 
- 10  # Unless required by applicable law or agreed to in writing, software 
- 11  # distributed under the License is distributed on an "AS IS" BASIS, 
- 12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- 13  # See the License for the specific language governing permissions and 
- 14  # limitations under the License. 
- 15   
- 16  """Helper methods for creating & verifying XSRF tokens.""" 
- 17   
- 18  __authors__ = [ 
- 19      '"Doug Coker" <dcoker@google.com>', 
- 20      '"Joe Gregorio" <jcgregorio@google.com>', 
- 21  ] 
- 22   
- 23   
- 24  import base64 
- 25  import hmac 
- 26  import time 
- 27   
- 28  import six 
- 29  from oauth2client import util 
- 30   
- 31   
- 32  # Delimiter character 
- 33  DELIMITER = b':' 
- 34   
- 35   
- 36  # 1 hour in seconds 
- 37  DEFAULT_TIMEOUT_SECS = 1*60*60 
-
38 - 39 - 40 -def _force_bytes(s): -
41 if isinstance(s, bytes): - 42 return s - 43 s = str(s) - 44 if isinstance(s, six.text_type): - 45 return s.encode('utf-8') - 46 return s -
47 -
48 - 49 @util.positional(2) - 50 -def generate_token(key, user_id, action_id="", when=None): -
51 """Generates a URL-safe token for the given user, action, time tuple. - 52 - 53 Args: - 54 key: secret key to use. - 55 user_id: the user ID of the authenticated user. - 56 action_id: a string identifier of the action they requested - 57 authorization for. - 58 when: the time in seconds since the epoch at which the user was - 59 authorized for this action. If not set the current time is used. - 60 - 61 Returns: - 62 A string XSRF protection token. - 63 """ - 64 when = _force_bytes(when or int(time.time())) - 65 digester = hmac.new(_force_bytes(key)) - 66 digester.update(_force_bytes(user_id)) - 67 digester.update(DELIMITER) - 68 digester.update(_force_bytes(action_id)) - 69 digester.update(DELIMITER) - 70 digester.update(when) - 71 digest = digester.digest() - 72 - 73 token = base64.urlsafe_b64encode(digest + DELIMITER + when) - 74 return token -
75 -
76 - 77 @util.positional(3) - 78 -def validate_token(key, token, user_id, action_id="", current_time=None): -
79 """Validates that the given token authorizes the user for the action. - 80 - 81 Tokens are invalid if the time of issue is too old or if the token - 82 does not match what generateToken outputs (i.e. the token was forged). - 83 - 84 Args: - 85 key: secret key to use. - 86 token: a string of the token generated by generateToken. - 87 user_id: the user ID of the authenticated user. - 88 action_id: a string identifier of the action they requested - 89 authorization for. - 90 - 91 Returns: - 92 A boolean - True if the user is authorized for the action, False - 93 otherwise. - 94 """ - 95 if not token: - 96 return False - 97 try: - 98 decoded = base64.urlsafe_b64decode(token) - 99 token_time = int(decoded.split(DELIMITER)[-1]) -100 except (TypeError, ValueError): -101 return False -102 if current_time is None: -103 current_time = time.time() -104 # If the token is too old it's not valid. -105 if current_time - token_time > DEFAULT_TIMEOUT_SECS: -106 return False -107 -108 # The given token should match the generated one with the same time. -109 expected_token = generate_token(key, user_id, action_id=action_id, -110 when=token_time) -111 if len(token) != len(expected_token): -112 return False -113 -114 # Perform constant time comparison to avoid timing attacks -115 different = 0 -116 for x, y in zip(bytearray(token), bytearray(expected_token)): -117 different |= x ^ y -118 return not different -
119 -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/docs/epy/redirect.html b/docs/epy/redirect.html deleted file mode 100644 index f919c4c..0000000 --- a/docs/epy/redirect.html +++ /dev/null @@ -1,38 +0,0 @@ -Epydoc Redirect Page - - - - - - - - -

Epydoc Auto-redirect page

- -

When javascript is enabled, this page will redirect URLs of -the form redirect.html#dotted.name to the -documentation for the object with the given fully-qualified -dotted name.

-

 

- - - - - diff --git a/docs/epy/toc-everything.html b/docs/epy/toc-everything.html deleted file mode 100644 index 0788ae0..0000000 --- a/docs/epy/toc-everything.html +++ /dev/null @@ -1,300 +0,0 @@ - - - - - Everything - - - - - -

Everything

-
-

All Classes

- oauth2client.appengine.AppAssertionCredentials
oauth2client.appengine.CredentialsModel
oauth2client.appengine.CredentialsNDBModel
oauth2client.appengine.CredentialsNDBProperty
oauth2client.appengine.CredentialsProperty
oauth2client.appengine.FlowNDBProperty
oauth2client.appengine.FlowProperty
oauth2client.appengine.InvalidClientSecretsError
oauth2client.appengine.InvalidXsrfTokenError
oauth2client.appengine.OAuth2Decorator
oauth2client.appengine.OAuth2DecoratorFromClientSecrets
oauth2client.appengine.SiteXsrfSecretKey
oauth2client.appengine.SiteXsrfSecretKeyNDB
oauth2client.appengine.StorageByKeyName
oauth2client.client.AccessTokenCredentials
oauth2client.client.AccessTokenCredentialsError
oauth2client.client.AccessTokenRefreshError
oauth2client.client.ApplicationDefaultCredentialsError
oauth2client.client.AssertionCredentials
oauth2client.client.Credentials
oauth2client.client.CryptoUnavailableError
oauth2client.client.DeviceFlowInfo
oauth2client.client.Error
oauth2client.client.Flow
oauth2client.client.FlowExchangeError
oauth2client.client.GoogleCredentials
oauth2client.client.MemoryCache
oauth2client.client.NonAsciiHeaderError
oauth2client.client.OAuth2Credentials
oauth2client.client.OAuth2DeviceCodeError
oauth2client.client.OAuth2WebServerFlow
oauth2client.client.SignedJwtAssertionCredentials
oauth2client.client.Storage
oauth2client.client.TokenRevokeError
oauth2client.client.UnknownClientSecretsFlowError
oauth2client.client.VerifyJwtTokenError
oauth2client.clientsecrets.Error
oauth2client.clientsecrets.InvalidClientSecretsError
oauth2client.crypt.AppIdentityError
oauth2client.django_orm.CredentialsField
oauth2client.django_orm.FlowField
oauth2client.django_orm.Storage
oauth2client.file.CredentialsFileSymbolicLinkError
oauth2client.file.Storage
oauth2client.gce.AppAssertionCredentials
oauth2client.keyring_storage.Storage
oauth2client.locked_file.AlreadyLockedException
oauth2client.locked_file.CredentialsFileSymbolicLinkError
oauth2client.locked_file.LockedFile
- - oauth2client.multistore_file.Error
oauth2client.multistore_file.NewerCredentialStoreError
- - - - -

All Functions

- - - - - oauth2client.appengine.oauth2decorator_from_clientsecrets
oauth2client.appengine.xsrf_secret_key
- - - - - - - - - - - - - - oauth2client.client.clean_headers
oauth2client.client.credentials_from_clientsecrets_and_code
oauth2client.client.credentials_from_code
oauth2client.client.flow_from_clientsecrets
oauth2client.client.save_to_well_known_file
oauth2client.client.verify_id_token
- - oauth2client.clientsecrets.load
oauth2client.clientsecrets.loadfile
oauth2client.clientsecrets.loads
- - - - oauth2client.crypt.make_signed_jwt
oauth2client.crypt.verify_signed_jwt_with_certs
oauth2client.locked_file.validate_file
- oauth2client.multistore_file.get_all_credential_keys
oauth2client.multistore_file.get_credential_storage
oauth2client.multistore_file.get_credential_storage_custom_key
oauth2client.multistore_file.get_credential_storage_custom_string_key
oauth2client.old_run.run
- - - oauth2client.tools.message_if_missing
oauth2client.tools.run
oauth2client.tools.run_flow
- - oauth2client.util.positional
- - oauth2client.xsrfutil.generate_token
oauth2client.xsrfutil.validate_token

All Variables

- oauth2client.GOOGLE_AUTH_URI
oauth2client.GOOGLE_DEVICE_URI
oauth2client.GOOGLE_REVOKE_URI
oauth2client.GOOGLE_TOKEN_URI
oauth2client.appengine.OAUTH2CLIENT_NAMESPACE
oauth2client.appengine.XSRF_MEMCACHE_ID
oauth2client.appengine.logger
oauth2client.appengine.ndb
oauth2client.client.ADC_HELP_MSG
oauth2client.client.AUTHORIZED_USER
oauth2client.client.AccessTokenInfo
oauth2client.client.EXPIRY_FORMAT
oauth2client.client.GOOGLE_APPLICATION_CREDENTIALS
oauth2client.client.HAS_CRYPTO
oauth2client.client.HAS_OPENSSL
oauth2client.client.ID_TOKEN_VERIFICATION_CERTS
oauth2client.client.ID_TOKEN_VERIFICATON_CERTS
oauth2client.client.OOB_CALLBACK_URN
oauth2client.client.REFRESH_STATUS_CODES
oauth2client.client.SERVICE_ACCOUNT
- - oauth2client.client.logger
oauth2client.clientsecrets.TYPE_INSTALLED
oauth2client.clientsecrets.TYPE_WEB
oauth2client.clientsecrets.VALID_CLIENT
oauth2client.crypt.AUTH_TOKEN_LIFETIME_SECS
oauth2client.crypt.CLOCK_SKEW_SECS
oauth2client.crypt.MAX_TOKEN_LIFETIME_SECS
oauth2client.crypt.OpenSSLSigner
oauth2client.crypt.OpenSSLVerifier
oauth2client.crypt.PyCryptoSigner
oauth2client.crypt.PyCryptoVerifier
oauth2client.crypt.Signer
oauth2client.crypt.Verifier
oauth2client.crypt.logger
oauth2client.gce.META
oauth2client.gce.logger
- - oauth2client.locked_file.logger
- - oauth2client.multistore_file.logger
oauth2client.old_run.FLAGS
- oauth2client.tools.argparser
oauth2client.util.POSITIONAL_EXCEPTION
oauth2client.util.POSITIONAL_IGNORE
- oauth2client.util.POSITIONAL_WARNING
- - oauth2client.xsrfutil.DEFAULT_TIMEOUT_SECS
oauth2client.xsrfutil.DELIMITER

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client-module.html b/docs/epy/toc-oauth2client-module.html deleted file mode 100644 index 07dfca3..0000000 --- a/docs/epy/toc-oauth2client-module.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - oauth2client - - - - - -

Module oauth2client

-
-

Variables

- GOOGLE_AUTH_URI
GOOGLE_DEVICE_URI
GOOGLE_REVOKE_URI
GOOGLE_TOKEN_URI

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.anyjson-module.html b/docs/epy/toc-oauth2client.anyjson-module.html deleted file mode 100644 index d0dbce9..0000000 --- a/docs/epy/toc-oauth2client.anyjson-module.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - anyjson - - - - - -

Module anyjson

-
-
-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.appengine-module.html b/docs/epy/toc-oauth2client.appengine-module.html deleted file mode 100644 index 3acc0eb..0000000 --- a/docs/epy/toc-oauth2client.appengine-module.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - appengine - - - - - -

Module appengine

-
-

Classes

- AppAssertionCredentials
CredentialsModel
CredentialsNDBModel
CredentialsNDBProperty
CredentialsProperty
FlowNDBProperty
FlowProperty
InvalidClientSecretsError
InvalidXsrfTokenError
OAuth2Decorator
OAuth2DecoratorFromClientSecrets
SiteXsrfSecretKey
SiteXsrfSecretKeyNDB
StorageByKeyName

Functions

- - - - - oauth2decorator_from_clientsecrets
xsrf_secret_key

Variables

- OAUTH2CLIENT_NAMESPACE
XSRF_MEMCACHE_ID
logger
ndb

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.client-module.html b/docs/epy/toc-oauth2client.client-module.html deleted file mode 100644 index bd3bdb0..0000000 --- a/docs/epy/toc-oauth2client.client-module.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - client - - - - - -

Module client

-
-

Classes

- AccessTokenCredentials
AccessTokenCredentialsError
AccessTokenRefreshError
ApplicationDefaultCredentialsError
AssertionCredentials
Credentials
CryptoUnavailableError
DeviceFlowInfo
Error
Flow
FlowExchangeError
GoogleCredentials
MemoryCache
NonAsciiHeaderError
OAuth2Credentials
OAuth2DeviceCodeError
OAuth2WebServerFlow
SignedJwtAssertionCredentials
Storage
TokenRevokeError
UnknownClientSecretsFlowError
VerifyJwtTokenError

Functions

- - - - - - - - - - - - - - - clean_headers
credentials_from_clientsecrets_and_code
credentials_from_code
flow_from_clientsecrets
save_to_well_known_file
verify_id_token

Variables

- ADC_HELP_MSG
AUTHORIZED_USER
AccessTokenInfo
EXPIRY_FORMAT
GOOGLE_APPLICATION_CREDENTIALS
HAS_CRYPTO
HAS_OPENSSL
ID_TOKEN_VERIFICATION_CERTS
ID_TOKEN_VERIFICATON_CERTS
OOB_CALLBACK_URN
REFRESH_STATUS_CODES
SERVICE_ACCOUNT
- - logger

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.clientsecrets-module.html b/docs/epy/toc-oauth2client.clientsecrets-module.html deleted file mode 100644 index f60223b..0000000 --- a/docs/epy/toc-oauth2client.clientsecrets-module.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - clientsecrets - - - - - -

Module clientsecrets

-
-

Classes

- Error
InvalidClientSecretsError

Functions

- - - load
loadfile
loads

Variables

- TYPE_INSTALLED
TYPE_WEB
VALID_CLIENT

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.crypt-module.html b/docs/epy/toc-oauth2client.crypt-module.html deleted file mode 100644 index 77829f5..0000000 --- a/docs/epy/toc-oauth2client.crypt-module.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - crypt - - - - - -

Module crypt

-
-

Classes

- AppIdentityError

Functions

- - - - - make_signed_jwt
verify_signed_jwt_with_certs

Variables

- AUTH_TOKEN_LIFETIME_SECS
CLOCK_SKEW_SECS
MAX_TOKEN_LIFETIME_SECS
OpenSSLSigner
OpenSSLVerifier
PyCryptoSigner
PyCryptoVerifier
Signer
Verifier
logger

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.django_orm-module.html b/docs/epy/toc-oauth2client.django_orm-module.html deleted file mode 100644 index a32834d..0000000 --- a/docs/epy/toc-oauth2client.django_orm-module.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - django_orm - - - - - -

Module django_orm

-
-

Classes

- CredentialsField
FlowField
Storage

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.file-module.html b/docs/epy/toc-oauth2client.file-module.html deleted file mode 100644 index ac6305b..0000000 --- a/docs/epy/toc-oauth2client.file-module.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - file - - - - - -

Module file

-
-

Classes

- CredentialsFileSymbolicLinkError
Storage

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.gce-module.html b/docs/epy/toc-oauth2client.gce-module.html deleted file mode 100644 index 8b27668..0000000 --- a/docs/epy/toc-oauth2client.gce-module.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - gce - - - - - -

Module gce

-
-

Classes

- AppAssertionCredentials

Variables

- META
logger

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.keyring_storage-module.html b/docs/epy/toc-oauth2client.keyring_storage-module.html deleted file mode 100644 index 1fc9738..0000000 --- a/docs/epy/toc-oauth2client.keyring_storage-module.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - keyring_storage - - - - - -

Module keyring_storage

-
-

Classes

- Storage

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.locked_file-module.html b/docs/epy/toc-oauth2client.locked_file-module.html deleted file mode 100644 index 51c5e73..0000000 --- a/docs/epy/toc-oauth2client.locked_file-module.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - locked_file - - - - - -

Module locked_file

-
-

Classes

- AlreadyLockedException
CredentialsFileSymbolicLinkError
LockedFile
- -

Functions

- validate_file

Variables

- - - logger

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.multistore_file-module.html b/docs/epy/toc-oauth2client.multistore_file-module.html deleted file mode 100644 index e86c89b..0000000 --- a/docs/epy/toc-oauth2client.multistore_file-module.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - multistore_file - - - - - -

Module multistore_file

-
-

Classes

- Error
NewerCredentialStoreError
-

Functions

- - get_all_credential_keys
get_credential_storage
get_credential_storage_custom_key
get_credential_storage_custom_string_key

Variables

- - - logger

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.old_run-module.html b/docs/epy/toc-oauth2client.old_run-module.html deleted file mode 100644 index 5fbd5c3..0000000 --- a/docs/epy/toc-oauth2client.old_run-module.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - old_run - - - - - -

Module old_run

-
-

Functions

- run

Variables

- FLAGS

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.service_account-module.html b/docs/epy/toc-oauth2client.service_account-module.html deleted file mode 100644 index 401e3e8..0000000 --- a/docs/epy/toc-oauth2client.service_account-module.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - service_account - - - - - -

Module service_account

-
-

Classes

- -

Functions

- - -
-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.tools-module.html b/docs/epy/toc-oauth2client.tools-module.html deleted file mode 100644 index 51eac95..0000000 --- a/docs/epy/toc-oauth2client.tools-module.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - tools - - - - - -

Module tools

-
-

Classes

- - -

Functions

- - message_if_missing
run
run_flow

Variables

- - argparser

-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.util-module.html b/docs/epy/toc-oauth2client.util-module.html deleted file mode 100644 index 335250f..0000000 --- a/docs/epy/toc-oauth2client.util-module.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - util - - - - - -

Module util

-
-

Functions

- - - positional
-

Variables

- POSITIONAL_EXCEPTION
POSITIONAL_IGNORE
- POSITIONAL_WARNING
- logger
- -
-[hide private] - - - - diff --git a/docs/epy/toc-oauth2client.xsrfutil-module.html b/docs/epy/toc-oauth2client.xsrfutil-module.html deleted file mode 100644 index 7b527b5..0000000 --- a/docs/epy/toc-oauth2client.xsrfutil-module.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - xsrfutil - - - - - -

Module xsrfutil

-
-

Functions

- - generate_token
validate_token

Variables

- DEFAULT_TIMEOUT_SECS
DELIMITER

-[hide private] - - - - diff --git a/docs/epy/toc.html b/docs/epy/toc.html deleted file mode 100644 index 96bc5e0..0000000 --- a/docs/epy/toc.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - Table of Contents - - - - - -

Table of Contents

-
- Everything -
-

Modules

- oauth2client
oauth2client.appengine
oauth2client.client
oauth2client.clientsecrets
oauth2client.crypt
oauth2client.django_orm
oauth2client.file
oauth2client.gce
oauth2client.keyring_storage
oauth2client.locked_file
oauth2client.multistore_file
oauth2client.old_run
oauth2client.service_account
oauth2client.tools
oauth2client.util
oauth2client.xsrfutil

- [hide private] - - - - diff --git a/docs/epy/uml_class_diagram_for_oauth2cl.gif b/docs/epy/uml_class_diagram_for_oauth2cl.gif deleted file mode 100644 index 611b29a..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_10.gif b/docs/epy/uml_class_diagram_for_oauth2cl_10.gif deleted file mode 100644 index 0cf19ad..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_10.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_11.gif b/docs/epy/uml_class_diagram_for_oauth2cl_11.gif deleted file mode 100644 index aed9d70..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_11.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_12.gif b/docs/epy/uml_class_diagram_for_oauth2cl_12.gif deleted file mode 100644 index 4b34bb0..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_12.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_13.gif b/docs/epy/uml_class_diagram_for_oauth2cl_13.gif deleted file mode 100644 index 348e32b..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_13.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_14.gif b/docs/epy/uml_class_diagram_for_oauth2cl_14.gif deleted file mode 100644 index f986b01..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_14.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_15.gif b/docs/epy/uml_class_diagram_for_oauth2cl_15.gif deleted file mode 100644 index d2f7d5e..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_15.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_16.gif b/docs/epy/uml_class_diagram_for_oauth2cl_16.gif deleted file mode 100644 index a61aad7..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_16.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_17.gif b/docs/epy/uml_class_diagram_for_oauth2cl_17.gif deleted file mode 100644 index 0739ffe..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_17.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_18.gif b/docs/epy/uml_class_diagram_for_oauth2cl_18.gif deleted file mode 100644 index 7a718d2..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_18.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_19.gif b/docs/epy/uml_class_diagram_for_oauth2cl_19.gif deleted file mode 100644 index ea8d68f..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_19.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_2.gif b/docs/epy/uml_class_diagram_for_oauth2cl_2.gif deleted file mode 100644 index 49d328e..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_2.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_20.gif b/docs/epy/uml_class_diagram_for_oauth2cl_20.gif deleted file mode 100644 index cba25b3..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_20.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_21.gif b/docs/epy/uml_class_diagram_for_oauth2cl_21.gif deleted file mode 100644 index 2e1c443..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_21.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_22.gif b/docs/epy/uml_class_diagram_for_oauth2cl_22.gif deleted file mode 100644 index d6affed..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_22.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_23.gif b/docs/epy/uml_class_diagram_for_oauth2cl_23.gif deleted file mode 100644 index fa6d0f6..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_23.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_24.gif b/docs/epy/uml_class_diagram_for_oauth2cl_24.gif deleted file mode 100644 index 763bc3b..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_24.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_25.gif b/docs/epy/uml_class_diagram_for_oauth2cl_25.gif deleted file mode 100644 index 54fc5ed..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_25.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_26.gif b/docs/epy/uml_class_diagram_for_oauth2cl_26.gif deleted file mode 100644 index c246528..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_26.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_27.gif b/docs/epy/uml_class_diagram_for_oauth2cl_27.gif deleted file mode 100644 index 398e43f..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_27.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_28.gif b/docs/epy/uml_class_diagram_for_oauth2cl_28.gif deleted file mode 100644 index 2f0ab58..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_28.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_29.gif b/docs/epy/uml_class_diagram_for_oauth2cl_29.gif deleted file mode 100644 index 091db8b..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_29.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_3.gif b/docs/epy/uml_class_diagram_for_oauth2cl_3.gif deleted file mode 100644 index c77e2fb..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_3.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_30.gif b/docs/epy/uml_class_diagram_for_oauth2cl_30.gif deleted file mode 100644 index f632886..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_30.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_31.gif b/docs/epy/uml_class_diagram_for_oauth2cl_31.gif deleted file mode 100644 index 99c3fcc..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_31.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_32.gif b/docs/epy/uml_class_diagram_for_oauth2cl_32.gif deleted file mode 100644 index 8b06d4a..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_32.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_33.gif b/docs/epy/uml_class_diagram_for_oauth2cl_33.gif deleted file mode 100644 index 93b9494..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_33.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_34.gif b/docs/epy/uml_class_diagram_for_oauth2cl_34.gif deleted file mode 100644 index 1935aa9..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_34.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_35.gif b/docs/epy/uml_class_diagram_for_oauth2cl_35.gif deleted file mode 100644 index e0e5dc9..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_35.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_36.gif b/docs/epy/uml_class_diagram_for_oauth2cl_36.gif deleted file mode 100644 index d6affed..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_36.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_37.gif b/docs/epy/uml_class_diagram_for_oauth2cl_37.gif deleted file mode 100644 index a27e9da..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_37.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_38.gif b/docs/epy/uml_class_diagram_for_oauth2cl_38.gif deleted file mode 100644 index bdeb0ca..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_38.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_39.gif b/docs/epy/uml_class_diagram_for_oauth2cl_39.gif deleted file mode 100644 index e4c7af6..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_39.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_4.gif b/docs/epy/uml_class_diagram_for_oauth2cl_4.gif deleted file mode 100644 index 885acb2..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_4.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_40.gif b/docs/epy/uml_class_diagram_for_oauth2cl_40.gif deleted file mode 100644 index da92fdb..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_40.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_41.gif b/docs/epy/uml_class_diagram_for_oauth2cl_41.gif deleted file mode 100644 index 7aed06e..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_41.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_42.gif b/docs/epy/uml_class_diagram_for_oauth2cl_42.gif deleted file mode 100644 index 1bc8250..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_42.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_43.gif b/docs/epy/uml_class_diagram_for_oauth2cl_43.gif deleted file mode 100644 index 16609ab..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_43.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_44.gif b/docs/epy/uml_class_diagram_for_oauth2cl_44.gif deleted file mode 100644 index 611b29a..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_44.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_45.gif b/docs/epy/uml_class_diagram_for_oauth2cl_45.gif deleted file mode 100644 index be6daa2..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_45.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_46.gif b/docs/epy/uml_class_diagram_for_oauth2cl_46.gif deleted file mode 100644 index a5aad0e..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_46.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_47.gif b/docs/epy/uml_class_diagram_for_oauth2cl_47.gif deleted file mode 100644 index 1bc8250..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_47.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_48.gif b/docs/epy/uml_class_diagram_for_oauth2cl_48.gif deleted file mode 100644 index d4eb9bb..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_48.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_49.gif b/docs/epy/uml_class_diagram_for_oauth2cl_49.gif deleted file mode 100644 index a0d6664..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_49.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_5.gif b/docs/epy/uml_class_diagram_for_oauth2cl_5.gif deleted file mode 100644 index 32b6ba6..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_5.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_50.gif b/docs/epy/uml_class_diagram_for_oauth2cl_50.gif deleted file mode 100644 index ee159d0..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_50.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_51.gif b/docs/epy/uml_class_diagram_for_oauth2cl_51.gif deleted file mode 100644 index d6affed..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_51.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_52.gif b/docs/epy/uml_class_diagram_for_oauth2cl_52.gif deleted file mode 100644 index 98f00ba..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_52.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_53.gif b/docs/epy/uml_class_diagram_for_oauth2cl_53.gif deleted file mode 100644 index af4d927..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_53.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_54.gif b/docs/epy/uml_class_diagram_for_oauth2cl_54.gif deleted file mode 100644 index f539112..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_54.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_55.gif b/docs/epy/uml_class_diagram_for_oauth2cl_55.gif deleted file mode 100644 index c501be4..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_55.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_56.gif b/docs/epy/uml_class_diagram_for_oauth2cl_56.gif deleted file mode 100644 index ef910d8..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_56.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_57.gif b/docs/epy/uml_class_diagram_for_oauth2cl_57.gif deleted file mode 100644 index 3395029..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_57.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_6.gif b/docs/epy/uml_class_diagram_for_oauth2cl_6.gif deleted file mode 100644 index 2573651..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_6.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_7.gif b/docs/epy/uml_class_diagram_for_oauth2cl_7.gif deleted file mode 100644 index 4d06ce3..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_7.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_8.gif b/docs/epy/uml_class_diagram_for_oauth2cl_8.gif deleted file mode 100644 index 981be07..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_8.gif and /dev/null differ diff --git a/docs/epy/uml_class_diagram_for_oauth2cl_9.gif b/docs/epy/uml_class_diagram_for_oauth2cl_9.gif deleted file mode 100644 index afb2dcf..0000000 Binary files a/docs/epy/uml_class_diagram_for_oauth2cl_9.gif and /dev/null differ