|
- Method resolution order:
- EmailSettingsClient
- gdata.client.GDClient
- atom.client.AtomPubClient
- __builtin__.object
Methods defined here:
- AddEmailDelegate = add_email_delegate(self, username, address, **kwargs)
- CreateFilter = create_filter(self, username, from_address=None, to_address=None, subject=None, has_the_word=None, does_not_have_the_word=None, has_attachments=None, label=None, mark_as_read=None, archive=None, **kwargs)
- CreateLabel = create_label(self, username, name, **kwargs)
- CreateSendAs = create_send_as(self, username, name, address, reply_to=None, make_default=None, **kwargs)
- DeleteEmailDelegate = delete_email_delegate(self, username, address, **kwargs)
- DeleteLabel = delete_label(self, username, label, **kwargs)
- MakeEmailSettingsUri = make_email_settings_uri(self, username, setting_id)
- RetrieveEmailDelegates = retrieve_email_delegates(self, username, **kwargs)
- RetrieveForwarding = retrieve_forwarding(self, username, **kwargs)
- RetrieveImap = retrieve_imap(self, username, **kwargs)
- RetrieveLabels = retrieve_labels(self, username, **kwargs)
- RetrievePop = retrieve_pop(self, username, **kwargs)
- RetrieveSendAs = retrieve_send_as(self, username, **kwargs)
- RetrieveSignature = retrieve_signature(self, username, **kwargs)
- RetrieveVacation = retrieve_vacation(self, username, **kwargs)
- UpdateForwarding = update_forwarding(self, username, enable, forward_to=None, action=None, **kwargs)
- UpdateGeneralSettings = update_general_settings(self, username, page_size=None, shortcuts=None, arrows=None, snippets=None, use_unicode=None, **kwargs)
- UpdateImap = update_imap(self, username, enable, **kwargs)
- UpdateLanguage = update_language(self, username, language, **kwargs)
- UpdatePop = update_pop(self, username, enable, enable_for=None, action=None, **kwargs)
- UpdateSignature = update_signature(self, username, signature, **kwargs)
- UpdateVacation = update_vacation(self, username, enable, subject=None, message=None, start_date=None, end_date=None, contacts_only=None, domain_only=None, **kwargs)
- UpdateWebclip = update_webclip(self, username, enable, **kwargs)
- __init__(self, domain, auth_token=None, **kwargs)
- Constructs a new client for the Email Settings API.
Args:
domain: string The Google Apps domain with Email Settings.
auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
OAuthToken which authorizes this client to edit the email settings.
kwargs: The other parameters to pass to the gdata.client.GDClient
constructor.
- add_email_delegate(self, username, address, **kwargs)
- Add an email delegate to the mail account
Args:
username: string The name of the user
address: string The email address of the delegated account
- create_filter(self, username, from_address=None, to_address=None, subject=None, has_the_word=None, does_not_have_the_word=None, has_attachments=None, label=None, mark_as_read=None, archive=None, **kwargs)
- Creates a filter with the given properties.
Args:
username: string The name of the user.
from_address: string The source email address for the filter.
to_address: string (optional) The destination email address for
the filter.
subject: string (optional) The value the email must have in its
subject to be filtered.
has_the_word: string (optional) The value the email must have
in its subject or body to be filtered.
does_not_have_the_word: string (optional) The value the email
cannot have in its subject or body to be filtered.
has_attachments: string (optional) A boolean string representing
whether the email must have an attachment to be filtered.
label: string (optional) The name of the label to apply to
messages matching the filter criteria.
mark_as_read: Boolean (optional) Whether or not to mark
messages matching the filter criteria as read.
archive: Boolean (optional) Whether or not to move messages
matching to Archived state.
kwargs: The other parameters to pass to gdata.client.GDClient.post().
Returns:
gdata.apps.emailsettings.data.EmailSettingsFilter of the new resource.
- create_label(self, username, name, **kwargs)
- Creates a label with the given properties.
Args:
username: string The name of the user.
name: string The name of the label.
kwargs: The other parameters to pass to gdata.client.GDClient.post().
Returns:
gdata.apps.emailsettings.data.EmailSettingsLabel of the new resource.
- create_send_as(self, username, name, address, reply_to=None, make_default=None, **kwargs)
- Creates a send-as alias with the given properties.
Args:
username: string The name of the user.
name: string The name that will appear in the "From" field.
address: string The email address that appears as the
origination address for emails sent by this user.
reply_to: string (optional) The address to be used as the reply-to
address in email sent using the alias.
make_default: Boolean (optional) Whether or not this alias should
become the default alias for this user.
kwargs: The other parameters to pass to gdata.client.GDClient.post().
Returns:
gdata.apps.emailsettings.data.EmailSettingsSendAsAlias of the
new resource.
- delete_email_delegate(self, username, address, **kwargs)
- Delete an email delegate from the specified account
Args:
username: string The name of the user
address: string The email address of the delegated account
- delete_label(self, username, label, **kwargs)
- Delete a label from the specified account.
Args:
username: string Name of the user
label: string Name of the label to be deleted
Returns:
An atom.http_core.HttpResponse() with the result of the request
- make_email_settings_uri(self, username, setting_id)
- Creates the URI for the Email Settings API call.
Using this client's Google Apps domain, create the URI to setup
email settings for the given user in that domain. If params are provided,
append them as GET params.
Args:
username: string The name of the user affected by this setting.
setting_id: string The key of the setting to be configured.
Returns:
A string giving the URI for Email Settings API calls for this client's
Google Apps domain.
- retrieve_email_delegates(self, username, **kwargs)
- Retrieve a feed of the email delegates for the specified username
Args:
username: string The name of the user to get the email delegates for
Returns:
A gdata.data.GDFeed of the user's email delegates
- retrieve_forwarding(self, username, **kwargs)
- Retrieves forwarding settings for the specified username
Args:
username: string The name of the user to get the forwarding settings for
Returns:
A gdata.data.GDEntry of the user's email forwarding settings
- retrieve_imap(self, username, **kwargs)
- Retrieves imap settings for the specified username
Args:
username: string The name of the user to get the imap settings for
Returns:
A gdata.data.GDEntry of the user's IMAP settings
- retrieve_labels(self, username, **kwargs)
- Retrieves email labels for the specified username
Args:
username: string The name of the user to get the labels for
Returns:
A gdata.data.GDFeed of the user's email labels
- retrieve_pop(self, username, **kwargs)
- Retrieves POP settings for the specified username
Args:
username: string The name of the user to get the POP settings for
Returns:
A gdata.data.GDEntry of the user's POP settings
- retrieve_send_as(self, username, **kwargs)
- Retrieves send-as aliases for the specified username
Args:
username: string The name of the user to get the send-as for
Returns:
A gdata.data.GDFeed of the user's send-as alias settings
- retrieve_signature(self, username, **kwargs)
- Retrieves signature settings for the specified username
Args:
username: string The name of the user to get the signature settings for
Returns:
A gdata.data.GDEntry of the user's signature settings
- retrieve_vacation(self, username, **kwargs)
- Retrieves vacation settings for the specified username
Args:
username: string The name of the user to get the vacation settings for
Returns:
A gdata.data.GDEntry of the user's vacation auto-responder settings
- update_forwarding(self, username, enable, forward_to=None, action=None, **kwargs)
- Update Google Mail Forwarding settings.
Args:
username: string The name of the user.
enable: Boolean Whether to enable incoming email forwarding.
forward_to: (optional) string The address email will be forwarded to.
action: string (optional) The action to perform after forwarding
an email (ACTION_KEEP, ACTION_ARCHIVE, ACTION_DELETE).
kwargs: The other parameters to pass to the update method.
Returns:
gdata.apps.emailsettings.data.EmailSettingsForwarding of the
updated resource
- update_general_settings(self, username, page_size=None, shortcuts=None, arrows=None, snippets=None, use_unicode=None, **kwargs)
- Update Google Mail general settings.
Args:
username: string The name of the user.
page_size: int (optional) The number of conversations to be shown per
page.
shortcuts: Boolean (optional) Whether to enable keyboard shortcuts.
arrows: Boolean (optional) Whether to display arrow-shaped personal
indicators next to email sent specifically to the user.
snippets: Boolean (optional) Whether to display snippets of the messages
in the inbox and when searching.
use_unicode: Boolean (optional) Whether to use UTF-8 (unicode) encoding
for all outgoing messages.
kwargs: The other parameters to pass to the update method.
Returns:
gdata.apps.emailsettings.data.EmailSettingsGeneral of the
updated resource.
- update_imap(self, username, enable, **kwargs)
- Update Google Mail IMAP settings.
Args:
username: string The name of the user.
enable: Boolean Whether to enable IMAP access.language
kwargs: The other parameters to pass to the update method.
Returns:
gdata.apps.emailsettings.data.EmailSettingsImap of the updated resource.
- update_language(self, username, language, **kwargs)
- Update Google Mail language settings.
Args:
username: string The name of the user.
language: string The language tag for Google Mail's display language.
kwargs: The other parameters to pass to the update method.
Returns:
gdata.apps.emailsettings.data.EmailSettingsLanguage of the
updated resource.
- update_pop(self, username, enable, enable_for=None, action=None, **kwargs)
- Update Google Mail POP settings.
Args:
username: string The name of the user.
enable: Boolean Whether to enable incoming POP3 access.
enable_for: string (optional) Whether to enable POP3 for all mail
(POP_ENABLE_FOR_ALL_MAIL), or mail from now on
(POP_ENABLE_FOR_MAIL_FROM_NOW_ON).
action: string (optional) What Google Mail should do with its copy
of the email after it is retrieved using POP (ACTION_KEEP,
ACTION_ARCHIVE, ACTION_DELETE).
kwargs: The other parameters to pass to the update method.
Returns:
gdata.apps.emailsettings.data.EmailSettingsPop of the updated resource.
- update_signature(self, username, signature, **kwargs)
- Update Google Mail signature.
Args:
username: string The name of the user.
signature: string The signature to be appended to outgoing messages.
kwargs: The other parameters to pass to the update method.
Returns:
gdata.apps.emailsettings.data.EmailSettingsSignature of the
updated resource.
- update_vacation(self, username, enable, subject=None, message=None, start_date=None, end_date=None, contacts_only=None, domain_only=None, **kwargs)
- Update Google Mail vacation-responder settings.
Args:
username: string The name of the user.
enable: Boolean Whether to enable the vacation responder.
subject: string (optional) The subject line of the vacation responder
autoresponse.
message: string (optional) The message body of the vacation responder
autoresponse.
startDate: string (optional) The start date of the vacation responder
autoresponse.
endDate: string (optional) The end date of the vacation responder
autoresponse.
contacts_only: Boolean (optional) Whether to only send autoresponses
to known contacts.
domain_only: Boolean (optional) Whether to only send autoresponses
to users in the primary domain.
kwargs: The other parameters to pass to the update method.
Returns:
gdata.apps.emailsettings.data.EmailSettingsVacationResponder of the
updated resource.
- update_webclip(self, username, enable, **kwargs)
- Enable/Disable Google Mail web clip.
Args:
username: string The name of the user.
enable: Boolean Whether to enable showing Web clips.
kwargs: The other parameters to pass to the update method.
Returns:
gdata.apps.emailsettings.data.EmailSettingsWebClip of the
updated resource.
Data and other attributes defined here:
- api_version = '2.0'
- auth_scopes = ('https://apps-apis.google.com/a/feeds/user/', 'https://apps-apis.google.com/a/feeds/policies/', 'https://apps-apis.google.com/a/feeds/alias/', 'https://apps-apis.google.com/a/feeds/groups/', 'https://apps-apis.google.com/a/feeds/compliance/audit/', 'https://apps-apis.google.com/a/feeds/migration/', 'https://apps-apis.google.com/a/feeds/emailsettings/2.0/')
- auth_service = 'apps'
- host = 'apps-apis.google.com'
- ssl = True
Methods inherited from gdata.client.GDClient:
- Batch = batch(self, feed, uri=None, force=False, auth_token=None, **kwargs)
- Sends a batch request to the server to execute operation entries.
Args:
feed: A batch feed containing batch entries, each is an operation.
uri: (optional) The uri to which the batch request feed should be POSTed.
If none is provided, then the feed's edit link will be used.
force: (optional) boolean set to True if you want the batch update to
clobber all data. If False, the version in the information in the
feed object will cause the server to check to see that no changes
intervened between when you fetched the data and when you sent the
changes.
auth_token: (optional) An object which sets the Authorization HTTP header
in its modify_request method. Recommended classes include
gdata.gauth.ClientLoginToken and gdata.gauth.AuthSubToken
among others.
- ClientLogin = client_login(self, email, password, source, service=None, account_type='HOSTED_OR_GOOGLE', auth_url=<atom.http_core.Uri object>, captcha_token=None, captcha_response=None)
- Performs an auth request using the user's email address and password.
In order to modify user specific data and read user private data, your
application must be authorized by the user. One way to demonstrage
authorization is by including a Client Login token in the Authorization
HTTP header of all requests. This method requests the Client Login token
by sending the user's email address, password, the name of the
application, and the service code for the service which will be accessed
by the application. If the username and password are correct, the server
will respond with the client login code and a new ClientLoginToken
object will be set in the client's auth_token member. With the auth_token
set, future requests from this client will include the Client Login
token.
For a list of service names, see
http://code.google.com/apis/gdata/faq.html#clientlogin
For more information on Client Login, see:
http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html
Args:
email: str The user's email address or username.
password: str The password for the user's account.
source: str The name of your application. This can be anything you
like but should should give some indication of which app is
making the request.
service: str The service code for the service you would like to access.
For example, 'cp' for contacts, 'cl' for calendar. For a full
list see
http://code.google.com/apis/gdata/faq.html#clientlogin
If you are using a subclass of the gdata.client.GDClient, the
service will usually be filled in for you so you do not need
to specify it. For example see BloggerClient,
SpreadsheetsClient, etc.
account_type: str (optional) The type of account which is being
authenticated. This can be either 'GOOGLE' for a Google
Account, 'HOSTED' for a Google Apps Account, or the
default 'HOSTED_OR_GOOGLE' which will select the Google
Apps Account if the same email address is used for both
a Google Account and a Google Apps Account.
auth_url: str (optional) The URL to which the login request should be
sent.
captcha_token: str (optional) If a previous login attempt was reponded
to with a CAPTCHA challenge, this is the token which
identifies the challenge (from the CAPTCHA's URL).
captcha_response: str (optional) If a previous login attempt was
reponded to with a CAPTCHA challenge, this is the
response text which was contained in the challenge.
Returns:
Generated token, which is also stored in this object.
Raises:
A RequestError or one of its suclasses: BadAuthentication,
BadAuthenticationServiceURL, ClientLoginFailed,
ClientLoginTokenMissing, or CaptchaChallenge
- Delete = delete(self, entry_or_uri, auth_token=None, force=False, **kwargs)
- GetAccessToken = get_access_token(self, request_token, url='https://www.google.com/accounts/OAuthGetAccessToken')
- Exchanges an authorized OAuth request token for an access token.
Contacts the Google OAuth server to upgrade a previously authorized
request token. Once the request token is upgraded to an access token,
the access token may be used to access the user's data.
For more details, see the Google Accounts OAuth documentation:
http://code.google.com/apis/accounts/docs/OAuth.html#AccessToken
Args:
request_token: An OAuth token which has been authorized by the user.
url: (optional) The URL to which the upgrade request should be sent.
Defaults to: https://www.google.com/accounts/OAuthAuthorizeToken
- GetEntry = get_entry(self, uri, auth_token=None, converter=None, desired_class=<class 'gdata.data.GDEntry'>, etag=None, **kwargs)
- GetFeed = get_feed(self, uri, auth_token=None, converter=None, desired_class=<class 'gdata.data.GDFeed'>, **kwargs)
- GetNext = get_next(self, feed, auth_token=None, converter=None, desired_class=None, **kwargs)
- Fetches the next set of results from the feed.
When requesting a feed, the number of entries returned is capped at a
service specific default limit (often 25 entries). You can specify your
own entry-count cap using the max-results URL query parameter. If there
are more results than could fit under max-results, the feed will contain
a next link. This method performs a GET against this next results URL.
Returns:
A new feed object containing the next set of entries in this feed.
- GetOAuthToken = get_oauth_token(self, scopes, next, consumer_key, consumer_secret=None, rsa_private_key=None, url='https://www.google.com/accounts/OAuthGetRequestToken')
- Obtains an OAuth request token to allow the user to authorize this app.
Once this client has a request token, the user can authorize the request
token by visiting the authorization URL in their browser. After being
redirected back to this app at the 'next' URL, this app can then exchange
the authorized request token for an access token.
For more information see the documentation on Google Accounts with OAuth:
http://code.google.com/apis/accounts/docs/OAuth.html#AuthProcess
Args:
scopes: list of strings or atom.http_core.Uri objects which specify the
URL prefixes which this app will be accessing. For example, to access
the Google Calendar API, you would want to use scopes:
['https://www.google.com/calendar/feeds/',
'http://www.google.com/calendar/feeds/']
next: str or atom.http_core.Uri object, The URL which the user's browser
should be sent to after they authorize access to their data. This
should be a URL in your application which will read the token
information from the URL and upgrade the request token to an access
token.
consumer_key: str This is the identifier for this application which you
should have received when you registered your application with Google
to use OAuth.
consumer_secret: str (optional) The shared secret between your app and
Google which provides evidence that this request is coming from you
application and not another app. If present, this libraries assumes
you want to use an HMAC signature to verify requests. Keep this data
a secret.
rsa_private_key: str (optional) The RSA private key which is used to
generate a digital signature which is checked by Google's server. If
present, this library assumes that you want to use an RSA signature
to verify requests. Keep this data a secret.
url: The URL to which a request for a token should be made. The default
is Google's OAuth request token provider.
- ModifyRequest = modify_request(self, http_request)
- Adds or changes request before making the HTTP request.
This client will add the API version if it is specified.
Subclasses may override this method to add their own request
modifications before the request is made.
- Post = post(self, entry, uri, auth_token=None, converter=None, desired_class=None, **kwargs)
- Request = request(self, method=None, uri=None, auth_token=None, http_request=None, converter=None, desired_class=None, redirects_remaining=4, **kwargs)
- Make an HTTP request to the server.
See also documentation for atom.client.AtomPubClient.request.
If a 302 redirect is sent from the server to the client, this client
assumes that the redirect is in the form used by the Google Calendar API.
The same request URI and method will be used as in the original request,
but a gsessionid URL parameter will be added to the request URI with
the value provided in the server's 302 redirect response. If the 302
redirect is not in the format specified by the Google Calendar API, a
RedirectError will be raised containing the body of the server's
response.
The method calls the client's modify_request method to make any changes
required by the client before the request is made. For example, a
version 2 client could add a GData-Version: 2 header to the request in
its modify_request method.
Args:
method: str The HTTP verb for this request, usually 'GET', 'POST',
'PUT', or 'DELETE'
uri: atom.http_core.Uri, str, or unicode The URL being requested.
auth_token: An object which sets the Authorization HTTP header in its
modify_request method. Recommended classes include
gdata.gauth.ClientLoginToken and gdata.gauth.AuthSubToken
among others.
http_request: (optional) atom.http_core.HttpRequest
converter: function which takes the body of the response as its only
argument and returns the desired object.
desired_class: class descended from atom.core.XmlElement to which a
successful response should be converted. If there is no
converter function specified (converter=None) then the
desired_class will be used in calling the
atom.core.parse function. If neither
the desired_class nor the converter is specified, an
HTTP reponse object will be returned.
redirects_remaining: (optional) int, if this number is 0 and the
server sends a 302 redirect, the request method
will raise an exception. This parameter is used in
recursive request calls to avoid an infinite loop.
Any additional arguments are passed through to
atom.client.AtomPubClient.request.
Returns:
An HTTP response object (see atom.http_core.HttpResponse for a
description of the object's interface) if no converter was
specified and no desired_class was specified. If a converter function
was provided, the results of calling the converter are returned. If no
converter was specified but a desired_class was provided, the response
body will be converted to the class using
atom.core.parse.
- RequestClientLoginToken = request_client_login_token(self, email, password, source, service=None, account_type='HOSTED_OR_GOOGLE', auth_url=<atom.http_core.Uri object>, captcha_token=None, captcha_response=None)
- RevokeToken = revoke_token(self, token=None, url=<atom.http_core.Uri object>)
- Requests that the token be invalidated.
This method can be used for both AuthSub and OAuth tokens (to invalidate
a ClientLogin token, the user must change their password).
Returns:
True if the server responded with a 200.
Raises:
A RequestError if the server responds with a non-200 status.
- Update = update(self, entry, auth_token=None, force=False, uri=None, **kwargs)
- Edits the entry on the server by sending the XML for this entry.
Performs a PUT and converts the response to a new entry object with a
matching class to the entry passed in.
Args:
entry:
auth_token:
force: boolean stating whether an update should be forced. Defaults to
False. Normally, if a change has been made since the passed in
entry was obtained, the server will not overwrite the entry since
the changes were based on an obsolete version of the entry.
Setting force to True will cause the update to silently
overwrite whatever version is present.
uri: The uri to put to. If provided, this uri is PUT to rather than the
inferred uri from the entry's edit link.
Returns:
A new Entry object of a matching type to the entry which was passed in.
- UpgradeToken = upgrade_token(self, token=None, url=<atom.http_core.Uri object>)
- Asks the Google auth server for a multi-use AuthSub token.
For details on AuthSub, see:
http://code.google.com/apis/accounts/docs/AuthSub.html
Args:
token: gdata.gauth.AuthSubToken or gdata.gauth.SecureAuthSubToken
(optional) If no token is passed in, the client's auth_token member
is used to request the new token. The token object will be modified
to contain the new session token string.
url: str or atom.http_core.Uri (optional) The URL to which the token
upgrade request should be sent. Defaults to:
https://www.google.com/accounts/AuthSubSessionToken
Returns:
The upgraded gdata.gauth.AuthSubToken object.
- batch(self, feed, uri=None, force=False, auth_token=None, **kwargs)
- Sends a batch request to the server to execute operation entries.
Args:
feed: A batch feed containing batch entries, each is an operation.
uri: (optional) The uri to which the batch request feed should be POSTed.
If none is provided, then the feed's edit link will be used.
force: (optional) boolean set to True if you want the batch update to
clobber all data. If False, the version in the information in the
feed object will cause the server to check to see that no changes
intervened between when you fetched the data and when you sent the
changes.
auth_token: (optional) An object which sets the Authorization HTTP header
in its modify_request method. Recommended classes include
gdata.gauth.ClientLoginToken and gdata.gauth.AuthSubToken
among others.
- client_login(self, email, password, source, service=None, account_type='HOSTED_OR_GOOGLE', auth_url=<atom.http_core.Uri object>, captcha_token=None, captcha_response=None)
- Performs an auth request using the user's email address and password.
In order to modify user specific data and read user private data, your
application must be authorized by the user. One way to demonstrage
authorization is by including a Client Login token in the Authorization
HTTP header of all requests. This method requests the Client Login token
by sending the user's email address, password, the name of the
application, and the service code for the service which will be accessed
by the application. If the username and password are correct, the server
will respond with the client login code and a new ClientLoginToken
object will be set in the client's auth_token member. With the auth_token
set, future requests from this client will include the Client Login
token.
For a list of service names, see
http://code.google.com/apis/gdata/faq.html#clientlogin
For more information on Client Login, see:
http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html
Args:
email: str The user's email address or username.
password: str The password for the user's account.
source: str The name of your application. This can be anything you
like but should should give some indication of which app is
making the request.
service: str The service code for the service you would like to access.
For example, 'cp' for contacts, 'cl' for calendar. For a full
list see
http://code.google.com/apis/gdata/faq.html#clientlogin
If you are using a subclass of the gdata.client.GDClient, the
service will usually be filled in for you so you do not need
to specify it. For example see BloggerClient,
SpreadsheetsClient, etc.
account_type: str (optional) The type of account which is being
authenticated. This can be either 'GOOGLE' for a Google
Account, 'HOSTED' for a Google Apps Account, or the
default 'HOSTED_OR_GOOGLE' which will select the Google
Apps Account if the same email address is used for both
a Google Account and a Google Apps Account.
auth_url: str (optional) The URL to which the login request should be
sent.
captcha_token: str (optional) If a previous login attempt was reponded
to with a CAPTCHA challenge, this is the token which
identifies the challenge (from the CAPTCHA's URL).
captcha_response: str (optional) If a previous login attempt was
reponded to with a CAPTCHA challenge, this is the
response text which was contained in the challenge.
Returns:
Generated token, which is also stored in this object.
Raises:
A RequestError or one of its suclasses: BadAuthentication,
BadAuthenticationServiceURL, ClientLoginFailed,
ClientLoginTokenMissing, or CaptchaChallenge
- delete(self, entry_or_uri, auth_token=None, force=False, **kwargs)
- get_access_token(self, request_token, url='https://www.google.com/accounts/OAuthGetAccessToken')
- Exchanges an authorized OAuth request token for an access token.
Contacts the Google OAuth server to upgrade a previously authorized
request token. Once the request token is upgraded to an access token,
the access token may be used to access the user's data.
For more details, see the Google Accounts OAuth documentation:
http://code.google.com/apis/accounts/docs/OAuth.html#AccessToken
Args:
request_token: An OAuth token which has been authorized by the user.
url: (optional) The URL to which the upgrade request should be sent.
Defaults to: https://www.google.com/accounts/OAuthAuthorizeToken
- get_entry(self, uri, auth_token=None, converter=None, desired_class=<class 'gdata.data.GDEntry'>, etag=None, **kwargs)
- get_feed(self, uri, auth_token=None, converter=None, desired_class=<class 'gdata.data.GDFeed'>, **kwargs)
- get_next(self, feed, auth_token=None, converter=None, desired_class=None, **kwargs)
- Fetches the next set of results from the feed.
When requesting a feed, the number of entries returned is capped at a
service specific default limit (often 25 entries). You can specify your
own entry-count cap using the max-results URL query parameter. If there
are more results than could fit under max-results, the feed will contain
a next link. This method performs a GET against this next results URL.
Returns:
A new feed object containing the next set of entries in this feed.
- get_oauth_token(self, scopes, next, consumer_key, consumer_secret=None, rsa_private_key=None, url='https://www.google.com/accounts/OAuthGetRequestToken')
- Obtains an OAuth request token to allow the user to authorize this app.
Once this client has a request token, the user can authorize the request
token by visiting the authorization URL in their browser. After being
redirected back to this app at the 'next' URL, this app can then exchange
the authorized request token for an access token.
For more information see the documentation on Google Accounts with OAuth:
http://code.google.com/apis/accounts/docs/OAuth.html#AuthProcess
Args:
scopes: list of strings or atom.http_core.Uri objects which specify the
URL prefixes which this app will be accessing. For example, to access
the Google Calendar API, you would want to use scopes:
['https://www.google.com/calendar/feeds/',
'http://www.google.com/calendar/feeds/']
next: str or atom.http_core.Uri object, The URL which the user's browser
should be sent to after they authorize access to their data. This
should be a URL in your application which will read the token
information from the URL and upgrade the request token to an access
token.
consumer_key: str This is the identifier for this application which you
should have received when you registered your application with Google
to use OAuth.
consumer_secret: str (optional) The shared secret between your app and
Google which provides evidence that this request is coming from you
application and not another app. If present, this libraries assumes
you want to use an HMAC signature to verify requests. Keep this data
a secret.
rsa_private_key: str (optional) The RSA private key which is used to
generate a digital signature which is checked by Google's server. If
present, this library assumes that you want to use an RSA signature
to verify requests. Keep this data a secret.
url: The URL to which a request for a token should be made. The default
is Google's OAuth request token provider.
- modify_request(self, http_request)
- Adds or changes request before making the HTTP request.
This client will add the API version if it is specified.
Subclasses may override this method to add their own request
modifications before the request is made.
- post(self, entry, uri, auth_token=None, converter=None, desired_class=None, **kwargs)
- request(self, method=None, uri=None, auth_token=None, http_request=None, converter=None, desired_class=None, redirects_remaining=4, **kwargs)
- Make an HTTP request to the server.
See also documentation for atom.client.AtomPubClient.request.
If a 302 redirect is sent from the server to the client, this client
assumes that the redirect is in the form used by the Google Calendar API.
The same request URI and method will be used as in the original request,
but a gsessionid URL parameter will be added to the request URI with
the value provided in the server's 302 redirect response. If the 302
redirect is not in the format specified by the Google Calendar API, a
RedirectError will be raised containing the body of the server's
response.
The method calls the client's modify_request method to make any changes
required by the client before the request is made. For example, a
version 2 client could add a GData-Version: 2 header to the request in
its modify_request method.
Args:
method: str The HTTP verb for this request, usually 'GET', 'POST',
'PUT', or 'DELETE'
uri: atom.http_core.Uri, str, or unicode The URL being requested.
auth_token: An object which sets the Authorization HTTP header in its
modify_request method. Recommended classes include
gdata.gauth.ClientLoginToken and gdata.gauth.AuthSubToken
among others.
http_request: (optional) atom.http_core.HttpRequest
converter: function which takes the body of the response as its only
argument and returns the desired object.
desired_class: class descended from atom.core.XmlElement to which a
successful response should be converted. If there is no
converter function specified (converter=None) then the
desired_class will be used in calling the
atom.core.parse function. If neither
the desired_class nor the converter is specified, an
HTTP reponse object will be returned.
redirects_remaining: (optional) int, if this number is 0 and the
server sends a 302 redirect, the request method
will raise an exception. This parameter is used in
recursive request calls to avoid an infinite loop.
Any additional arguments are passed through to
atom.client.AtomPubClient.request.
Returns:
An HTTP response object (see atom.http_core.HttpResponse for a
description of the object's interface) if no converter was
specified and no desired_class was specified. If a converter function
was provided, the results of calling the converter are returned. If no
converter was specified but a desired_class was provided, the response
body will be converted to the class using
atom.core.parse.
- request_client_login_token(self, email, password, source, service=None, account_type='HOSTED_OR_GOOGLE', auth_url=<atom.http_core.Uri object>, captcha_token=None, captcha_response=None)
- revoke_token(self, token=None, url=<atom.http_core.Uri object>)
- Requests that the token be invalidated.
This method can be used for both AuthSub and OAuth tokens (to invalidate
a ClientLogin token, the user must change their password).
Returns:
True if the server responded with a 200.
Raises:
A RequestError if the server responds with a non-200 status.
- update(self, entry, auth_token=None, force=False, uri=None, **kwargs)
- Edits the entry on the server by sending the XML for this entry.
Performs a PUT and converts the response to a new entry object with a
matching class to the entry passed in.
Args:
entry:
auth_token:
force: boolean stating whether an update should be forced. Defaults to
False. Normally, if a change has been made since the passed in
entry was obtained, the server will not overwrite the entry since
the changes were based on an obsolete version of the entry.
Setting force to True will cause the update to silently
overwrite whatever version is present.
uri: The uri to put to. If provided, this uri is PUT to rather than the
inferred uri from the entry's edit link.
Returns:
A new Entry object of a matching type to the entry which was passed in.
- upgrade_token(self, token=None, url=<atom.http_core.Uri object>)
- Asks the Google auth server for a multi-use AuthSub token.
For details on AuthSub, see:
http://code.google.com/apis/accounts/docs/AuthSub.html
Args:
token: gdata.gauth.AuthSubToken or gdata.gauth.SecureAuthSubToken
(optional) If no token is passed in, the client's auth_token member
is used to request the new token. The token object will be modified
to contain the new session token string.
url: str or atom.http_core.Uri (optional) The URL to which the token
upgrade request should be sent. Defaults to:
https://www.google.com/accounts/AuthSubSessionToken
Returns:
The upgraded gdata.gauth.AuthSubToken object.
Data and other attributes inherited from gdata.client.GDClient:
- alt_auth_service = None
Methods inherited from atom.client.AtomPubClient:
- Get = get(self, uri=None, auth_token=None, http_request=None, **kwargs)
- Performs a request using the GET method, returns an HTTP response.
- Put = put(self, uri=None, data=None, auth_token=None, http_request=None, **kwargs)
- Sends data using the PUT method, returns an HTTP response.
- get(self, uri=None, auth_token=None, http_request=None, **kwargs)
- Performs a request using the GET method, returns an HTTP response.
- put(self, uri=None, data=None, auth_token=None, http_request=None, **kwargs)
- Sends data using the PUT method, returns an HTTP response.
Data descriptors inherited from atom.client.AtomPubClient:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from atom.client.AtomPubClient:
- auth_token = None
- xoauth_requestor_id = None
|