Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1 | |
| 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> <br> |
| 9 | <font color="#ffffff" face="helvetica, arial"> <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 |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 11 | ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/jcgregorio/projects/apiclient/oauth2client/client.py">/usr/local/google/home/jcgregorio/projects/apiclient/oauth2client/client.py</a></font></td></tr></table> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 12 | <p><tt>An OAuth 2.0 client<br> |
| 13 | <br> |
| 14 | Tools for interacting with OAuth 2.0 protected<br> |
| 15 | resources.</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> <br> |
| 20 | <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> |
| 21 | |
| 22 | <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </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> <br> |
| 34 | <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> |
| 35 | |
| 36 | <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </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> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 45 | </font></dt><dd> |
| 46 | <dl> |
| 47 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#AccessTokenCredentials">AccessTokenCredentials</a> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 48 | </font></dt></dl> |
| 49 | </dd> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 50 | </dl> |
| 51 | </dd> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 52 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Flow">Flow</a> |
| 53 | </font></dt><dd> |
| 54 | <dl> |
| 55 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#OAuth2WebServerFlow">OAuth2WebServerFlow</a> |
| 56 | </font></dt></dl> |
| 57 | </dd> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 58 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Storage">Storage</a> |
| 59 | </font></dt></dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 60 | </dd> |
| 61 | <dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>) |
| 62 | </font></dt><dd> |
| 63 | <dl> |
| 64 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Error">Error</a> |
| 65 | </font></dt><dd> |
| 66 | <dl> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 67 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#AccessTokenCredentialsError">AccessTokenCredentialsError</a> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 68 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.client.html#RequestError">RequestError</a> |
| 69 | </font></dt></dl> |
| 70 | </dd> |
| 71 | </dl> |
| 72 | </dd> |
| 73 | </dl> |
| 74 | <p> |
| 75 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 76 | <tr bgcolor="#ffc8d8"> |
| 77 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 78 | <font color="#000000" face="helvetica, arial"><a name="AccessTokenCredentials">class <strong>AccessTokenCredentials</strong></a>(<a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>)</font></td></tr> |
| 79 | |
| 80 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 81 | <td colspan=2><tt><a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> for OAuth 2.0<br> |
| 82 | <br> |
| 83 | <a href="#Credentials">Credentials</a> can be applied to an httplib2.Http <a href="__builtin__.html#object">object</a> using the <a href="#AccessTokenCredentials-authorize">authorize</a>()<br> |
| 84 | method, which then signs each request from that <a href="__builtin__.html#object">object</a> with the OAuth 2.0<br> |
| 85 | access token. This set of credentials is for the use case where you have<br> |
| 86 | acquired an OAuth 2.0 access_token from another place such as a JavaScript<br> |
| 87 | client or another web application, and wish to use it from Python. Because<br> |
| 88 | only the access_token is present it can not be refreshed and will in time<br> |
| 89 | expire.<br> |
| 90 | <br> |
| 91 | <a href="#OAuth2Credentials">OAuth2Credentials</a> objects may be safely pickled and unpickled.<br> |
| 92 | <br> |
| 93 | Usage:<br> |
| 94 | credentials = <a href="#AccessTokenCredentials">AccessTokenCredentials</a>('<an access token>',<br> |
| 95 | 'my-user-agent/1.0')<br> |
| 96 | http = httplib2.Http()<br> |
| 97 | http = credentials.<a href="#AccessTokenCredentials-authorize">authorize</a>(http)<br> |
| 98 | <br> |
| 99 | Exceptions:<br> |
| 100 | AccessTokenCredentialsExpired: raised when the access_token expires or is<br> |
| 101 | revoked.<br> </tt></td></tr> |
| 102 | <tr><td> </td> |
| 103 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 104 | <dd><a href="oauth2client.client.html#AccessTokenCredentials">AccessTokenCredentials</a></dd> |
| 105 | <dd><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a></dd> |
| 106 | <dd><a href="oauth2client.client.html#Credentials">Credentials</a></dd> |
| 107 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 108 | </dl> |
| 109 | <hr> |
| 110 | Methods defined here:<br> |
| 111 | <dl><dt><a name="AccessTokenCredentials-__init__"><strong>__init__</strong></a>(self, access_token, user_agent)</dt><dd><tt>Create an instance of <a href="#OAuth2Credentials">OAuth2Credentials</a><br> |
| 112 | <br> |
| 113 | This is one of the few types if <a href="#Credentials">Credentials</a> that you should contrust,<br> |
| 114 | <a href="#Credentials">Credentials</a> objects are usually instantiated by a <a href="#Flow">Flow</a>.<br> |
| 115 | <br> |
| 116 | Args:<br> |
| 117 | token_uri: string, URI of token endpoint.<br> |
| 118 | user_agent: string, The HTTP User-Agent to provide for this application.<br> |
| 119 | <br> |
| 120 | Notes:<br> |
| 121 | store: callable, a callable that when passed a Credential<br> |
| 122 | will store the credential back to where it came from.</tt></dd></dl> |
| 123 | |
| 124 | <hr> |
| 125 | Methods inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
| 126 | <dl><dt><a name="AccessTokenCredentials-__getstate__"><strong>__getstate__</strong></a>(self)</dt><dd><tt>Trim the state down to something that can be pickled.</tt></dd></dl> |
| 127 | |
| 128 | <dl><dt><a name="AccessTokenCredentials-__setstate__"><strong>__setstate__</strong></a>(self, state)</dt><dd><tt>Reconstitute the state of the <a href="__builtin__.html#object">object</a> from being pickled.</tt></dd></dl> |
| 129 | |
| 130 | <dl><dt><a name="AccessTokenCredentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Authorize an httplib2.Http instance with these credentials.<br> |
| 131 | <br> |
| 132 | Args:<br> |
| 133 | http: An instance of httplib2.Http<br> |
| 134 | or something that acts like it.<br> |
| 135 | <br> |
| 136 | Returns:<br> |
| 137 | A modified instance of http that was passed in.<br> |
| 138 | <br> |
| 139 | Example:<br> |
| 140 | <br> |
| 141 | h = httplib2.Http()<br> |
| 142 | h = credentials.<a href="#AccessTokenCredentials-authorize">authorize</a>(h)<br> |
| 143 | <br> |
| 144 | You can't create a new OAuth<br> |
| 145 | subclass of httplib2.Authenication because<br> |
| 146 | it never gets passed the absolute URI, which is<br> |
| 147 | needed for signing. So instead we have to overload<br> |
| 148 | 'request' with a closure that adds in the<br> |
| 149 | Authorization header and then calls the original version<br> |
| 150 | of 'request()'.</tt></dd></dl> |
| 151 | |
| 152 | <dl><dt><a name="AccessTokenCredentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set the storage for the credential.<br> |
| 153 | <br> |
| 154 | Args:<br> |
| 155 | store: callable, a callable that when passed a Credential<br> |
| 156 | will store the credential back to where it came from.<br> |
| 157 | This is needed to store the latest access_token if it<br> |
| 158 | has expired and been refreshed.</tt></dd></dl> |
| 159 | |
| 160 | <hr> |
| 161 | Data descriptors inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 162 | <dl><dt><strong>__dict__</strong></dt> |
| 163 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 164 | </dl> |
| 165 | <dl><dt><strong>__weakref__</strong></dt> |
| 166 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 167 | </dl> |
| 168 | </td></tr></table> <p> |
| 169 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 170 | <tr bgcolor="#ffc8d8"> |
| 171 | <td colspan=3 valign=bottom> <br> |
| 172 | <font color="#000000" face="helvetica, arial"><a name="AccessTokenCredentialsError">class <strong>AccessTokenCredentialsError</strong></a>(<a href="oauth2client.client.html#Error">Error</a>)</font></td></tr> |
| 173 | |
| 174 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 175 | <td colspan=2><tt>Having only the access_token means no refresh is possible.<br> </tt></td></tr> |
| 176 | <tr><td> </td> |
| 177 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 178 | <dd><a href="oauth2client.client.html#AccessTokenCredentialsError">AccessTokenCredentialsError</a></dd> |
| 179 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 180 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 181 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 182 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 183 | </dl> |
| 184 | <hr> |
| 185 | Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br> |
| 186 | <dl><dt><strong>__weakref__</strong></dt> |
| 187 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 188 | </dl> |
| 189 | <hr> |
| 190 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 191 | <dl><dt><a name="AccessTokenCredentialsError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenCredentialsError-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl> |
| 192 | |
| 193 | <hr> |
| 194 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 195 | <dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#AccessTokenCredentialsError-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> |
| 196 | |
| 197 | <hr> |
| 198 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 199 | <dl><dt><a name="AccessTokenCredentialsError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenCredentialsError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> |
| 200 | |
| 201 | <dl><dt><a name="AccessTokenCredentialsError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenCredentialsError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> |
| 202 | |
| 203 | <dl><dt><a name="AccessTokenCredentialsError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenCredentialsError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> |
| 204 | |
| 205 | <dl><dt><a name="AccessTokenCredentialsError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenCredentialsError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> |
| 206 | <br> |
| 207 | Use of negative indices is not supported.</tt></dd></dl> |
| 208 | |
| 209 | <dl><dt><a name="AccessTokenCredentialsError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 210 | |
| 211 | <dl><dt><a name="AccessTokenCredentialsError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenCredentialsError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> |
| 212 | |
| 213 | <dl><dt><a name="AccessTokenCredentialsError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenCredentialsError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> |
| 214 | |
| 215 | <dl><dt><a name="AccessTokenCredentialsError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 216 | |
| 217 | <dl><dt><a name="AccessTokenCredentialsError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenCredentialsError-__str__">__str__</a>() <==> str(x)</tt></dd></dl> |
| 218 | |
| 219 | <dl><dt><a name="AccessTokenCredentialsError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 220 | |
| 221 | <hr> |
| 222 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 223 | <dl><dt><strong>__dict__</strong></dt> |
| 224 | </dl> |
| 225 | <dl><dt><strong>args</strong></dt> |
| 226 | </dl> |
| 227 | <dl><dt><strong>message</strong></dt> |
| 228 | </dl> |
| 229 | </td></tr></table> <p> |
| 230 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 231 | <tr bgcolor="#ffc8d8"> |
| 232 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 233 | <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> |
| 234 | |
| 235 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 236 | <td colspan=2><tt>Base class for all <a href="#Credentials">Credentials</a> objects.<br> |
| 237 | <br> |
| 238 | Subclasses must define an <a href="#Credentials-authorize">authorize</a>() method<br> |
| 239 | that applies the credentials to an HTTP transport.<br> </tt></td></tr> |
| 240 | <tr><td> </td> |
| 241 | <td width="100%">Methods defined here:<br> |
| 242 | <dl><dt><a name="Credentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Take an httplib2.Http instance (or equivalent) and<br> |
| 243 | authorizes it for the set of credentials, usually by<br> |
| 244 | replacing http.request() with a method that adds in<br> |
| 245 | the appropriate headers and then delegates to the original<br> |
| 246 | Http.request() method.</tt></dd></dl> |
| 247 | |
| 248 | <hr> |
| 249 | Data descriptors defined here:<br> |
| 250 | <dl><dt><strong>__dict__</strong></dt> |
| 251 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 252 | </dl> |
| 253 | <dl><dt><strong>__weakref__</strong></dt> |
| 254 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 255 | </dl> |
| 256 | </td></tr></table> <p> |
| 257 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 258 | <tr bgcolor="#ffc8d8"> |
| 259 | <td colspan=3 valign=bottom> <br> |
| 260 | <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> |
| 261 | |
| 262 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 263 | <td colspan=2><tt>Base error for this module.<br> </tt></td></tr> |
| 264 | <tr><td> </td> |
| 265 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 266 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 267 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 268 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 269 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 270 | </dl> |
| 271 | <hr> |
| 272 | Data descriptors defined here:<br> |
| 273 | <dl><dt><strong>__weakref__</strong></dt> |
| 274 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 275 | </dl> |
| 276 | <hr> |
| 277 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 278 | <dl><dt><a name="Error-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl> |
| 279 | |
| 280 | <hr> |
| 281 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 282 | <dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#Error-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> |
| 283 | |
| 284 | <hr> |
| 285 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 286 | <dl><dt><a name="Error-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> |
| 287 | |
| 288 | <dl><dt><a name="Error-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> |
| 289 | |
| 290 | <dl><dt><a name="Error-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> |
| 291 | |
| 292 | <dl><dt><a name="Error-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> |
| 293 | <br> |
| 294 | Use of negative indices is not supported.</tt></dd></dl> |
| 295 | |
| 296 | <dl><dt><a name="Error-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 297 | |
| 298 | <dl><dt><a name="Error-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> |
| 299 | |
| 300 | <dl><dt><a name="Error-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> |
| 301 | |
| 302 | <dl><dt><a name="Error-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 303 | |
| 304 | <dl><dt><a name="Error-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__str__">__str__</a>() <==> str(x)</tt></dd></dl> |
| 305 | |
| 306 | <dl><dt><a name="Error-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 307 | |
| 308 | <hr> |
| 309 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 310 | <dl><dt><strong>__dict__</strong></dt> |
| 311 | </dl> |
| 312 | <dl><dt><strong>args</strong></dt> |
| 313 | </dl> |
| 314 | <dl><dt><strong>message</strong></dt> |
| 315 | </dl> |
| 316 | </td></tr></table> <p> |
| 317 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 318 | <tr bgcolor="#ffc8d8"> |
| 319 | <td colspan=3 valign=bottom> <br> |
| 320 | <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> |
| 321 | |
| 322 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 323 | <td colspan=2><tt>Base class for all <a href="#Flow">Flow</a> objects.<br> </tt></td></tr> |
| 324 | <tr><td> </td> |
| 325 | <td width="100%">Data descriptors defined here:<br> |
| 326 | <dl><dt><strong>__dict__</strong></dt> |
| 327 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 328 | </dl> |
| 329 | <dl><dt><strong>__weakref__</strong></dt> |
| 330 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 331 | </dl> |
| 332 | </td></tr></table> <p> |
| 333 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 334 | <tr bgcolor="#ffc8d8"> |
| 335 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 336 | <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> |
| 337 | |
| 338 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 339 | <td colspan=2><tt><a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> for OAuth 2.0<br> |
| 340 | <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 341 | <a href="#Credentials">Credentials</a> can be applied to an httplib2.Http <a href="__builtin__.html#object">object</a> using the <a href="#OAuth2Credentials-authorize">authorize</a>()<br> |
| 342 | method, which then signs each request from that <a href="__builtin__.html#object">object</a> with the OAuth 2.0<br> |
| 343 | access token.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 344 | <br> |
| 345 | <a href="#OAuth2Credentials">OAuth2Credentials</a> objects may be safely pickled and unpickled.<br> </tt></td></tr> |
| 346 | <tr><td> </td> |
| 347 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 348 | <dd><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a></dd> |
| 349 | <dd><a href="oauth2client.client.html#Credentials">Credentials</a></dd> |
| 350 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 351 | </dl> |
| 352 | <hr> |
| 353 | Methods defined here:<br> |
| 354 | <dl><dt><a name="OAuth2Credentials-__getstate__"><strong>__getstate__</strong></a>(self)</dt><dd><tt>Trim the state down to something that can be pickled.</tt></dd></dl> |
| 355 | |
| 356 | <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 an instance of <a href="#OAuth2Credentials">OAuth2Credentials</a><br> |
| 357 | <br> |
| 358 | This constructor is not usually called by the user, instead<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 359 | <a href="#OAuth2Credentials">OAuth2Credentials</a> objects are instantiated by the <a href="#OAuth2WebServerFlow">OAuth2WebServerFlow</a>.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 360 | <br> |
| 361 | Args:<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 362 | token_uri: string, URI of token endpoint.<br> |
| 363 | client_id: string, client identifier.<br> |
| 364 | client_secret: string, client secret.<br> |
| 365 | access_token: string, access token.<br> |
| 366 | token_expiry: datetime, when the access_token expires.<br> |
| 367 | refresh_token: string, refresh token.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 368 | user_agent: string, The HTTP User-Agent to provide for this application.<br> |
| 369 | <br> |
| 370 | <br> |
| 371 | Notes:<br> |
| 372 | store: callable, a callable that when passed a Credential<br> |
| 373 | will store the credential back to where it came from.<br> |
| 374 | This is needed to store the latest access_token if it<br> |
| 375 | has expired and been refreshed.</tt></dd></dl> |
| 376 | |
| 377 | <dl><dt><a name="OAuth2Credentials-__setstate__"><strong>__setstate__</strong></a>(self, state)</dt><dd><tt>Reconstitute the state of the <a href="__builtin__.html#object">object</a> from being pickled.</tt></dd></dl> |
| 378 | |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 379 | <dl><dt><a name="OAuth2Credentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Authorize an httplib2.Http instance with these credentials.<br> |
| 380 | <br> |
| 381 | Args:<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 382 | http: An instance of httplib2.Http<br> |
| 383 | or something that acts like it.<br> |
| 384 | <br> |
| 385 | Returns:<br> |
| 386 | A modified instance of http that was passed in.<br> |
| 387 | <br> |
| 388 | Example:<br> |
| 389 | <br> |
| 390 | h = httplib2.Http()<br> |
| 391 | h = credentials.<a href="#OAuth2Credentials-authorize">authorize</a>(h)<br> |
| 392 | <br> |
| 393 | You can't create a new OAuth<br> |
| 394 | subclass of httplib2.Authenication because<br> |
| 395 | it never gets passed the absolute URI, which is<br> |
| 396 | needed for signing. So instead we have to overload<br> |
| 397 | 'request' with a closure that adds in the<br> |
| 398 | Authorization header and then calls the original version<br> |
| 399 | of 'request()'.</tt></dd></dl> |
| 400 | |
| 401 | <dl><dt><a name="OAuth2Credentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set the storage for the credential.<br> |
| 402 | <br> |
| 403 | Args:<br> |
| 404 | store: callable, a callable that when passed a Credential<br> |
| 405 | will store the credential back to where it came from.<br> |
| 406 | This is needed to store the latest access_token if it<br> |
| 407 | has expired and been refreshed.</tt></dd></dl> |
| 408 | |
| 409 | <hr> |
| 410 | Data descriptors inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 411 | <dl><dt><strong>__dict__</strong></dt> |
| 412 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 413 | </dl> |
| 414 | <dl><dt><strong>__weakref__</strong></dt> |
| 415 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 416 | </dl> |
| 417 | </td></tr></table> <p> |
| 418 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 419 | <tr bgcolor="#ffc8d8"> |
| 420 | <td colspan=3 valign=bottom> <br> |
| 421 | <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> |
| 422 | |
| 423 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 424 | <td colspan=2><tt>Does the Web Server <a href="#Flow">Flow</a> for OAuth 2.0.<br> |
| 425 | <br> |
| 426 | <a href="#OAuth2Credentials">OAuth2Credentials</a> objects may be safely pickled and unpickled.<br> </tt></td></tr> |
| 427 | <tr><td> </td> |
| 428 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 429 | <dd><a href="oauth2client.client.html#OAuth2WebServerFlow">OAuth2WebServerFlow</a></dd> |
| 430 | <dd><a href="oauth2client.client.html#Flow">Flow</a></dd> |
| 431 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 432 | </dl> |
| 433 | <hr> |
| 434 | Methods defined here:<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 435 | <dl><dt><a name="OAuth2WebServerFlow-__init__"><strong>__init__</strong></a>(self, client_id, client_secret, scope, user_agent, auth_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 for <a href="#OAuth2WebServerFlow">OAuth2WebServerFlow</a><br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 436 | <br> |
| 437 | Args:<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 438 | client_id: string, client identifier.<br> |
| 439 | client_secret: string client secret.<br> |
| 440 | scope: string, scope of the credentials being requested.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 441 | user_agent: string, HTTP User-Agent to provide for this application.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 442 | auth_uri: string, URI for authorization endpoint. For convenience<br> |
| 443 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.<br> |
| 444 | token_uri: string, URI for token endpoint. For convenience<br> |
| 445 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 446 | **kwargs: dict, The keyword arguments are all optional and required<br> |
| 447 | parameters for the OAuth calls.</tt></dd></dl> |
| 448 | |
| 449 | <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 a URI to redirect to the provider.<br> |
| 450 | <br> |
| 451 | Args:<br> |
| 452 | redirect_uri: string, Either the string 'oob' for a non-web-based<br> |
| 453 | application, or a URI that handles the callback from<br> |
| 454 | the authorization server.<br> |
| 455 | <br> |
| 456 | If redirect_uri is 'oob' then pass in the<br> |
| 457 | generated verification code to step2_exchange,<br> |
| 458 | otherwise pass in the query parameters received<br> |
| 459 | at the callback uri to step2_exchange.</tt></dd></dl> |
| 460 | |
| 461 | <dl><dt><a name="OAuth2WebServerFlow-step2_exchange"><strong>step2_exchange</strong></a>(self, code)</dt><dd><tt>Exhanges a code for <a href="#OAuth2Credentials">OAuth2Credentials</a>.<br> |
| 462 | <br> |
| 463 | Args:<br> |
| 464 | code: string or dict, either the code as a string, or a dictionary<br> |
| 465 | of the query parameters to the redirect_uri, which contains<br> |
| 466 | the code.</tt></dd></dl> |
| 467 | |
| 468 | <hr> |
| 469 | Data descriptors inherited from <a href="oauth2client.client.html#Flow">Flow</a>:<br> |
| 470 | <dl><dt><strong>__dict__</strong></dt> |
| 471 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 472 | </dl> |
| 473 | <dl><dt><strong>__weakref__</strong></dt> |
| 474 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 475 | </dl> |
| 476 | </td></tr></table> <p> |
| 477 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 478 | <tr bgcolor="#ffc8d8"> |
| 479 | <td colspan=3 valign=bottom> <br> |
| 480 | <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> |
| 481 | |
| 482 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 483 | <td colspan=2><tt><a href="#Error">Error</a> occurred during request.<br> </tt></td></tr> |
| 484 | <tr><td> </td> |
| 485 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 486 | <dd><a href="oauth2client.client.html#RequestError">RequestError</a></dd> |
| 487 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 488 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 489 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 490 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 491 | </dl> |
| 492 | <hr> |
| 493 | Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br> |
| 494 | <dl><dt><strong>__weakref__</strong></dt> |
| 495 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 496 | </dl> |
| 497 | <hr> |
| 498 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 499 | <dl><dt><a name="RequestError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl> |
| 500 | |
| 501 | <hr> |
| 502 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 503 | <dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#RequestError-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> |
| 504 | |
| 505 | <hr> |
| 506 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 507 | <dl><dt><a name="RequestError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> |
| 508 | |
| 509 | <dl><dt><a name="RequestError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> |
| 510 | |
| 511 | <dl><dt><a name="RequestError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> |
| 512 | |
| 513 | <dl><dt><a name="RequestError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> |
| 514 | <br> |
| 515 | Use of negative indices is not supported.</tt></dd></dl> |
| 516 | |
| 517 | <dl><dt><a name="RequestError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 518 | |
| 519 | <dl><dt><a name="RequestError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> |
| 520 | |
| 521 | <dl><dt><a name="RequestError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> |
| 522 | |
| 523 | <dl><dt><a name="RequestError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 524 | |
| 525 | <dl><dt><a name="RequestError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#RequestError-__str__">__str__</a>() <==> str(x)</tt></dd></dl> |
| 526 | |
| 527 | <dl><dt><a name="RequestError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 528 | |
| 529 | <hr> |
| 530 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 531 | <dl><dt><strong>__dict__</strong></dt> |
| 532 | </dl> |
| 533 | <dl><dt><strong>args</strong></dt> |
| 534 | </dl> |
| 535 | <dl><dt><strong>message</strong></dt> |
| 536 | </dl> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 537 | </td></tr></table> <p> |
| 538 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 539 | <tr bgcolor="#ffc8d8"> |
| 540 | <td colspan=3 valign=bottom> <br> |
| 541 | <font color="#000000" face="helvetica, arial"><a name="Storage">class <strong>Storage</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> |
| 542 | |
| 543 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 544 | <td colspan=2><tt>Base class for all <a href="#Storage">Storage</a> objects.<br> |
| 545 | <br> |
| 546 | Store and retrieve a single credential.<br> </tt></td></tr> |
| 547 | <tr><td> </td> |
| 548 | <td width="100%">Methods defined here:<br> |
| 549 | <dl><dt><a name="Storage-get"><strong>get</strong></a>(self)</dt><dd><tt>Retrieve credential.<br> |
| 550 | <br> |
| 551 | Returns:<br> |
| 552 | apiclient.oauth.<a href="#Credentials">Credentials</a></tt></dd></dl> |
| 553 | |
| 554 | <dl><dt><a name="Storage-put"><strong>put</strong></a>(self, credentials)</dt><dd><tt>Write a credential.<br> |
| 555 | <br> |
| 556 | Args:<br> |
| 557 | credentials: <a href="#Credentials">Credentials</a>, the credentials to store.</tt></dd></dl> |
| 558 | |
| 559 | <hr> |
| 560 | Data descriptors defined here:<br> |
| 561 | <dl><dt><strong>__dict__</strong></dt> |
| 562 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 563 | </dl> |
| 564 | <dl><dt><strong>__weakref__</strong></dt> |
| 565 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 566 | </dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 567 | </td></tr></table></td></tr></table><p> |
| 568 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 569 | <tr bgcolor="#55aa55"> |
| 570 | <td colspan=3 valign=bottom> <br> |
| 571 | <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> |
| 572 | |
| 573 | <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> |
| 574 | <td width="100%"><strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'</td></tr></table><p> |
| 575 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 576 | <tr bgcolor="#7799ee"> |
| 577 | <td colspan=3 valign=bottom> <br> |
| 578 | <font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr> |
| 579 | |
| 580 | <tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td> |
| 581 | <td width="100%">jcgregorio@google.com (Joe Gregorio)</td></tr></table> |
| 582 | </body></html> |