blob: 6205b35bd3786cb3075bd280eae371b55b76e773 [file] [log] [blame]
Joe Gregorio1b425aa2012-08-24 12:04:34 -04001<?xml version="1.0" encoding="ascii"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "DTD/xhtml1-transitional.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5<head>
6 <title>oauth2client.gce</title>
7 <link rel="stylesheet" href="epydoc.css" type="text/css" />
8 <script type="text/javascript" src="epydoc.js"></script>
9</head>
10
11<body bgcolor="white" text="black" link="blue" vlink="#204080"
12 alink="#204080">
13<!-- ==================== NAVIGATION BAR ==================== -->
14<table class="navbar" border="0" width="100%" cellpadding="0"
15 bgcolor="#a0c0ff" cellspacing="0">
16 <tr valign="middle">
17
18 <!-- Tree link -->
19 <th>&nbsp;&nbsp;&nbsp;<a
20 href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
21
22 <!-- Index link -->
23 <th>&nbsp;&nbsp;&nbsp;<a
24 href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
25
26 <!-- Help link -->
27 <th>&nbsp;&nbsp;&nbsp;<a
28 href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
29
30 <th class="navbar" width="100%"></th>
31 </tr>
32</table>
33<table width="100%" cellpadding="0" cellspacing="0">
34 <tr valign="top">
35 <td width="100%">
36 <span class="breadcrumbs">
37 <a href="oauth2client-module.html">Package&nbsp;oauth2client</a> ::
38 Module&nbsp;gce
39 </span>
40 </td>
41 <td>
42 <table cellpadding="0" cellspacing="0">
43 <!-- hide/show private -->
44 <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
45 onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
46 <tr><td align="right"><span class="options"
47 >[<a href="frames.html" target="_top">frames</a
48 >]&nbsp;|&nbsp;<a href="oauth2client.gce-pysrc.html"
49 target="_top">no&nbsp;frames</a>]</span></td></tr>
50 </table>
51 </td>
52 </tr>
53</table>
54<h1 class="epydoc">Source Code for <a href="oauth2client.gce-module.html">Module oauth2client.gce</a></h1>
55<pre class="py-src">
56<a name="L1"></a><tt class="py-lineno"> 1</tt> <tt class="py-line"><tt class="py-comment"># Copyright (C) 2012 Google Inc.</tt> </tt>
57<a name="L2"></a><tt class="py-lineno"> 2</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
58<a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"><tt class="py-comment"># Licensed under the Apache License, Version 2.0 (the "License");</tt> </tt>
59<a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"><tt class="py-comment"># you may not use this file except in compliance with the License.</tt> </tt>
60<a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"><tt class="py-comment"># You may obtain a copy of the License at</tt> </tt>
61<a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
62<a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-comment"># http://www.apache.org/licenses/LICENSE-2.0</tt> </tt>
63<a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
64<a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"><tt class="py-comment"># Unless required by applicable law or agreed to in writing, software</tt> </tt>
65<a name="L10"></a><tt class="py-lineno">10</tt> <tt class="py-line"><tt class="py-comment"># distributed under the License is distributed on an "AS IS" BASIS,</tt> </tt>
66<a name="L11"></a><tt class="py-lineno">11</tt> <tt class="py-line"><tt class="py-comment"># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</tt> </tt>
67<a name="L12"></a><tt class="py-lineno">12</tt> <tt class="py-line"><tt class="py-comment"># See the License for the specific language governing permissions and</tt> </tt>
68<a name="L13"></a><tt class="py-lineno">13</tt> <tt class="py-line"><tt class="py-comment"># limitations under the License.</tt> </tt>
69<a name="L14"></a><tt class="py-lineno">14</tt> <tt class="py-line"> </tt>
70<a name="L15"></a><tt class="py-lineno">15</tt> <tt class="py-line"><tt class="py-docstring">"""Utilities for Google Compute Engine</tt> </tt>
71<a name="L16"></a><tt class="py-lineno">16</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
72<a name="L17"></a><tt class="py-lineno">17</tt> <tt class="py-line"><tt class="py-docstring">Utilities for making it easier to use OAuth 2.0 on Google Compute Engine.</tt> </tt>
73<a name="L18"></a><tt class="py-lineno">18</tt> <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
74<a name="L19"></a><tt class="py-lineno">19</tt> <tt class="py-line"> </tt>
75<a name="L20"></a><tt class="py-lineno">20</tt> <tt class="py-line"><tt class="py-name">__author__</tt> <tt class="py-op">=</tt> <tt class="py-string">'jcgregorio@google.com (Joe Gregorio)'</tt> </tt>
76<a name="L21"></a><tt class="py-lineno">21</tt> <tt class="py-line"> </tt>
77<a name="L22"></a><tt class="py-lineno">22</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">httplib2</tt> </tt>
78<a name="L23"></a><tt class="py-lineno">23</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">logging</tt> </tt>
79<a name="L24"></a><tt class="py-lineno">24</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">uritemplate</tt> </tt>
80<a name="L25"></a><tt class="py-lineno">25</tt> <tt class="py-line"> </tt>
81<a name="L26"></a><tt class="py-lineno">26</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Package oauth2client=oauth2client-module.html"><a title="oauth2client" class="py-name" href="#" onclick="return doclink('link-0', 'oauth2client', 'link-0');">oauth2client</a></tt> <tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Module oauth2client.util=oauth2client.util-module.html"><a title="oauth2client.util" class="py-name" href="#" onclick="return doclink('link-1', 'util', 'link-1');">util</a></tt> </tt>
82<a name="L27"></a><tt class="py-lineno">27</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-2" class="py-name"><a title="oauth2client" class="py-name" href="#" onclick="return doclink('link-2', 'oauth2client', 'link-0');">oauth2client</a></tt><tt class="py-op">.</tt><tt id="link-3" class="py-name" targets="Module oauth2client.anyjson=oauth2client.anyjson-module.html"><a title="oauth2client.anyjson" class="py-name" href="#" onclick="return doclink('link-3', 'anyjson', 'link-3');">anyjson</a></tt> <tt class="py-keyword">import</tt> <tt class="py-name">simplejson</tt> </tt>
83<a name="L28"></a><tt class="py-lineno">28</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-4" class="py-name"><a title="oauth2client" class="py-name" href="#" onclick="return doclink('link-4', 'oauth2client', 'link-0');">oauth2client</a></tt><tt class="py-op">.</tt><tt id="link-5" class="py-name" targets="Module oauth2client.client=oauth2client.client-module.html"><a title="oauth2client.client" class="py-name" href="#" onclick="return doclink('link-5', 'client', 'link-5');">client</a></tt> <tt class="py-keyword">import</tt> <tt id="link-6" class="py-name" targets="Class oauth2client.client.AccessTokenRefreshError=oauth2client.client.AccessTokenRefreshError-class.html"><a title="oauth2client.client.AccessTokenRefreshError" class="py-name" href="#" onclick="return doclink('link-6', 'AccessTokenRefreshError', 'link-6');">AccessTokenRefreshError</a></tt> </tt>
84<a name="L29"></a><tt class="py-lineno">29</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-7" class="py-name"><a title="oauth2client" class="py-name" href="#" onclick="return doclink('link-7', 'oauth2client', 'link-0');">oauth2client</a></tt><tt class="py-op">.</tt><tt id="link-8" class="py-name"><a title="oauth2client.client" class="py-name" href="#" onclick="return doclink('link-8', 'client', 'link-5');">client</a></tt> <tt class="py-keyword">import</tt> <tt id="link-9" class="py-name" targets="Class oauth2client.client.AssertionCredentials=oauth2client.client.AssertionCredentials-class.html"><a title="oauth2client.client.AssertionCredentials" class="py-name" href="#" onclick="return doclink('link-9', 'AssertionCredentials', 'link-9');">AssertionCredentials</a></tt> </tt>
85<a name="L30"></a><tt class="py-lineno">30</tt> <tt class="py-line"> </tt>
86<a name="L31"></a><tt class="py-lineno">31</tt> <tt class="py-line"><tt id="link-10" class="py-name" targets="Variable apiclient.discovery.logger=apiclient.discovery-module.html#logger,Variable oauth2client.appengine.logger=oauth2client.appengine-module.html#logger,Variable oauth2client.client.logger=oauth2client.client-module.html#logger,Variable oauth2client.crypt.logger=oauth2client.crypt-module.html#logger,Variable oauth2client.gce.logger=oauth2client.gce-module.html#logger,Variable oauth2client.locked_file.logger=oauth2client.locked_file-module.html#logger,Variable oauth2client.multistore_file.logger=oauth2client.multistore_file-module.html#logger,Variable oauth2client.util.logger=oauth2client.util-module.html#logger"><a title="apiclient.discovery.logger
87oauth2client.appengine.logger
88oauth2client.client.logger
89oauth2client.crypt.logger
90oauth2client.gce.logger
91oauth2client.locked_file.logger
92oauth2client.multistore_file.logger
93oauth2client.util.logger" class="py-name" href="#" onclick="return doclink('link-10', 'logger', 'link-10');">logger</a></tt> <tt class="py-op">=</tt> <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">getLogger</tt><tt class="py-op">(</tt><tt class="py-name">__name__</tt><tt class="py-op">)</tt> </tt>
94<a name="L32"></a><tt class="py-lineno">32</tt> <tt class="py-line"> </tt>
95<a name="L33"></a><tt class="py-lineno">33</tt> <tt class="py-line"><tt class="py-comment"># URI Template for the endpoint that returns access_tokens.</tt> </tt>
96<a name="L34"></a><tt class="py-lineno">34</tt> <tt class="py-line"><tt id="link-11" class="py-name" targets="Variable oauth2client.gce.META=oauth2client.gce-module.html#META"><a title="oauth2client.gce.META" class="py-name" href="#" onclick="return doclink('link-11', 'META', 'link-11');">META</a></tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-string">'http://metadata.google.internal/0.1/meta-data/service-accounts/'</tt> </tt>
97<a name="L35"></a><tt class="py-lineno">35</tt> <tt class="py-line"> <tt class="py-string">'default/acquire{?scope}'</tt><tt class="py-op">)</tt> </tt>
98<a name="AppAssertionCredentials"></a><div id="AppAssertionCredentials-def"><a name="L36"></a><tt class="py-lineno">36</tt> <tt class="py-line"> </tt>
99<a name="L37"></a><tt class="py-lineno">37</tt> <tt class="py-line"> </tt>
100<a name="L38"></a><tt class="py-lineno">38</tt> <a class="py-toggle" href="#" id="AppAssertionCredentials-toggle" onclick="return toggle('AppAssertionCredentials');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="oauth2client.gce.AppAssertionCredentials-class.html">AppAssertionCredentials</a><tt class="py-op">(</tt><tt class="py-base-class">AssertionCredentials</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
101</div><div id="AppAssertionCredentials-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="AppAssertionCredentials-expanded"><a name="L39"></a><tt class="py-lineno">39</tt> <tt class="py-line"> <tt class="py-docstring">"""Credentials object for Compute Engine Assertion Grants</tt> </tt>
102<a name="L40"></a><tt class="py-lineno">40</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
103<a name="L41"></a><tt class="py-lineno">41</tt> <tt class="py-line"><tt class="py-docstring"> This object will allow a Compute Engine instance to identify itself to</tt> </tt>
104<a name="L42"></a><tt class="py-lineno">42</tt> <tt class="py-line"><tt class="py-docstring"> Google and other OAuth 2.0 servers that can verify assertions. It can be used</tt> </tt>
105<a name="L43"></a><tt class="py-lineno">43</tt> <tt class="py-line"><tt class="py-docstring"> for the purpose of accessing data stored under an account assigned to the</tt> </tt>
106<a name="L44"></a><tt class="py-lineno">44</tt> <tt class="py-line"><tt class="py-docstring"> Compute Engine instance itself.</tt> </tt>
107<a name="L45"></a><tt class="py-lineno">45</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
108<a name="L46"></a><tt class="py-lineno">46</tt> <tt class="py-line"><tt class="py-docstring"> This credential does not require a flow to instantiate because it represents</tt> </tt>
109<a name="L47"></a><tt class="py-lineno">47</tt> <tt class="py-line"><tt class="py-docstring"> a two legged flow, and therefore has all of the required information to</tt> </tt>
110<a name="L48"></a><tt class="py-lineno">48</tt> <tt class="py-line"><tt class="py-docstring"> generate and refresh its own access tokens.</tt> </tt>
111<a name="L49"></a><tt class="py-lineno">49</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
112<a name="L50"></a><tt class="py-lineno">50</tt> <tt class="py-line"> </tt>
113<a name="L51"></a><tt class="py-lineno">51</tt> <tt class="py-line"> <tt class="py-decorator">@</tt><tt class="py-decorator">util</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name" targets="Function oauth2client.util.positional()=oauth2client.util-module.html#positional"><a title="oauth2client.util.positional" class="py-name" href="#" onclick="return doclink('link-12', 'positional', 'link-12');">positional</a></tt><tt class="py-op">(</tt><tt class="py-number">2</tt><tt class="py-op">)</tt> </tt>
114<a name="AppAssertionCredentials.__init__"></a><div id="AppAssertionCredentials.__init__-def"><a name="L52"></a><tt class="py-lineno">52</tt> <a class="py-toggle" href="#" id="AppAssertionCredentials.__init__-toggle" onclick="return toggle('AppAssertionCredentials.__init__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.gce.AppAssertionCredentials-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">scope</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-param">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
115</div><div id="AppAssertionCredentials.__init__-collapsed" style="display:none;" pad="++" indent="++++++"></div><div id="AppAssertionCredentials.__init__-expanded"><a name="L53"></a><tt class="py-lineno">53</tt> <tt class="py-line"> <tt class="py-docstring">"""Constructor for AppAssertionCredentials</tt> </tt>
116<a name="L54"></a><tt class="py-lineno">54</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
117<a name="L55"></a><tt class="py-lineno">55</tt> <tt class="py-line"><tt class="py-docstring"> Args:</tt> </tt>
118<a name="L56"></a><tt class="py-lineno">56</tt> <tt class="py-line"><tt class="py-docstring"> scope: string or list of strings, scope(s) of the credentials being</tt> </tt>
119<a name="L57"></a><tt class="py-lineno">57</tt> <tt class="py-line"><tt class="py-docstring"> requested.</tt> </tt>
120<a name="L58"></a><tt class="py-lineno">58</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
121<a name="L59"></a><tt class="py-lineno">59</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">type</tt><tt class="py-op">(</tt><tt class="py-name">scope</tt><tt class="py-op">)</tt> <tt class="py-keyword">is</tt> <tt class="py-name">list</tt><tt class="py-op">:</tt> </tt>
122<a name="L60"></a><tt class="py-lineno">60</tt> <tt class="py-line"> <tt class="py-name">scope</tt> <tt class="py-op">=</tt> <tt class="py-string">' '</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">scope</tt><tt class="py-op">)</tt> </tt>
123<a name="L61"></a><tt class="py-lineno">61</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scope</tt> <tt class="py-op">=</tt> <tt class="py-name">scope</tt> </tt>
124<a name="L62"></a><tt class="py-lineno">62</tt> <tt class="py-line"> </tt>
125<a name="L63"></a><tt class="py-lineno">63</tt> <tt class="py-line"> <tt class="py-name">super</tt><tt class="py-op">(</tt><tt id="link-13" class="py-name" targets="Class oauth2client.appengine.AppAssertionCredentials=oauth2client.appengine.AppAssertionCredentials-class.html,Class oauth2client.gce.AppAssertionCredentials=oauth2client.gce.AppAssertionCredentials-class.html"><a title="oauth2client.appengine.AppAssertionCredentials
126oauth2client.gce.AppAssertionCredentials" class="py-name" href="#" onclick="return doclink('link-13', 'AppAssertionCredentials', 'link-13');">AppAssertionCredentials</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name" targets="Method apiclient.errors.BatchError.__init__()=apiclient.errors.BatchError-class.html#__init__,Method apiclient.errors.HttpError.__init__()=apiclient.errors.HttpError-class.html#__init__,Method apiclient.errors.UnexpectedBodyError.__init__()=apiclient.errors.UnexpectedBodyError-class.html#__init__,Method apiclient.errors.UnexpectedMethodError.__init__()=apiclient.errors.UnexpectedMethodError-class.html#__init__,Method apiclient.http.BatchHttpRequest.__init__()=apiclient.http.BatchHttpRequest-class.html#__init__,Method apiclient.http.HttpMock.__init__()=apiclient.http.HttpMock-class.html#__init__,Method apiclient.http.HttpMockSequence.__init__()=apiclient.http.HttpMockSequence-class.html#__init__,Method apiclient.http.HttpRequest.__init__()=apiclient.http.HttpRequest-class.html#__init__,Method apiclient.http.HttpRequestMock.__init__()=apiclient.http.HttpRequestMock-class.html#__init__,Method apiclient.http.MediaDownloadProgress.__init__()=apiclient.http.MediaDownloadProgress-class.html#__init__,Method apiclient.http.MediaFileUpload.__init__()=apiclient.http.MediaFileUpload-class.html#__init__,Method apiclient.http.MediaInMemoryUpload.__init__()=apiclient.http.MediaInMemoryUpload-class.html#__init__,Method apiclient.http.MediaIoBaseDownload.__init__()=apiclient.http.MediaIoBaseDownload-class.html#__init__,Method apiclient.http.MediaIoBaseUpload.__init__()=apiclient.http.MediaIoBaseUpload-class.html#__init__,Method apiclient.http.MediaUploadProgress.__init__()=apiclient.http.MediaUploadProgress-class.html#__init__,Method apiclient.http.RequestMockBuilder.__init__()=apiclient.http.RequestMockBuilder-class.html#__init__,Method apiclient.http._StreamSlice.__init__()=apiclient.http._StreamSlice-class.html#__init__,Method apiclient.model.JsonModel.__init__()=apiclient.model.JsonModel-class.html#__init__,Method apiclient.model.ProtocolBufferModel.__init__()=apiclient.model.ProtocolBufferModel-class.html#__init__,Method apiclient.schema.Schemas.__init__()=apiclient.schema.Schemas-class.html#__init__,Method apiclient.schema._SchemaToStruct.__init__()=apiclient.schema._SchemaToStruct-class.html#__init__,Method oauth2client.appengine.AppAssertionCredentials.__init__()=oauth2client.appengine.AppAssertionCredentials-class.html#__init__,Method oauth2client.appengine.OAuth2Decorator.__init__()=oauth2client.appengine.OAuth2Decorator-class.html#__init__,Method oauth2client.appengine.OAuth2DecoratorFromClientSecrets.__init__()=oauth2client.appengine.OAuth2DecoratorFromClientSecrets-class.html#__init__,Method oauth2client.appengine.StorageByKeyName.__init__()=oauth2client.appengine.StorageByKeyName-class.html#__init__,Method oauth2client.client.AccessTokenCredentials.__init__()=oauth2client.client.AccessTokenCredentials-class.html#__init__,Method oauth2client.client.AssertionCredentials.__init__()=oauth2client.client.AssertionCredentials-class.html#__init__,Method oauth2client.client.MemoryCache.__init__()=oauth2client.client.MemoryCache-class.html#__init__,Method oauth2client.client.OAuth2Credentials.__init__()=oauth2client.client.OAuth2Credentials-class.html#__init__,Method oauth2client.client.OAuth2WebServerFlow.__init__()=oauth2client.client.OAuth2WebServerFlow-class.html#__init__,Method oauth2client.client.SignedJwtAssertionCredentials.__init__()=oauth2client.client.SignedJwtAssertionCredentials-class.html#__init__,Method oauth2client.crypt.Signer.__init__()=oauth2client.crypt.Signer-class.html#__init__,Method oauth2client.crypt.Verifier.__init__()=oauth2client.crypt.Verifier-class.html#__init__,Method oauth2client.django_orm.CredentialsField.__init__()=oauth2client.django_orm.CredentialsField-class.html#__init__,Method oauth2client.django_orm.FlowField.__init__()=oauth2client.django_orm.FlowField-class.html#__init__,Method oauth2client.django_orm.Storage.__init__()=oauth2client.django_orm.Storage-class.html#__init__,Method oauth2client.file.Storage.__init__()=oauth2client.file.Storage-class.html#__init__,Method oauth2client.gce.AppAssertionCredentials.__init__()=oauth2client.gce.AppAssertionCredentials-class.html#__init__,Method oauth2client.keyring_storage.Storage.__init__()=oauth2client.keyring_storage.Storage-class.html#__init__,Method oauth2client.locked_file.LockedFile.__init__()=oauth2client.locked_file.LockedFile-class.html#__init__,Method oauth2client.locked_file._Opener.__init__()=oauth2client.locked_file._Opener-class.html#__init__,Method oauth2client.multistore_file._MultiStore._Storage.__init__()=oauth2client.multistore_file._MultiStore._Storage-class.html#__init__,Method oauth2client.multistore_file._MultiStore.__init__()=oauth2client.multistore_file._MultiStore-class.html#__init__"><a title="apiclient.errors.BatchError.__init__
127apiclient.errors.HttpError.__init__
128apiclient.errors.UnexpectedBodyError.__init__
129apiclient.errors.UnexpectedMethodError.__init__
130apiclient.http.BatchHttpRequest.__init__
131apiclient.http.HttpMock.__init__
132apiclient.http.HttpMockSequence.__init__
133apiclient.http.HttpRequest.__init__
134apiclient.http.HttpRequestMock.__init__
135apiclient.http.MediaDownloadProgress.__init__
136apiclient.http.MediaFileUpload.__init__
137apiclient.http.MediaInMemoryUpload.__init__
138apiclient.http.MediaIoBaseDownload.__init__
139apiclient.http.MediaIoBaseUpload.__init__
140apiclient.http.MediaUploadProgress.__init__
141apiclient.http.RequestMockBuilder.__init__
142apiclient.http._StreamSlice.__init__
143apiclient.model.JsonModel.__init__
144apiclient.model.ProtocolBufferModel.__init__
145apiclient.schema.Schemas.__init__
146apiclient.schema._SchemaToStruct.__init__
147oauth2client.appengine.AppAssertionCredentials.__init__
148oauth2client.appengine.OAuth2Decorator.__init__
149oauth2client.appengine.OAuth2DecoratorFromClientSecrets.__init__
150oauth2client.appengine.StorageByKeyName.__init__
151oauth2client.client.AccessTokenCredentials.__init__
152oauth2client.client.AssertionCredentials.__init__
153oauth2client.client.MemoryCache.__init__
154oauth2client.client.OAuth2Credentials.__init__
155oauth2client.client.OAuth2WebServerFlow.__init__
156oauth2client.client.SignedJwtAssertionCredentials.__init__
157oauth2client.crypt.Signer.__init__
158oauth2client.crypt.Verifier.__init__
159oauth2client.django_orm.CredentialsField.__init__
160oauth2client.django_orm.FlowField.__init__
161oauth2client.django_orm.Storage.__init__
162oauth2client.file.Storage.__init__
163oauth2client.gce.AppAssertionCredentials.__init__
164oauth2client.keyring_storage.Storage.__init__
165oauth2client.locked_file.LockedFile.__init__
166oauth2client.locked_file._Opener.__init__
167oauth2client.multistore_file._MultiStore._Storage.__init__
168oauth2client.multistore_file._MultiStore.__init__" class="py-name" href="#" onclick="return doclink('link-14', '__init__', 'link-14');">__init__</a></tt><tt class="py-op">(</tt> </tt>
169<a name="L64"></a><tt class="py-lineno">64</tt> <tt class="py-line"> <tt class="py-string">'ignored'</tt> <tt class="py-comment"># assertion_type is ignore in this subclass.</tt> </tt>
170<a name="L65"></a><tt class="py-lineno">65</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
171</div><a name="L66"></a><tt class="py-lineno">66</tt> <tt class="py-line"> </tt>
172<a name="L67"></a><tt class="py-lineno">67</tt> <tt class="py-line"> <tt class="py-decorator">@</tt><tt class="py-decorator">classmethod</tt> </tt>
173<a name="AppAssertionCredentials.from_json"></a><div id="AppAssertionCredentials.from_json-def"><a name="L68"></a><tt class="py-lineno">68</tt> <a class="py-toggle" href="#" id="AppAssertionCredentials.from_json-toggle" onclick="return toggle('AppAssertionCredentials.from_json');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.gce.AppAssertionCredentials-class.html#from_json">from_json</a><tt class="py-op">(</tt><tt class="py-param">cls</tt><tt class="py-op">,</tt> <tt class="py-param">json</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
174</div><div id="AppAssertionCredentials.from_json-collapsed" style="display:none;" pad="++" indent="++++++"></div><div id="AppAssertionCredentials.from_json-expanded"><a name="L69"></a><tt class="py-lineno">69</tt> <tt class="py-line"> <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt class="py-name">simplejson</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name" targets="Function oauth2client.clientsecrets.loads()=oauth2client.clientsecrets-module.html#loads"><a title="oauth2client.clientsecrets.loads" class="py-name" href="#" onclick="return doclink('link-15', 'loads', 'link-15');">loads</a></tt><tt class="py-op">(</tt><tt class="py-name">json</tt><tt class="py-op">)</tt> </tt>
175<a name="L70"></a><tt class="py-lineno">70</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-16" class="py-name"><a title="oauth2client.appengine.AppAssertionCredentials
176oauth2client.gce.AppAssertionCredentials" class="py-name" href="#" onclick="return doclink('link-16', 'AppAssertionCredentials', 'link-13');">AppAssertionCredentials</a></tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">[</tt><tt class="py-string">'scope'</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
177</div><a name="L71"></a><tt class="py-lineno">71</tt> <tt class="py-line"> </tt>
178<a name="AppAssertionCredentials._refresh"></a><div id="AppAssertionCredentials._refresh-def"><a name="L72"></a><tt class="py-lineno">72</tt> <a class="py-toggle" href="#" id="AppAssertionCredentials._refresh-toggle" onclick="return toggle('AppAssertionCredentials._refresh');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.gce.AppAssertionCredentials-class.html#_refresh">_refresh</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">http_request</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
179</div><div id="AppAssertionCredentials._refresh-collapsed" style="display:none;" pad="++" indent="++++++"></div><div id="AppAssertionCredentials._refresh-expanded"><a name="L73"></a><tt class="py-lineno">73</tt> <tt class="py-line"> <tt class="py-docstring">"""Refreshes the access_token.</tt> </tt>
180<a name="L74"></a><tt class="py-lineno">74</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
181<a name="L75"></a><tt class="py-lineno">75</tt> <tt class="py-line"><tt class="py-docstring"> Skip all the storage hoops and just refresh using the API.</tt> </tt>
182<a name="L76"></a><tt class="py-lineno">76</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
183<a name="L77"></a><tt class="py-lineno">77</tt> <tt class="py-line"><tt class="py-docstring"> Args:</tt> </tt>
184<a name="L78"></a><tt class="py-lineno">78</tt> <tt class="py-line"><tt class="py-docstring"> http_request: callable, a callable that matches the method signature of</tt> </tt>
185<a name="L79"></a><tt class="py-lineno">79</tt> <tt class="py-line"><tt class="py-docstring"> httplib2.Http.request, used to make the refresh request.</tt> </tt>
186<a name="L80"></a><tt class="py-lineno">80</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
187<a name="L81"></a><tt class="py-lineno">81</tt> <tt class="py-line"><tt class="py-docstring"> Raises:</tt> </tt>
188<a name="L82"></a><tt class="py-lineno">82</tt> <tt class="py-line"><tt class="py-docstring"> AccessTokenRefreshError: When the refresh fails.</tt> </tt>
189<a name="L83"></a><tt class="py-lineno">83</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
190<a name="L84"></a><tt class="py-lineno">84</tt> <tt class="py-line"> <tt class="py-name">uri</tt> <tt class="py-op">=</tt> <tt class="py-name">uritemplate</tt><tt class="py-op">.</tt><tt class="py-name">expand</tt><tt class="py-op">(</tt><tt id="link-17" class="py-name"><a title="oauth2client.gce.META" class="py-name" href="#" onclick="return doclink('link-17', 'META', 'link-11');">META</a></tt><tt class="py-op">,</tt> <tt class="py-op">{</tt><tt class="py-string">'scope'</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scope</tt><tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
191<a name="L85"></a><tt class="py-lineno">85</tt> <tt class="py-line"> <tt id="link-18" class="py-name" targets="Method apiclient.model.BaseModel.response()=apiclient.model.BaseModel-class.html#response,Method apiclient.model.Model.response()=apiclient.model.Model-class.html#response"><a title="apiclient.model.BaseModel.response
192apiclient.model.Model.response" class="py-name" href="#" onclick="return doclink('link-18', 'response', 'link-18');">response</a></tt><tt class="py-op">,</tt> <tt class="py-name">content</tt> <tt class="py-op">=</tt> <tt class="py-name">http_request</tt><tt class="py-op">(</tt><tt class="py-name">uri</tt><tt class="py-op">)</tt> </tt>
193<a name="L86"></a><tt class="py-lineno">86</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-19" class="py-name"><a title="apiclient.model.BaseModel.response
194apiclient.model.Model.response" class="py-name" href="#" onclick="return doclink('link-19', 'response', 'link-18');">response</a></tt><tt class="py-op">.</tt><tt class="py-name">status</tt> <tt class="py-op">==</tt> <tt class="py-number">200</tt><tt class="py-op">:</tt> </tt>
195<a name="L87"></a><tt class="py-lineno">87</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
196<a name="L88"></a><tt class="py-lineno">88</tt> <tt class="py-line"> <tt class="py-name">d</tt> <tt class="py-op">=</tt> <tt class="py-name">simplejson</tt><tt class="py-op">.</tt><tt id="link-20" class="py-name"><a title="oauth2client.clientsecrets.loads" class="py-name" href="#" onclick="return doclink('link-20', 'loads', 'link-15');">loads</a></tt><tt class="py-op">(</tt><tt class="py-name">content</tt><tt class="py-op">)</tt> </tt>
197<a name="L89"></a><tt class="py-lineno">89</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">StandardError</tt><tt class="py-op">,</tt> <tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
198<a name="L90"></a><tt class="py-lineno">90</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt id="link-21" class="py-name"><a title="oauth2client.client.AccessTokenRefreshError" class="py-name" href="#" onclick="return doclink('link-21', 'AccessTokenRefreshError', 'link-6');">AccessTokenRefreshError</a></tt><tt class="py-op">(</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">e</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
199<a name="L91"></a><tt class="py-lineno">91</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">access_token</tt> <tt class="py-op">=</tt> <tt class="py-name">d</tt><tt class="py-op">[</tt><tt class="py-string">'accessToken'</tt><tt class="py-op">]</tt> </tt>
200<a name="L92"></a><tt class="py-lineno">92</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
201<a name="L93"></a><tt class="py-lineno">93</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt id="link-22" class="py-name"><a title="oauth2client.client.AccessTokenRefreshError" class="py-name" href="#" onclick="return doclink('link-22', 'AccessTokenRefreshError', 'link-6');">AccessTokenRefreshError</a></tt><tt class="py-op">(</tt><tt class="py-name">content</tt><tt class="py-op">)</tt> </tt>
202</div></div><a name="L94"></a><tt class="py-lineno">94</tt> <tt class="py-line"> </tt><script type="text/javascript">
203<!--
204expandto(location.href);
205// -->
206</script>
207</pre>
208<br />
209<!-- ==================== NAVIGATION BAR ==================== -->
210<table class="navbar" border="0" width="100%" cellpadding="0"
211 bgcolor="#a0c0ff" cellspacing="0">
212 <tr valign="middle">
213
214 <!-- Tree link -->
215 <th>&nbsp;&nbsp;&nbsp;<a
216 href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
217
218 <!-- Index link -->
219 <th>&nbsp;&nbsp;&nbsp;<a
220 href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
221
222 <!-- Help link -->
223 <th>&nbsp;&nbsp;&nbsp;<a
224 href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
225
226 <th class="navbar" width="100%"></th>
227 </tr>
228</table>
229<table border="0" cellpadding="0" cellspacing="0" width="100%%">
230 <tr>
231 <td align="left" class="footer">
Joe Gregorio0cd347a2012-08-30 08:22:27 -0400232 Generated by Epydoc 3.0.1 on Thu Aug 30 07:12:48 2012
Joe Gregorio1b425aa2012-08-24 12:04:34 -0400233 </td>
234 <td align="right" class="footer">
235 <a target="mainFrame" href="http://epydoc.sourceforge.net"
236 >http://epydoc.sourceforge.net</a>
237 </td>
238 </tr>
239</table>
240
241<script type="text/javascript">
242 <!--
243 // Private objects are initially displayed (because if
244 // javascript is turned off then we want them to be
245 // visible); but by default, we want to hide them. So hide
246 // them unless we have a cookie that says to show them.
247 checkCookie();
248 // -->
249</script>
250</body>
251</html>