Example #1
0
def clean_full_document(client, doc_type, doc_id, blog_path="imgstaging", preview=True):
    """
    Returns a Google Doc with 'clean' HTML.

    usage:
        >>> clean_full_document('document', doc_id)

    """
    return client.get_file_content('https://docs.google.com/feeds/download/%ss/Export?id=%s&format=text' % (doc_type, doc_id))
Example #2
0
    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)
Example #3
0
 def filegetter(doc_type, doc_id):
     return client.get_file_content('https://docs.google.com/feeds/download/%ss/Export?id=%s&format=txt' % (doc_type, doc_id))