Created
October 10, 2010 15:22
-
-
Save onyxfish/619313 to your computer and use it in GitHub Desktop.
How to fetch Google Spreadsheets from AppEngine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fetch_csv(self, options): | |
""" | |
Retrieves a single Google spreadsheet as CSV using ClientLogin | |
authentication. | |
TODO: handle retries and timeouts on auth calls | |
TOOD: handle retries and timeouts on content fetching | |
""" | |
client = gdata.docs.client.DocsClient() | |
client.ClientLogin(config.USER_EMAIL, config.USER_PASSWORD, config.APP_DOMAIN) | |
spreadsheets_client = gdata.spreadsheet.service.SpreadsheetsService() | |
spreadsheets_client.ClientLogin(config.USER_EMAIL, config.USER_PASSWORD, config.APP_DOMAIN) | |
docs_token = client.auth_token | |
client.auth_token = gdata.gauth.ClientLoginToken(spreadsheets_client.GetClientLoginToken()) | |
return client.get_file_content(CSV_URL % options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment