blob: e9002497ef4a95eaf36d4c1841f16bd793975a29 [file] [log] [blame]
Joe Gregorio6e537032011-02-09 23:04:26 -05001
2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3<html><head><title>Python: module oauth2client.client</title>
4</head><body bgcolor="#f0f0f8">
5
6<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
7<tr bgcolor="#7799ee">
8<td valign=bottom>&nbsp;<br>
9<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="oauth2client.html"><font color="#ffffff">oauth2client</font></a>.client</strong></big></big></font></td
10><td align=right valign=bottom
11><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/jcgregorio/projects/apiary/oauth2client/client.py">/home/jcgregorio/projects/apiary/oauth2client/client.py</a></font></td></tr></table>
12 <p><tt>An&nbsp;OAuth&nbsp;2.0&nbsp;client<br>
13&nbsp;<br>
14Tools&nbsp;for&nbsp;interacting&nbsp;with&nbsp;OAuth&nbsp;2.0&nbsp;protected<br>
15resources.</tt></p>
16<p>
17<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
18<tr bgcolor="#aa55cc">
19<td colspan=3 valign=bottom>&nbsp;<br>
20<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
21
22<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
23<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="copy.html">copy</a><br>
24<a href="datetime.html">datetime</a><br>
25</td><td width="25%" valign=top><a href="httplib2.html">httplib2</a><br>
26<a href="logging.html">logging</a><br>
27</td><td width="25%" valign=top><a href="simplejson.html">simplejson</a><br>
28<a href="urllib.html">urllib</a><br>
29</td><td width="25%" valign=top><a href="urlparse.html">urlparse</a><br>
30</td></tr></table></td></tr></table><p>
31<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
32<tr bgcolor="#ee77aa">
33<td colspan=3 valign=bottom>&nbsp;<br>
34<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
35
36<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
37<td width="100%"><dl>
38<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
39</font></dt><dd>
40<dl>
41<dt><font face="helvetica, arial"><a href="oauth2client.client.html#Credentials">Credentials</a>
42</font></dt><dd>
43<dl>
44<dt><font face="helvetica, arial"><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>
45</font></dt></dl>
46</dd>
47<dt><font face="helvetica, arial"><a href="oauth2client.client.html#Flow">Flow</a>
48</font></dt><dd>
49<dl>
50<dt><font face="helvetica, arial"><a href="oauth2client.client.html#OAuth2WebServerFlow">OAuth2WebServerFlow</a>
51</font></dt></dl>
52</dd>
53</dl>
54</dd>
55<dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>)
56</font></dt><dd>
57<dl>
58<dt><font face="helvetica, arial"><a href="oauth2client.client.html#Error">Error</a>
59</font></dt><dd>
60<dl>
61<dt><font face="helvetica, arial"><a href="oauth2client.client.html#MissingParameter">MissingParameter</a>
62</font></dt><dt><font face="helvetica, arial"><a href="oauth2client.client.html#RequestError">RequestError</a>
63</font></dt></dl>
64</dd>
65</dl>
66</dd>
67</dl>
68 <p>
69<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
70<tr bgcolor="#ffc8d8">
71<td colspan=3 valign=bottom>&nbsp;<br>
72<font color="#000000" face="helvetica, arial"><a name="Credentials">class <strong>Credentials</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
73
74<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
75<td colspan=2><tt>Base&nbsp;class&nbsp;for&nbsp;all&nbsp;<a href="#Credentials">Credentials</a>&nbsp;objects.<br>
76&nbsp;<br>
77Subclasses&nbsp;must&nbsp;define&nbsp;an&nbsp;<a href="#Credentials-authorize">authorize</a>()&nbsp;method<br>
78that&nbsp;applies&nbsp;the&nbsp;credentials&nbsp;to&nbsp;an&nbsp;HTTP&nbsp;transport.<br>&nbsp;</tt></td></tr>
79<tr><td>&nbsp;</td>
80<td width="100%">Methods defined here:<br>
81<dl><dt><a name="Credentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Take&nbsp;an&nbsp;httplib2.Http&nbsp;instance&nbsp;(or&nbsp;equivalent)&nbsp;and<br>
82authorizes&nbsp;it&nbsp;for&nbsp;the&nbsp;set&nbsp;of&nbsp;credentials,&nbsp;usually&nbsp;by<br>
83replacing&nbsp;http.request()&nbsp;with&nbsp;a&nbsp;method&nbsp;that&nbsp;adds&nbsp;in<br>
84the&nbsp;appropriate&nbsp;headers&nbsp;and&nbsp;then&nbsp;delegates&nbsp;to&nbsp;the&nbsp;original<br>
85Http.request()&nbsp;method.</tt></dd></dl>
86
87<hr>
88Data descriptors defined here:<br>
89<dl><dt><strong>__dict__</strong></dt>
90<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
91</dl>
92<dl><dt><strong>__weakref__</strong></dt>
93<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
94</dl>
95</td></tr></table> <p>
96<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
97<tr bgcolor="#ffc8d8">
98<td colspan=3 valign=bottom>&nbsp;<br>
99<font color="#000000" face="helvetica, arial"><a name="Error">class <strong>Error</strong></a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)</font></td></tr>
100
101<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
102<td colspan=2><tt>Base&nbsp;error&nbsp;for&nbsp;this&nbsp;module.<br>&nbsp;</tt></td></tr>
103<tr><td>&nbsp;</td>
104<td width="100%"><dl><dt>Method resolution order:</dt>
105<dd><a href="oauth2client.client.html#Error">Error</a></dd>
106<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd>
107<dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd>
108<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
109</dl>
110<hr>
111Data descriptors defined here:<br>
112<dl><dt><strong>__weakref__</strong></dt>
113<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
114</dl>
115<hr>
116Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
117<dl><dt><a name="Error-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__init__">__init__</a>(...)&nbsp;initializes&nbsp;x;&nbsp;see&nbsp;x.__class__.__doc__&nbsp;for&nbsp;signature</tt></dd></dl>
118
119<hr>
120Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
121<dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object&gt;<dd><tt>T.<a href="#Error-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl>
122
123<hr>
124Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
125<dl><dt><a name="Error-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__delattr__">__delattr__</a>('name')&nbsp;&lt;==&gt;&nbsp;del&nbsp;x.name</tt></dd></dl>
126
127<dl><dt><a name="Error-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl>
128
129<dl><dt><a name="Error-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__getitem__">__getitem__</a>(y)&nbsp;&lt;==&gt;&nbsp;x[y]</tt></dd></dl>
130
131<dl><dt><a name="Error-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__getslice__">__getslice__</a>(i,&nbsp;j)&nbsp;&lt;==&gt;&nbsp;x[i:j]<br>
132&nbsp;<br>
133Use&nbsp;of&nbsp;negative&nbsp;indices&nbsp;is&nbsp;not&nbsp;supported.</tt></dd></dl>
134
135<dl><dt><a name="Error-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl>
136
137<dl><dt><a name="Error-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__repr__">__repr__</a>()&nbsp;&lt;==&gt;&nbsp;repr(x)</tt></dd></dl>
138
139<dl><dt><a name="Error-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__setattr__">__setattr__</a>('name',&nbsp;value)&nbsp;&lt;==&gt;&nbsp;x.name&nbsp;=&nbsp;value</tt></dd></dl>
140
141<dl><dt><a name="Error-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl>
142
143<dl><dt><a name="Error-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__str__">__str__</a>()&nbsp;&lt;==&gt;&nbsp;str(x)</tt></dd></dl>
144
145<dl><dt><a name="Error-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl>
146
147<hr>
148Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
149<dl><dt><strong>__dict__</strong></dt>
150</dl>
151<dl><dt><strong>args</strong></dt>
152</dl>
153<dl><dt><strong>message</strong></dt>
154</dl>
155</td></tr></table> <p>
156<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
157<tr bgcolor="#ffc8d8">
158<td colspan=3 valign=bottom>&nbsp;<br>
159<font color="#000000" face="helvetica, arial"><a name="Flow">class <strong>Flow</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
160
161<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
162<td colspan=2><tt>Base&nbsp;class&nbsp;for&nbsp;all&nbsp;<a href="#Flow">Flow</a>&nbsp;objects.<br>&nbsp;</tt></td></tr>
163<tr><td>&nbsp;</td>
164<td width="100%">Data descriptors defined here:<br>
165<dl><dt><strong>__dict__</strong></dt>
166<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
167</dl>
168<dl><dt><strong>__weakref__</strong></dt>
169<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
170</dl>
171</td></tr></table> <p>
172<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
173<tr bgcolor="#ffc8d8">
174<td colspan=3 valign=bottom>&nbsp;<br>
175<font color="#000000" face="helvetica, arial"><a name="MissingParameter">class <strong>MissingParameter</strong></a>(<a href="oauth2client.client.html#Error">Error</a>)</font></td></tr>
176
177<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
178<td width="100%"><dl><dt>Method resolution order:</dt>
179<dd><a href="oauth2client.client.html#MissingParameter">MissingParameter</a></dd>
180<dd><a href="oauth2client.client.html#Error">Error</a></dd>
181<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd>
182<dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd>
183<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
184</dl>
185<hr>
186Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br>
187<dl><dt><strong>__weakref__</strong></dt>
188<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
189</dl>
190<hr>
191Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
192<dl><dt><a name="MissingParameter-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#MissingParameter-__init__">__init__</a>(...)&nbsp;initializes&nbsp;x;&nbsp;see&nbsp;x.__class__.__doc__&nbsp;for&nbsp;signature</tt></dd></dl>
193
194<hr>
195Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
196<dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object&gt;<dd><tt>T.<a href="#MissingParameter-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl>
197
198<hr>
199Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
200<dl><dt><a name="MissingParameter-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#MissingParameter-__delattr__">__delattr__</a>('name')&nbsp;&lt;==&gt;&nbsp;del&nbsp;x.name</tt></dd></dl>
201
202<dl><dt><a name="MissingParameter-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#MissingParameter-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl>
203
204<dl><dt><a name="MissingParameter-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#MissingParameter-__getitem__">__getitem__</a>(y)&nbsp;&lt;==&gt;&nbsp;x[y]</tt></dd></dl>
205
206<dl><dt><a name="MissingParameter-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#MissingParameter-__getslice__">__getslice__</a>(i,&nbsp;j)&nbsp;&lt;==&gt;&nbsp;x[i:j]<br>
207&nbsp;<br>
208Use&nbsp;of&nbsp;negative&nbsp;indices&nbsp;is&nbsp;not&nbsp;supported.</tt></dd></dl>
209
210<dl><dt><a name="MissingParameter-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl>
211
212<dl><dt><a name="MissingParameter-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#MissingParameter-__repr__">__repr__</a>()&nbsp;&lt;==&gt;&nbsp;repr(x)</tt></dd></dl>
213
214<dl><dt><a name="MissingParameter-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#MissingParameter-__setattr__">__setattr__</a>('name',&nbsp;value)&nbsp;&lt;==&gt;&nbsp;x.name&nbsp;=&nbsp;value</tt></dd></dl>
215
216<dl><dt><a name="MissingParameter-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl>
217
218<dl><dt><a name="MissingParameter-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#MissingParameter-__str__">__str__</a>()&nbsp;&lt;==&gt;&nbsp;str(x)</tt></dd></dl>
219
220<dl><dt><a name="MissingParameter-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl>
221
222<hr>
223Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
224<dl><dt><strong>__dict__</strong></dt>
225</dl>
226<dl><dt><strong>args</strong></dt>
227</dl>
228<dl><dt><strong>message</strong></dt>
229</dl>
230</td></tr></table> <p>
231<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
232<tr bgcolor="#ffc8d8">
233<td colspan=3 valign=bottom>&nbsp;<br>
234<font color="#000000" face="helvetica, arial"><a name="OAuth2Credentials">class <strong>OAuth2Credentials</strong></a>(<a href="oauth2client.client.html#Credentials">Credentials</a>)</font></td></tr>
235
236<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
237<td colspan=2><tt><a href="#Credentials">Credentials</a>&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;for&nbsp;OAuth&nbsp;2.0<br>
238&nbsp;<br>
239<a href="#Credentials">Credentials</a>&nbsp;can&nbsp;be&nbsp;applied&nbsp;to&nbsp;an&nbsp;httplib2.Http&nbsp;<a href="__builtin__.html#object">object</a><br>
240using&nbsp;the&nbsp;<a href="#OAuth2Credentials-authorize">authorize</a>()&nbsp;method,&nbsp;which&nbsp;then&nbsp;signs&nbsp;each<br>
241request&nbsp;from&nbsp;that&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;the&nbsp;OAuth&nbsp;2.0&nbsp;access&nbsp;token.<br>
242&nbsp;<br>
243<a href="#OAuth2Credentials">OAuth2Credentials</a>&nbsp;objects&nbsp;may&nbsp;be&nbsp;safely&nbsp;pickled&nbsp;and&nbsp;unpickled.<br>&nbsp;</tt></td></tr>
244<tr><td>&nbsp;</td>
245<td width="100%"><dl><dt>Method resolution order:</dt>
246<dd><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a></dd>
247<dd><a href="oauth2client.client.html#Credentials">Credentials</a></dd>
248<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
249</dl>
250<hr>
251Methods defined here:<br>
252<dl><dt><a name="OAuth2Credentials-__getstate__"><strong>__getstate__</strong></a>(self)</dt><dd><tt>Trim&nbsp;the&nbsp;state&nbsp;down&nbsp;to&nbsp;something&nbsp;that&nbsp;can&nbsp;be&nbsp;pickled.</tt></dd></dl>
253
254<dl><dt><a name="OAuth2Credentials-__init__"><strong>__init__</strong></a>(self, access_token, client_id, client_secret, refresh_token, token_expiry, token_uri, user_agent)</dt><dd><tt>Create&nbsp;an&nbsp;instance&nbsp;of&nbsp;<a href="#OAuth2Credentials">OAuth2Credentials</a><br>
255&nbsp;<br>
256This&nbsp;constructor&nbsp;is&nbsp;not&nbsp;usually&nbsp;called&nbsp;by&nbsp;the&nbsp;user,&nbsp;instead<br>
257<a href="#OAuth2Credentials">OAuth2Credentials</a>&nbsp;objects&nbsp;are&nbsp;instantiated&nbsp;by<br>
258the&nbsp;<a href="#OAuth2WebServerFlow">OAuth2WebServerFlow</a>.<br>
259&nbsp;<br>
260Args:<br>
261&nbsp;&nbsp;token_uri:&nbsp;string,&nbsp;URI&nbsp;of&nbsp;token&nbsp;endpoint<br>
262&nbsp;&nbsp;client_id:&nbsp;string,&nbsp;client&nbsp;identifier<br>
263&nbsp;&nbsp;client_secret:&nbsp;string,&nbsp;client&nbsp;secret<br>
264&nbsp;&nbsp;access_token:&nbsp;string,&nbsp;access&nbsp;token<br>
265&nbsp;&nbsp;token_expiry:&nbsp;datetime,&nbsp;when&nbsp;the&nbsp;access_token&nbsp;expires<br>
266&nbsp;&nbsp;refresh_token:&nbsp;string,&nbsp;refresh&nbsp;token<br>
267&nbsp;&nbsp;user_agent:&nbsp;string,&nbsp;The&nbsp;HTTP&nbsp;User-Agent&nbsp;to&nbsp;provide&nbsp;for&nbsp;this&nbsp;application.<br>
268&nbsp;<br>
269&nbsp;<br>
270Notes:<br>
271&nbsp;&nbsp;store:&nbsp;callable,&nbsp;a&nbsp;callable&nbsp;that&nbsp;when&nbsp;passed&nbsp;a&nbsp;Credential<br>
272&nbsp;&nbsp;&nbsp;&nbsp;will&nbsp;store&nbsp;the&nbsp;credential&nbsp;back&nbsp;to&nbsp;where&nbsp;it&nbsp;came&nbsp;from.<br>
273&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;is&nbsp;needed&nbsp;to&nbsp;store&nbsp;the&nbsp;latest&nbsp;access_token&nbsp;if&nbsp;it<br>
274&nbsp;&nbsp;&nbsp;&nbsp;has&nbsp;expired&nbsp;and&nbsp;been&nbsp;refreshed.</tt></dd></dl>
275
276<dl><dt><a name="OAuth2Credentials-__setstate__"><strong>__setstate__</strong></a>(self, state)</dt><dd><tt>Reconstitute&nbsp;the&nbsp;state&nbsp;of&nbsp;the&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;from&nbsp;being&nbsp;pickled.</tt></dd></dl>
277
278<dl><dt><a name="OAuth2Credentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Args:<br>
279&nbsp;&nbsp;&nbsp;http:&nbsp;An&nbsp;instance&nbsp;of&nbsp;httplib2.Http<br>
280&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;something&nbsp;that&nbsp;acts&nbsp;like&nbsp;it.<br>
281&nbsp;<br>
282Returns:<br>
283&nbsp;&nbsp;&nbsp;A&nbsp;modified&nbsp;instance&nbsp;of&nbsp;http&nbsp;that&nbsp;was&nbsp;passed&nbsp;in.<br>
284&nbsp;<br>
285Example:<br>
286&nbsp;<br>
287&nbsp;&nbsp;h&nbsp;=&nbsp;httplib2.Http()<br>
288&nbsp;&nbsp;h&nbsp;=&nbsp;credentials.<a href="#OAuth2Credentials-authorize">authorize</a>(h)<br>
289&nbsp;<br>
290You&nbsp;can't&nbsp;create&nbsp;a&nbsp;new&nbsp;OAuth<br>
291subclass&nbsp;of&nbsp;httplib2.Authenication&nbsp;because<br>
292it&nbsp;never&nbsp;gets&nbsp;passed&nbsp;the&nbsp;absolute&nbsp;URI,&nbsp;which&nbsp;is<br>
293needed&nbsp;for&nbsp;signing.&nbsp;So&nbsp;instead&nbsp;we&nbsp;have&nbsp;to&nbsp;overload<br>
294'request'&nbsp;with&nbsp;a&nbsp;closure&nbsp;that&nbsp;adds&nbsp;in&nbsp;the<br>
295Authorization&nbsp;header&nbsp;and&nbsp;then&nbsp;calls&nbsp;the&nbsp;original&nbsp;version<br>
296of&nbsp;'request()'.</tt></dd></dl>
297
298<dl><dt><a name="OAuth2Credentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set&nbsp;the&nbsp;storage&nbsp;for&nbsp;the&nbsp;credential.<br>
299&nbsp;<br>
300Args:<br>
301&nbsp;&nbsp;store:&nbsp;callable,&nbsp;a&nbsp;callable&nbsp;that&nbsp;when&nbsp;passed&nbsp;a&nbsp;Credential<br>
302&nbsp;&nbsp;&nbsp;&nbsp;will&nbsp;store&nbsp;the&nbsp;credential&nbsp;back&nbsp;to&nbsp;where&nbsp;it&nbsp;came&nbsp;from.<br>
303&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;is&nbsp;needed&nbsp;to&nbsp;store&nbsp;the&nbsp;latest&nbsp;access_token&nbsp;if&nbsp;it<br>
304&nbsp;&nbsp;&nbsp;&nbsp;has&nbsp;expired&nbsp;and&nbsp;been&nbsp;refreshed.</tt></dd></dl>
305
306<hr>
307Data descriptors inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br>
308<dl><dt><strong>__dict__</strong></dt>
309<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
310</dl>
311<dl><dt><strong>__weakref__</strong></dt>
312<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
313</dl>
314</td></tr></table> <p>
315<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
316<tr bgcolor="#ffc8d8">
317<td colspan=3 valign=bottom>&nbsp;<br>
318<font color="#000000" face="helvetica, arial"><a name="OAuth2WebServerFlow">class <strong>OAuth2WebServerFlow</strong></a>(<a href="oauth2client.client.html#Flow">Flow</a>)</font></td></tr>
319
320<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
321<td colspan=2><tt>Does&nbsp;the&nbsp;Web&nbsp;Server&nbsp;<a href="#Flow">Flow</a>&nbsp;for&nbsp;OAuth&nbsp;2.0.<br>
322&nbsp;<br>
323<a href="#OAuth2Credentials">OAuth2Credentials</a>&nbsp;objects&nbsp;may&nbsp;be&nbsp;safely&nbsp;pickled&nbsp;and&nbsp;unpickled.<br>&nbsp;</tt></td></tr>
324<tr><td>&nbsp;</td>
325<td width="100%"><dl><dt>Method resolution order:</dt>
326<dd><a href="oauth2client.client.html#OAuth2WebServerFlow">OAuth2WebServerFlow</a></dd>
327<dd><a href="oauth2client.client.html#Flow">Flow</a></dd>
328<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
329</dl>
330<hr>
331Methods defined here:<br>
332<dl><dt><a name="OAuth2WebServerFlow-__init__"><strong>__init__</strong></a>(self, client_id, client_secret, scope, user_agent, authorization_uri<font color="#909090">='https://www.google.com/accounts/o8/oauth2/authorization'</font>, token_uri<font color="#909090">='https://www.google.com/accounts/o8/oauth2/token'</font>, **kwargs)</dt><dd><tt>Constructor&nbsp;for&nbsp;<a href="#OAuth2WebServerFlow">OAuth2WebServerFlow</a><br>
333&nbsp;<br>
334Args:<br>
335&nbsp;&nbsp;client_id:&nbsp;string,&nbsp;client&nbsp;identifier<br>
336&nbsp;&nbsp;client_secret:&nbsp;string&nbsp;client&nbsp;secret<br>
337&nbsp;&nbsp;scope:&nbsp;string,&nbsp;scope&nbsp;of&nbsp;the&nbsp;credentials&nbsp;being&nbsp;requested<br>
338&nbsp;&nbsp;user_agent:&nbsp;string,&nbsp;HTTP&nbsp;User-Agent&nbsp;to&nbsp;provide&nbsp;for&nbsp;this&nbsp;application.<br>
339&nbsp;&nbsp;authorization_uri:&nbsp;string,&nbsp;URI&nbsp;for&nbsp;authorization&nbsp;endpoint<br>
340&nbsp;&nbsp;token_uri:&nbsp;string,&nbsp;URI&nbsp;for&nbsp;token&nbsp;endpoint<br>
341&nbsp;&nbsp;**kwargs:&nbsp;dict,&nbsp;The&nbsp;keyword&nbsp;arguments&nbsp;are&nbsp;all&nbsp;optional&nbsp;and&nbsp;required<br>
342&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parameters&nbsp;for&nbsp;the&nbsp;OAuth&nbsp;calls.</tt></dd></dl>
343
344<dl><dt><a name="OAuth2WebServerFlow-step1_get_authorize_url"><strong>step1_get_authorize_url</strong></a>(self, redirect_uri<font color="#909090">='oob'</font>)</dt><dd><tt>Returns&nbsp;a&nbsp;URI&nbsp;to&nbsp;redirect&nbsp;to&nbsp;the&nbsp;provider.<br>
345&nbsp;<br>
346Args:<br>
347&nbsp;&nbsp;redirect_uri:&nbsp;string,&nbsp;Either&nbsp;the&nbsp;string&nbsp;'oob'&nbsp;for&nbsp;a&nbsp;non-web-based<br>
348&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;application,&nbsp;or&nbsp;a&nbsp;URI&nbsp;that&nbsp;handles&nbsp;the&nbsp;callback&nbsp;from<br>
349&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;authorization&nbsp;server.<br>
350&nbsp;<br>
351If&nbsp;redirect_uri&nbsp;is&nbsp;'oob'&nbsp;then&nbsp;pass&nbsp;in&nbsp;the<br>
352generated&nbsp;verification&nbsp;code&nbsp;to&nbsp;step2_exchange,<br>
353otherwise&nbsp;pass&nbsp;in&nbsp;the&nbsp;query&nbsp;parameters&nbsp;received<br>
354at&nbsp;the&nbsp;callback&nbsp;uri&nbsp;to&nbsp;step2_exchange.</tt></dd></dl>
355
356<dl><dt><a name="OAuth2WebServerFlow-step2_exchange"><strong>step2_exchange</strong></a>(self, code)</dt><dd><tt>Exhanges&nbsp;a&nbsp;code&nbsp;for&nbsp;<a href="#OAuth2Credentials">OAuth2Credentials</a>.<br>
357&nbsp;<br>
358Args:<br>
359&nbsp;&nbsp;code:&nbsp;string&nbsp;or&nbsp;dict,&nbsp;either&nbsp;the&nbsp;code&nbsp;as&nbsp;a&nbsp;string,&nbsp;or&nbsp;a&nbsp;dictionary<br>
360&nbsp;&nbsp;&nbsp;&nbsp;of&nbsp;the&nbsp;query&nbsp;parameters&nbsp;to&nbsp;the&nbsp;redirect_uri,&nbsp;which&nbsp;contains<br>
361&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;code.</tt></dd></dl>
362
363<hr>
364Data descriptors inherited from <a href="oauth2client.client.html#Flow">Flow</a>:<br>
365<dl><dt><strong>__dict__</strong></dt>
366<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
367</dl>
368<dl><dt><strong>__weakref__</strong></dt>
369<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
370</dl>
371</td></tr></table> <p>
372<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
373<tr bgcolor="#ffc8d8">
374<td colspan=3 valign=bottom>&nbsp;<br>
375<font color="#000000" face="helvetica, arial"><a name="RequestError">class <strong>RequestError</strong></a>(<a href="oauth2client.client.html#Error">Error</a>)</font></td></tr>
376
377<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
378<td colspan=2><tt><a href="#Error">Error</a>&nbsp;occurred&nbsp;during&nbsp;request.<br>&nbsp;</tt></td></tr>
379<tr><td>&nbsp;</td>
380<td width="100%"><dl><dt>Method resolution order:</dt>
381<dd><a href="oauth2client.client.html#RequestError">RequestError</a></dd>
382<dd><a href="oauth2client.client.html#Error">Error</a></dd>
383<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd>
384<dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd>
385<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
386</dl>
387<hr>
388Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br>
389<dl><dt><strong>__weakref__</strong></dt>
390<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
391</dl>
392<hr>
393Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
394<dl><dt><a name="RequestError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__init__">__init__</a>(...)&nbsp;initializes&nbsp;x;&nbsp;see&nbsp;x.__class__.__doc__&nbsp;for&nbsp;signature</tt></dd></dl>
395
396<hr>
397Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
398<dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object&gt;<dd><tt>T.<a href="#RequestError-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl>
399
400<hr>
401Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
402<dl><dt><a name="RequestError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__delattr__">__delattr__</a>('name')&nbsp;&lt;==&gt;&nbsp;del&nbsp;x.name</tt></dd></dl>
403
404<dl><dt><a name="RequestError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl>
405
406<dl><dt><a name="RequestError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__getitem__">__getitem__</a>(y)&nbsp;&lt;==&gt;&nbsp;x[y]</tt></dd></dl>
407
408<dl><dt><a name="RequestError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__getslice__">__getslice__</a>(i,&nbsp;j)&nbsp;&lt;==&gt;&nbsp;x[i:j]<br>
409&nbsp;<br>
410Use&nbsp;of&nbsp;negative&nbsp;indices&nbsp;is&nbsp;not&nbsp;supported.</tt></dd></dl>
411
412<dl><dt><a name="RequestError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl>
413
414<dl><dt><a name="RequestError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__repr__">__repr__</a>()&nbsp;&lt;==&gt;&nbsp;repr(x)</tt></dd></dl>
415
416<dl><dt><a name="RequestError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__setattr__">__setattr__</a>('name',&nbsp;value)&nbsp;&lt;==&gt;&nbsp;x.name&nbsp;=&nbsp;value</tt></dd></dl>
417
418<dl><dt><a name="RequestError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl>
419
420<dl><dt><a name="RequestError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__str__">__str__</a>()&nbsp;&lt;==&gt;&nbsp;str(x)</tt></dd></dl>
421
422<dl><dt><a name="RequestError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl>
423
424<hr>
425Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br>
426<dl><dt><strong>__dict__</strong></dt>
427</dl>
428<dl><dt><strong>args</strong></dt>
429</dl>
430<dl><dt><strong>message</strong></dt>
431</dl>
432</td></tr></table></td></tr></table><p>
433<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
434<tr bgcolor="#55aa55">
435<td colspan=3 valign=bottom>&nbsp;<br>
436<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
437
438<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
439<td width="100%"><strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'</td></tr></table><p>
440<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
441<tr bgcolor="#7799ee">
442<td colspan=3 valign=bottom>&nbsp;<br>
443<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
444
445<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
446<td width="100%">jcgregorio@google.com&nbsp;(Joe&nbsp;Gregorio)</td></tr></table>
447</body></html>