Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I spent quite a few hours trying to do exactly this and finally found the answer in this blog post:</p> <p><a href="https://groups.google.com/forum/m/#!msg/google-apps-developer-blog/1pGRCivuSUI/3EAIioKp0-wJ">https://groups.google.com/forum/m/#!msg/google-apps-developer-blog/1pGRCivuSUI/3EAIioKp0-wJ</a></p> <p>Here is a soup to nuts example of using the oauth2client together with the gdata API to access Google Sites including the 'Monkey Patching':</p> <pre><code>from oauth2client.client import flow_from_clientsecrets from oauth2client.file import Storage from oauth2client.tools import run import gdata.sites.client import gdata.sites.data SCOPE = 'https://sites.google.com/feeds/' # client_secrets.json is downloaded from the API console: # https://code.google.com/apis/console/#project:&lt;PROJECT_ID&gt;:access # where &lt;PROJECT_ID&gt; is the ID of your project flow = flow_from_clientsecrets('client_secrets.json', scope=SCOPE, redirect_uri='http://localhost') storage = Storage('plus.dat') credentials = storage.get() if credentials is None or credentials.invalid: credentials = run(flow, storage) # 'Monkey Patch' the data in the credentials into a gdata OAuth2Token # This is based on information in this blog post: # https://groups.google.com/forum/m/#!msg/google-apps-developer-blog/1pGRCivuSUI/3EAIioKp0-wJ auth2token = gdata.gauth.OAuth2Token(client_id=credentials.client_id, client_secret=credentials.client_secret, scope=SCOPE, access_token=credentials.access_token, refresh_token=credentials.refresh_token, user_agent='sites-test/1.0') # Create a gdata client client = gdata.sites.client.SitesClient(source='sites-test', site='YOUR.SITE', domain='YOUR.DOMAIN', auth_token=auth2token) # Authorize it auth2token.authorize(client) # Call an API e.g. to get the site content feed feed = client.GetContentFeed() for entry in feed.entry: print '%s [%s]' % (entry.title.text, entry.Kind()) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload