Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 1 | <?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.client.OAuth2Credentials</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> <a |
| 20 | href="module-tree.html">Trees</a> </th> |
| 21 | |
| 22 | <!-- Index link --> |
| 23 | <th> <a |
| 24 | href="identifier-index.html">Indices</a> </th> |
| 25 | |
| 26 | <!-- Help link --> |
| 27 | <th> <a |
| 28 | href="help.html">Help</a> </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 oauth2client</a> :: |
| 38 | <a href="oauth2client.client-module.html">Module client</a> :: |
| 39 | Class OAuth2Credentials |
| 40 | </span> |
| 41 | </td> |
| 42 | <td> |
| 43 | <table cellpadding="0" cellspacing="0"> |
| 44 | <!-- hide/show private --> |
| 45 | <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" |
| 46 | onclick="toggle_private();">hide private</a>]</span></td></tr> |
| 47 | <tr><td align="right"><span class="options" |
| 48 | >[<a href="frames.html" target="_top">frames</a |
| 49 | >] | <a href="oauth2client.client.OAuth2Credentials-class.html" |
| 50 | target="_top">no frames</a>]</span></td></tr> |
| 51 | </table> |
| 52 | </td> |
| 53 | </tr> |
| 54 | </table> |
| 55 | <!-- ==================== CLASS DESCRIPTION ==================== --> |
| 56 | <h1 class="epydoc">Class OAuth2Credentials</h1><p class="nomargin-top"><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials">source code</a></span></p> |
| 57 | <center> |
| 58 | <center> <map id="uml_class_diagram_for_oauth2cl_19" name="uml_class_diagram_for_oauth2cl_19"> |
| 59 | <area shape="rect" href="oauth2client.client.OAuth2Credentials-class.html#access_token_expired" title="True if the credential is expired or invalid." alt="" coords="17,116,719,135"/> |
| 60 | <area shape="rect" href="oauth2client.client.OAuth2Credentials-class.html#__init__" title="Create an instance of OAuth2Credentials." alt="" coords="17,137,719,156"/> |
| 61 | <area shape="rect" href="oauth2client.client.OAuth2Credentials-class.html#authorize" title="Authorize an httplib2.Http instance with these credentials." alt="" coords="17,156,719,175"/> |
| 62 | <area shape="rect" href="oauth2client.client.OAuth2Credentials-class.html#refresh" title="Forces a refresh of the access_token." alt="" coords="17,175,719,193"/> |
| 63 | <area shape="rect" href="oauth2client.client.OAuth2Credentials-class.html#apply" title="Add the authorization to the headers." alt="" coords="17,193,719,212"/> |
| 64 | <area shape="rect" href="oauth2client.client.OAuth2Credentials-class.html#to_json" title="Creating a JSON representation of an instance of Credentials." alt="" coords="17,212,719,231"/> |
| 65 | <area shape="rect" href="oauth2client.client.OAuth2Credentials-class.html#from_json" title="Instantiate a Credentials object from a JSON description of it." alt="" coords="17,231,719,249"/> |
| 66 | <area shape="rect" href="oauth2client.client.OAuth2Credentials-class.html#set_store" title="Set the Storage for the credential." alt="" coords="17,249,719,268"/> |
| 67 | <area shape="rect" href="oauth2client.client.OAuth2Credentials-class.html#__getstate__" title="Trim the state down to something that can be pickled." alt="" coords="17,268,719,287"/> |
| 68 | <area shape="rect" href="oauth2client.client.OAuth2Credentials-class.html#__setstate__" title="Reconstitute the state of the object from being pickled." alt="" coords="17,287,719,305"/> |
| 69 | <area shape="rect" href="oauth2client.client.OAuth2Credentials-class.html" title="Credentials object for OAuth 2.0." alt="" coords="16,99,720,307"/> |
| 70 | <area shape="rect" href="oauth2client.client.AssertionCredentials-class.html" title="Abstract Credentials object used for OAuth 2.0 assertion grants." alt="" coords="204,336,337,363"/> |
| 71 | <area shape="rect" href="oauth2client.client.AccessTokenCredentials-class.html" title="Credentials object for OAuth 2.0." alt="" coords="388,336,545,363"/> |
Joe Gregorio | 6621203 | 2012-06-14 09:10:14 -0400 | [diff] [blame] | 72 | <area shape="rect" href="oauth2client.appengine.AppAssertionCredentials-class.html" title="Credentials object for App Engine Assertion Grants" alt="" coords="32,392,253,419"/> |
| 73 | <area shape="rect" href="oauth2client.client.SignedJwtAssertionCredentials-class.html" title="Credentials object used for OAuth 2.0 Signed JWT assertion grants." alt="" coords="304,392,496,419"/> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 74 | <area shape="rect" href="oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS" title="oauth2client.client.Credentials.NON_SERIALIZED_MEMBERS" alt="" coords="273,28,463,47"/> |
| 75 | <area shape="rect" href="oauth2client.client.Credentials-class.html#new_from_json" title="Utility class method to instantiate a Credentials subclass from a JSON representation produced by to_json()." alt="" coords="273,49,463,68"/> |
| 76 | <area shape="rect" href="oauth2client.client.Credentials-class.html" title="Base class for all Credentials objects." alt="" coords="272,11,464,69"/> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 77 | </map> |
| 78 | <img src="uml_class_diagram_for_oauth2cl_19.gif" alt='' usemap="#uml_class_diagram_for_oauth2cl_19" ismap="ismap" class="graph-without-title" /> |
| 79 | </center> |
| 80 | </center> |
| 81 | <hr /> |
| 82 | <pre class="literalblock"> |
| 83 | Credentials object for OAuth 2.0. |
| 84 | |
| 85 | Credentials can be applied to an httplib2.Http object using the authorize() |
| 86 | method, which then adds the OAuth 2.0 access token to each request. |
| 87 | |
| 88 | OAuth2Credentials objects may be safely pickled and unpickled. |
| 89 | |
| 90 | </pre> |
| 91 | |
| 92 | <!-- ==================== INSTANCE METHODS ==================== --> |
| 93 | <a name="section-InstanceMethods"></a> |
| 94 | <table class="summary" border="1" cellpadding="3" |
| 95 | cellspacing="0" width="100%" bgcolor="white"> |
| 96 | <tr bgcolor="#70b0f0" class="table-header"> |
| 97 | <td colspan="2" class="table-header"> |
| 98 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 99 | <tr valign="top"> |
| 100 | <td align="left"><span class="table-header">Instance Methods</span></td> |
| 101 | <td align="right" valign="top" |
| 102 | ><span class="options">[<a href="#section-InstanceMethods" |
| 103 | class="privatelink" onclick="toggle_private();" |
| 104 | >hide private</a>]</span></td> |
| 105 | </tr> |
| 106 | </table> |
| 107 | </td> |
| 108 | </tr> |
| 109 | <tr> |
| 110 | <td width="15%" align="right" valign="top" class="summary"> |
| 111 | <span class="summary-type"> </span> |
| 112 | </td><td class="summary"> |
| 113 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 114 | <tr> |
| 115 | <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, |
| 116 | <span class="summary-sig-arg">access_token</span>, |
| 117 | <span class="summary-sig-arg">client_id</span>, |
| 118 | <span class="summary-sig-arg">client_secret</span>, |
| 119 | <span class="summary-sig-arg">refresh_token</span>, |
| 120 | <span class="summary-sig-arg">token_expiry</span>, |
| 121 | <span class="summary-sig-arg">token_uri</span>, |
| 122 | <span class="summary-sig-arg">user_agent</span>, |
| 123 | <span class="summary-sig-arg">id_token</span>=<span class="summary-sig-default">None</span>)</span><br /> |
| 124 | Create an instance of OAuth2Credentials.</td> |
| 125 | <td align="right" valign="top"> |
| 126 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.__init__">source code</a></span> |
| 127 | |
| 128 | </td> |
| 129 | </tr> |
| 130 | </table> |
| 131 | |
| 132 | </td> |
| 133 | </tr> |
| 134 | <tr> |
| 135 | <td width="15%" align="right" valign="top" class="summary"> |
| 136 | <span class="summary-type"> </span> |
| 137 | </td><td class="summary"> |
| 138 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 139 | <tr> |
| 140 | <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#authorize" class="summary-sig-name">authorize</a>(<span class="summary-sig-arg">self</span>, |
| 141 | <span class="summary-sig-arg">http</span>)</span><br /> |
| 142 | Authorize an httplib2.Http instance with these credentials.</td> |
| 143 | <td align="right" valign="top"> |
| 144 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.authorize">source code</a></span> |
| 145 | |
| 146 | </td> |
| 147 | </tr> |
| 148 | </table> |
| 149 | |
| 150 | </td> |
| 151 | </tr> |
| 152 | <tr> |
| 153 | <td width="15%" align="right" valign="top" class="summary"> |
| 154 | <span class="summary-type"> </span> |
| 155 | </td><td class="summary"> |
| 156 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 157 | <tr> |
| 158 | <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#refresh" class="summary-sig-name">refresh</a>(<span class="summary-sig-arg">self</span>, |
| 159 | <span class="summary-sig-arg">http</span>)</span><br /> |
| 160 | Forces a refresh of the access_token.</td> |
| 161 | <td align="right" valign="top"> |
| 162 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.refresh">source code</a></span> |
| 163 | |
| 164 | </td> |
| 165 | </tr> |
| 166 | </table> |
| 167 | |
| 168 | </td> |
| 169 | </tr> |
| 170 | <tr> |
| 171 | <td width="15%" align="right" valign="top" class="summary"> |
| 172 | <span class="summary-type"> </span> |
| 173 | </td><td class="summary"> |
| 174 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 175 | <tr> |
| 176 | <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#apply" class="summary-sig-name">apply</a>(<span class="summary-sig-arg">self</span>, |
| 177 | <span class="summary-sig-arg">headers</span>)</span><br /> |
| 178 | Add the authorization to the headers.</td> |
| 179 | <td align="right" valign="top"> |
| 180 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.apply">source code</a></span> |
| 181 | |
| 182 | </td> |
| 183 | </tr> |
| 184 | </table> |
| 185 | |
| 186 | </td> |
| 187 | </tr> |
| 188 | <tr> |
| 189 | <td width="15%" align="right" valign="top" class="summary"> |
| 190 | <span class="summary-type"> </span> |
| 191 | </td><td class="summary"> |
| 192 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 193 | <tr> |
| 194 | <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#to_json" class="summary-sig-name">to_json</a>(<span class="summary-sig-arg">self</span>)</span><br /> |
| 195 | Creating a JSON representation of an instance of Credentials.</td> |
| 196 | <td align="right" valign="top"> |
| 197 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.to_json">source code</a></span> |
| 198 | |
| 199 | </td> |
| 200 | </tr> |
| 201 | </table> |
| 202 | |
| 203 | </td> |
| 204 | </tr> |
| 205 | <tr> |
| 206 | <td width="15%" align="right" valign="top" class="summary"> |
| 207 | <span class="summary-type"> </span> |
| 208 | </td><td class="summary"> |
| 209 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 210 | <tr> |
| 211 | <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#set_store" class="summary-sig-name">set_store</a>(<span class="summary-sig-arg">self</span>, |
| 212 | <span class="summary-sig-arg">store</span>)</span><br /> |
| 213 | Set the Storage for the credential.</td> |
| 214 | <td align="right" valign="top"> |
| 215 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.set_store">source code</a></span> |
| 216 | |
| 217 | </td> |
| 218 | </tr> |
| 219 | </table> |
| 220 | |
| 221 | </td> |
| 222 | </tr> |
| 223 | <tr class="private"> |
| 224 | <td width="15%" align="right" valign="top" class="summary"> |
| 225 | <span class="summary-type"> </span> |
| 226 | </td><td class="summary"> |
| 227 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 228 | <tr> |
| 229 | <td><span class="summary-sig"><a name="_updateFromCredential"></a><span class="summary-sig-name">_updateFromCredential</span>(<span class="summary-sig-arg">self</span>, |
| 230 | <span class="summary-sig-arg">other</span>)</span><br /> |
| 231 | Update this Credential from another instance.</td> |
| 232 | <td align="right" valign="top"> |
| 233 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._updateFromCredential">source code</a></span> |
| 234 | |
| 235 | </td> |
| 236 | </tr> |
| 237 | </table> |
| 238 | |
| 239 | </td> |
| 240 | </tr> |
| 241 | <tr> |
| 242 | <td width="15%" align="right" valign="top" class="summary"> |
| 243 | <span class="summary-type"> </span> |
| 244 | </td><td class="summary"> |
| 245 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 246 | <tr> |
| 247 | <td><span class="summary-sig"><a name="__getstate__"></a><span class="summary-sig-name">__getstate__</span>(<span class="summary-sig-arg">self</span>)</span><br /> |
| 248 | Trim the state down to something that can be pickled.</td> |
| 249 | <td align="right" valign="top"> |
| 250 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.__getstate__">source code</a></span> |
| 251 | |
| 252 | </td> |
| 253 | </tr> |
| 254 | </table> |
| 255 | |
| 256 | </td> |
| 257 | </tr> |
| 258 | <tr> |
| 259 | <td width="15%" align="right" valign="top" class="summary"> |
| 260 | <span class="summary-type"> </span> |
| 261 | </td><td class="summary"> |
| 262 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 263 | <tr> |
| 264 | <td><span class="summary-sig"><a name="__setstate__"></a><span class="summary-sig-name">__setstate__</span>(<span class="summary-sig-arg">self</span>, |
| 265 | <span class="summary-sig-arg">state</span>)</span><br /> |
| 266 | Reconstitute the state of the object from being pickled.</td> |
| 267 | <td align="right" valign="top"> |
| 268 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.__setstate__">source code</a></span> |
| 269 | |
| 270 | </td> |
| 271 | </tr> |
| 272 | </table> |
| 273 | |
| 274 | </td> |
| 275 | </tr> |
| 276 | <tr class="private"> |
| 277 | <td width="15%" align="right" valign="top" class="summary"> |
| 278 | <span class="summary-type"> </span> |
| 279 | </td><td class="summary"> |
| 280 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 281 | <tr> |
| 282 | <td><span class="summary-sig"><a name="_generate_refresh_request_body"></a><span class="summary-sig-name">_generate_refresh_request_body</span>(<span class="summary-sig-arg">self</span>)</span><br /> |
| 283 | Generate the body that will be used in the refresh request.</td> |
| 284 | <td align="right" valign="top"> |
| 285 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._generate_refresh_request_body">source code</a></span> |
| 286 | |
| 287 | </td> |
| 288 | </tr> |
| 289 | </table> |
| 290 | |
| 291 | </td> |
| 292 | </tr> |
| 293 | <tr class="private"> |
| 294 | <td width="15%" align="right" valign="top" class="summary"> |
| 295 | <span class="summary-type"> </span> |
| 296 | </td><td class="summary"> |
| 297 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 298 | <tr> |
| 299 | <td><span class="summary-sig"><a name="_generate_refresh_request_headers"></a><span class="summary-sig-name">_generate_refresh_request_headers</span>(<span class="summary-sig-arg">self</span>)</span><br /> |
| 300 | Generate the headers that will be used in the refresh request.</td> |
| 301 | <td align="right" valign="top"> |
| 302 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._generate_refresh_request_headers">source code</a></span> |
| 303 | |
| 304 | </td> |
| 305 | </tr> |
| 306 | </table> |
| 307 | |
| 308 | </td> |
| 309 | </tr> |
| 310 | <tr class="private"> |
| 311 | <td width="15%" align="right" valign="top" class="summary"> |
| 312 | <span class="summary-type"> </span> |
| 313 | </td><td class="summary"> |
| 314 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 315 | <tr> |
| 316 | <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#_refresh" class="summary-sig-name" onclick="show_private();">_refresh</a>(<span class="summary-sig-arg">self</span>, |
| 317 | <span class="summary-sig-arg">http_request</span>)</span><br /> |
| 318 | Refreshes the access_token.</td> |
| 319 | <td align="right" valign="top"> |
| 320 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._refresh">source code</a></span> |
| 321 | |
| 322 | </td> |
| 323 | </tr> |
| 324 | </table> |
| 325 | |
| 326 | </td> |
| 327 | </tr> |
| 328 | <tr class="private"> |
| 329 | <td width="15%" align="right" valign="top" class="summary"> |
| 330 | <span class="summary-type"> </span> |
| 331 | </td><td class="summary"> |
| 332 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 333 | <tr> |
| 334 | <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#_do_refresh_request" class="summary-sig-name" onclick="show_private();">_do_refresh_request</a>(<span class="summary-sig-arg">self</span>, |
| 335 | <span class="summary-sig-arg">http_request</span>)</span><br /> |
| 336 | Refresh the access_token using the refresh_token.</td> |
| 337 | <td align="right" valign="top"> |
| 338 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._do_refresh_request">source code</a></span> |
| 339 | |
| 340 | </td> |
| 341 | </tr> |
| 342 | </table> |
| 343 | |
| 344 | </td> |
| 345 | </tr> |
| 346 | <tr> |
| 347 | <td colspan="2" class="summary"> |
| 348 | <div class="private"> <p class="indent-wrapped-lines"><b>Inherited from <code><a href="oauth2client.client.Credentials-class.html">Credentials</a></code></b> (private): |
| 349 | <code><a href="oauth2client.client.Credentials-class.html#_to_json" onclick="show_private();">_to_json</a></code> |
| 350 | </p></div> |
| 351 | <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| 352 | <code>__delattr__</code>, |
| 353 | <code>__format__</code>, |
| 354 | <code>__getattribute__</code>, |
| 355 | <code>__hash__</code>, |
| 356 | <code>__new__</code>, |
| 357 | <code>__reduce__</code>, |
| 358 | <code>__reduce_ex__</code>, |
| 359 | <code>__repr__</code>, |
| 360 | <code>__setattr__</code>, |
| 361 | <code>__sizeof__</code>, |
| 362 | <code>__str__</code>, |
| 363 | <code>__subclasshook__</code> |
| 364 | </p> |
| 365 | </td> |
| 366 | </tr> |
| 367 | </table> |
| 368 | <!-- ==================== CLASS METHODS ==================== --> |
| 369 | <a name="section-ClassMethods"></a> |
| 370 | <table class="summary" border="1" cellpadding="3" |
| 371 | cellspacing="0" width="100%" bgcolor="white"> |
| 372 | <tr bgcolor="#70b0f0" class="table-header"> |
| 373 | <td colspan="2" class="table-header"> |
| 374 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 375 | <tr valign="top"> |
| 376 | <td align="left"><span class="table-header">Class Methods</span></td> |
| 377 | <td align="right" valign="top" |
| 378 | ><span class="options">[<a href="#section-ClassMethods" |
| 379 | class="privatelink" onclick="toggle_private();" |
| 380 | >hide private</a>]</span></td> |
| 381 | </tr> |
| 382 | </table> |
| 383 | </td> |
| 384 | </tr> |
| 385 | <tr> |
| 386 | <td width="15%" align="right" valign="top" class="summary"> |
| 387 | <span class="summary-type"> </span> |
| 388 | </td><td class="summary"> |
| 389 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 390 | <tr> |
| 391 | <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#from_json" class="summary-sig-name">from_json</a>(<span class="summary-sig-arg">cls</span>, |
| 392 | <span class="summary-sig-arg">s</span>)</span><br /> |
| 393 | Instantiate a Credentials object from a JSON description of it.</td> |
| 394 | <td align="right" valign="top"> |
| 395 | <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.from_json">source code</a></span> |
| 396 | |
| 397 | </td> |
| 398 | </tr> |
| 399 | </table> |
| 400 | |
| 401 | </td> |
| 402 | </tr> |
| 403 | <tr> |
| 404 | <td colspan="2" class="summary"> |
| 405 | <p class="indent-wrapped-lines"><b>Inherited from <code><a href="oauth2client.client.Credentials-class.html">Credentials</a></code></b>: |
| 406 | <code><a href="oauth2client.client.Credentials-class.html#new_from_json">new_from_json</a></code> |
| 407 | </p> |
| 408 | </td> |
| 409 | </tr> |
| 410 | </table> |
| 411 | <!-- ==================== CLASS VARIABLES ==================== --> |
| 412 | <a name="section-ClassVariables"></a> |
| 413 | <table class="summary" border="1" cellpadding="3" |
| 414 | cellspacing="0" width="100%" bgcolor="white"> |
| 415 | <tr bgcolor="#70b0f0" class="table-header"> |
| 416 | <td colspan="2" class="table-header"> |
| 417 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 418 | <tr valign="top"> |
| 419 | <td align="left"><span class="table-header">Class Variables</span></td> |
| 420 | <td align="right" valign="top" |
| 421 | ><span class="options">[<a href="#section-ClassVariables" |
| 422 | class="privatelink" onclick="toggle_private();" |
| 423 | >hide private</a>]</span></td> |
| 424 | </tr> |
| 425 | </table> |
| 426 | </td> |
| 427 | </tr> |
| 428 | <tr> |
| 429 | <td colspan="2" class="summary"> |
| 430 | <p class="indent-wrapped-lines"><b>Inherited from <code><a href="oauth2client.client.Credentials-class.html">Credentials</a></code></b>: |
| 431 | <code><a href="oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS">NON_SERIALIZED_MEMBERS</a></code> |
| 432 | </p> |
| 433 | </td> |
| 434 | </tr> |
| 435 | </table> |
| 436 | <!-- ==================== PROPERTIES ==================== --> |
| 437 | <a name="section-Properties"></a> |
| 438 | <table class="summary" border="1" cellpadding="3" |
| 439 | cellspacing="0" width="100%" bgcolor="white"> |
| 440 | <tr bgcolor="#70b0f0" class="table-header"> |
| 441 | <td colspan="2" class="table-header"> |
| 442 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 443 | <tr valign="top"> |
| 444 | <td align="left"><span class="table-header">Properties</span></td> |
| 445 | <td align="right" valign="top" |
| 446 | ><span class="options">[<a href="#section-Properties" |
| 447 | class="privatelink" onclick="toggle_private();" |
| 448 | >hide private</a>]</span></td> |
| 449 | </tr> |
| 450 | </table> |
| 451 | </td> |
| 452 | </tr> |
| 453 | <tr> |
| 454 | <td width="15%" align="right" valign="top" class="summary"> |
| 455 | <span class="summary-type"> </span> |
| 456 | </td><td class="summary"> |
| 457 | <a href="oauth2client.client.OAuth2Credentials-class.html#access_token_expired" class="summary-name">access_token_expired</a><br /> |
| 458 | True if the credential is expired or invalid. |
| 459 | </td> |
| 460 | </tr> |
| 461 | <tr> |
| 462 | <td colspan="2" class="summary"> |
| 463 | <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| 464 | <code>__class__</code> |
| 465 | </p> |
| 466 | </td> |
| 467 | </tr> |
| 468 | </table> |
| 469 | <!-- ==================== METHOD DETAILS ==================== --> |
| 470 | <a name="section-MethodDetails"></a> |
| 471 | <table class="details" border="1" cellpadding="3" |
| 472 | cellspacing="0" width="100%" bgcolor="white"> |
| 473 | <tr bgcolor="#70b0f0" class="table-header"> |
| 474 | <td colspan="2" class="table-header"> |
| 475 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 476 | <tr valign="top"> |
| 477 | <td align="left"><span class="table-header">Method Details</span></td> |
| 478 | <td align="right" valign="top" |
| 479 | ><span class="options">[<a href="#section-MethodDetails" |
| 480 | class="privatelink" onclick="toggle_private();" |
| 481 | >hide private</a>]</span></td> |
| 482 | </tr> |
| 483 | </table> |
| 484 | </td> |
| 485 | </tr> |
| 486 | </table> |
| 487 | <a name="__init__"></a> |
| 488 | <div> |
| 489 | <table class="details" border="1" cellpadding="3" |
| 490 | cellspacing="0" width="100%" bgcolor="white"> |
| 491 | <tr><td> |
| 492 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 493 | <tr valign="top"><td> |
| 494 | <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>, |
| 495 | <span class="sig-arg">access_token</span>, |
| 496 | <span class="sig-arg">client_id</span>, |
| 497 | <span class="sig-arg">client_secret</span>, |
| 498 | <span class="sig-arg">refresh_token</span>, |
| 499 | <span class="sig-arg">token_expiry</span>, |
| 500 | <span class="sig-arg">token_uri</span>, |
| 501 | <span class="sig-arg">user_agent</span>, |
| 502 | <span class="sig-arg">id_token</span>=<span class="sig-default">None</span>)</span> |
| 503 | <br /><em class="fname">(Constructor)</em> |
| 504 | </h3> |
| 505 | </td><td align="right" valign="top" |
| 506 | ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.__init__">source code</a></span> |
| 507 | </td> |
| 508 | </tr></table> |
| 509 | |
| 510 | <pre class="literalblock"> |
| 511 | Create an instance of OAuth2Credentials. |
| 512 | |
| 513 | This constructor is not usually called by the user, instead |
| 514 | OAuth2Credentials objects are instantiated by the OAuth2WebServerFlow. |
| 515 | |
| 516 | Args: |
| 517 | access_token: string, access token. |
| 518 | client_id: string, client identifier. |
| 519 | client_secret: string, client secret. |
| 520 | refresh_token: string, refresh token. |
| 521 | token_expiry: datetime, when the access_token expires. |
| 522 | token_uri: string, URI of token endpoint. |
| 523 | user_agent: string, The HTTP User-Agent to provide for this application. |
| 524 | id_token: object, The identity of the resource owner. |
| 525 | |
| 526 | Notes: |
| 527 | store: callable, A callable that when passed a Credential |
| 528 | will store the credential back to where it came from. |
| 529 | This is needed to store the latest access_token if it |
| 530 | has expired and been refreshed. |
| 531 | |
| 532 | </pre> |
| 533 | <dl class="fields"> |
| 534 | <dt>Overrides: |
| 535 | object.__init__ |
| 536 | </dt> |
| 537 | </dl> |
| 538 | </td></tr></table> |
| 539 | </div> |
| 540 | <a name="authorize"></a> |
| 541 | <div> |
| 542 | <table class="details" border="1" cellpadding="3" |
| 543 | cellspacing="0" width="100%" bgcolor="white"> |
| 544 | <tr><td> |
| 545 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 546 | <tr valign="top"><td> |
| 547 | <h3 class="epydoc"><span class="sig"><span class="sig-name">authorize</span>(<span class="sig-arg">self</span>, |
| 548 | <span class="sig-arg">http</span>)</span> |
| 549 | </h3> |
| 550 | </td><td align="right" valign="top" |
| 551 | ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.authorize">source code</a></span> |
| 552 | </td> |
| 553 | </tr></table> |
| 554 | |
| 555 | <pre class="literalblock"> |
| 556 | Authorize an httplib2.Http instance with these credentials. |
| 557 | |
| 558 | The modified http.request method will add authentication headers to each |
| 559 | request and will refresh access_tokens when a 401 is received on a |
| 560 | request. In addition the http.request method has a credentials property, |
| 561 | http.request.credentials, which is the Credentials object that authorized |
| 562 | it. |
| 563 | |
| 564 | Args: |
| 565 | http: An instance of httplib2.Http |
| 566 | or something that acts like it. |
| 567 | |
| 568 | Returns: |
| 569 | A modified instance of http that was passed in. |
| 570 | |
| 571 | Example: |
| 572 | |
| 573 | h = httplib2.Http() |
| 574 | h = credentials.authorize(h) |
| 575 | |
| 576 | You can't create a new OAuth subclass of httplib2.Authenication |
| 577 | because it never gets passed the absolute URI, which is needed for |
| 578 | signing. So instead we have to overload 'request' with a closure |
| 579 | that adds in the Authorization header and then calls the original |
| 580 | version of 'request()'. |
| 581 | |
| 582 | </pre> |
| 583 | <dl class="fields"> |
| 584 | <dt>Overrides: |
| 585 | <a href="oauth2client.client.Credentials-class.html#authorize">Credentials.authorize</a> |
| 586 | </dt> |
| 587 | </dl> |
| 588 | </td></tr></table> |
| 589 | </div> |
| 590 | <a name="refresh"></a> |
| 591 | <div> |
| 592 | <table class="details" border="1" cellpadding="3" |
| 593 | cellspacing="0" width="100%" bgcolor="white"> |
| 594 | <tr><td> |
| 595 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 596 | <tr valign="top"><td> |
| 597 | <h3 class="epydoc"><span class="sig"><span class="sig-name">refresh</span>(<span class="sig-arg">self</span>, |
| 598 | <span class="sig-arg">http</span>)</span> |
| 599 | </h3> |
| 600 | </td><td align="right" valign="top" |
| 601 | ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.refresh">source code</a></span> |
| 602 | </td> |
| 603 | </tr></table> |
| 604 | |
| 605 | <pre class="literalblock"> |
| 606 | Forces a refresh of the access_token. |
| 607 | |
| 608 | Args: |
| 609 | http: httplib2.Http, an http object to be used to make the refresh |
| 610 | request. |
| 611 | |
| 612 | </pre> |
| 613 | <dl class="fields"> |
| 614 | <dt>Overrides: |
| 615 | <a href="oauth2client.client.Credentials-class.html#refresh">Credentials.refresh</a> |
| 616 | </dt> |
| 617 | </dl> |
| 618 | </td></tr></table> |
| 619 | </div> |
| 620 | <a name="apply"></a> |
| 621 | <div> |
| 622 | <table class="details" border="1" cellpadding="3" |
| 623 | cellspacing="0" width="100%" bgcolor="white"> |
| 624 | <tr><td> |
| 625 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 626 | <tr valign="top"><td> |
| 627 | <h3 class="epydoc"><span class="sig"><span class="sig-name">apply</span>(<span class="sig-arg">self</span>, |
| 628 | <span class="sig-arg">headers</span>)</span> |
| 629 | </h3> |
| 630 | </td><td align="right" valign="top" |
| 631 | ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.apply">source code</a></span> |
| 632 | </td> |
| 633 | </tr></table> |
| 634 | |
| 635 | <pre class="literalblock"> |
| 636 | Add the authorization to the headers. |
| 637 | |
| 638 | Args: |
| 639 | headers: dict, the headers to add the Authorization header to. |
| 640 | |
| 641 | </pre> |
| 642 | <dl class="fields"> |
| 643 | <dt>Overrides: |
| 644 | <a href="oauth2client.client.Credentials-class.html#apply">Credentials.apply</a> |
| 645 | </dt> |
| 646 | </dl> |
| 647 | </td></tr></table> |
| 648 | </div> |
| 649 | <a name="to_json"></a> |
| 650 | <div> |
| 651 | <table class="details" border="1" cellpadding="3" |
| 652 | cellspacing="0" width="100%" bgcolor="white"> |
| 653 | <tr><td> |
| 654 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 655 | <tr valign="top"><td> |
| 656 | <h3 class="epydoc"><span class="sig"><span class="sig-name">to_json</span>(<span class="sig-arg">self</span>)</span> |
| 657 | </h3> |
| 658 | </td><td align="right" valign="top" |
| 659 | ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.to_json">source code</a></span> |
| 660 | </td> |
| 661 | </tr></table> |
| 662 | |
| 663 | <pre class="literalblock"> |
| 664 | Creating a JSON representation of an instance of Credentials. |
| 665 | |
| 666 | Returns: |
| 667 | string, a JSON representation of this instance, suitable to pass to |
| 668 | from_json(). |
| 669 | |
| 670 | </pre> |
| 671 | <dl class="fields"> |
| 672 | <dt>Overrides: |
| 673 | <a href="oauth2client.client.Credentials-class.html#to_json">Credentials.to_json</a> |
| 674 | <dd><em class="note">(inherited documentation)</em></dd> |
| 675 | </dt> |
| 676 | </dl> |
| 677 | </td></tr></table> |
| 678 | </div> |
| 679 | <a name="from_json"></a> |
| 680 | <div> |
| 681 | <table class="details" border="1" cellpadding="3" |
| 682 | cellspacing="0" width="100%" bgcolor="white"> |
| 683 | <tr><td> |
| 684 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 685 | <tr valign="top"><td> |
| 686 | <h3 class="epydoc"><span class="sig"><span class="sig-name">from_json</span>(<span class="sig-arg">cls</span>, |
| 687 | <span class="sig-arg">s</span>)</span> |
| 688 | <br /><em class="fname">Class Method</em> |
| 689 | </h3> |
| 690 | </td><td align="right" valign="top" |
| 691 | ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.from_json">source code</a></span> |
| 692 | </td> |
| 693 | </tr></table> |
| 694 | |
| 695 | <pre class="literalblock"> |
| 696 | Instantiate a Credentials object from a JSON description of it. The JSON |
| 697 | should have been produced by calling .to_json() on the object. |
| 698 | |
| 699 | Args: |
| 700 | data: dict, A deserialized JSON object. |
| 701 | |
| 702 | Returns: |
| 703 | An instance of a Credentials subclass. |
| 704 | |
| 705 | </pre> |
| 706 | <dl class="fields"> |
| 707 | <dt>Overrides: |
| 708 | <a href="oauth2client.client.Credentials-class.html#from_json">Credentials.from_json</a> |
| 709 | </dt> |
| 710 | </dl> |
| 711 | </td></tr></table> |
| 712 | </div> |
| 713 | <a name="set_store"></a> |
| 714 | <div> |
| 715 | <table class="details" border="1" cellpadding="3" |
| 716 | cellspacing="0" width="100%" bgcolor="white"> |
| 717 | <tr><td> |
| 718 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 719 | <tr valign="top"><td> |
| 720 | <h3 class="epydoc"><span class="sig"><span class="sig-name">set_store</span>(<span class="sig-arg">self</span>, |
| 721 | <span class="sig-arg">store</span>)</span> |
| 722 | </h3> |
| 723 | </td><td align="right" valign="top" |
| 724 | ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.set_store">source code</a></span> |
| 725 | </td> |
| 726 | </tr></table> |
| 727 | |
| 728 | <pre class="literalblock"> |
| 729 | Set the Storage for the credential. |
| 730 | |
| 731 | Args: |
| 732 | store: Storage, an implementation of Stroage object. |
| 733 | This is needed to store the latest access_token if it |
| 734 | has expired and been refreshed. This implementation uses |
| 735 | locking to check for updates before updating the |
| 736 | access_token. |
| 737 | |
| 738 | </pre> |
| 739 | <dl class="fields"> |
| 740 | </dl> |
| 741 | </td></tr></table> |
| 742 | </div> |
| 743 | <a name="_refresh"></a> |
| 744 | <div class="private"> |
| 745 | <table class="details" border="1" cellpadding="3" |
| 746 | cellspacing="0" width="100%" bgcolor="white"> |
| 747 | <tr><td> |
| 748 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 749 | <tr valign="top"><td> |
| 750 | <h3 class="epydoc"><span class="sig"><span class="sig-name">_refresh</span>(<span class="sig-arg">self</span>, |
| 751 | <span class="sig-arg">http_request</span>)</span> |
| 752 | </h3> |
| 753 | </td><td align="right" valign="top" |
| 754 | ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._refresh">source code</a></span> |
| 755 | </td> |
| 756 | </tr></table> |
| 757 | |
| 758 | <pre class="literalblock"> |
| 759 | Refreshes the access_token. |
| 760 | |
| 761 | This method first checks by reading the Storage object if available. |
| 762 | If a refresh is still needed, it holds the Storage lock until the |
| 763 | refresh is completed. |
| 764 | |
| 765 | Args: |
| 766 | http_request: callable, a callable that matches the method signature of |
| 767 | httplib2.Http.request, used to make the refresh request. |
| 768 | |
| 769 | Raises: |
| 770 | AccessTokenRefreshError: When the refresh fails. |
| 771 | |
| 772 | </pre> |
| 773 | <dl class="fields"> |
| 774 | </dl> |
| 775 | </td></tr></table> |
| 776 | </div> |
| 777 | <a name="_do_refresh_request"></a> |
| 778 | <div class="private"> |
| 779 | <table class="details" border="1" cellpadding="3" |
| 780 | cellspacing="0" width="100%" bgcolor="white"> |
| 781 | <tr><td> |
| 782 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 783 | <tr valign="top"><td> |
| 784 | <h3 class="epydoc"><span class="sig"><span class="sig-name">_do_refresh_request</span>(<span class="sig-arg">self</span>, |
| 785 | <span class="sig-arg">http_request</span>)</span> |
| 786 | </h3> |
| 787 | </td><td align="right" valign="top" |
| 788 | ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._do_refresh_request">source code</a></span> |
| 789 | </td> |
| 790 | </tr></table> |
| 791 | |
| 792 | <pre class="literalblock"> |
| 793 | Refresh the access_token using the refresh_token. |
| 794 | |
| 795 | Args: |
| 796 | http_request: callable, a callable that matches the method signature of |
| 797 | httplib2.Http.request, used to make the refresh request. |
| 798 | |
| 799 | Raises: |
| 800 | AccessTokenRefreshError: When the refresh fails. |
| 801 | |
| 802 | </pre> |
| 803 | <dl class="fields"> |
| 804 | </dl> |
| 805 | </td></tr></table> |
| 806 | </div> |
| 807 | <br /> |
| 808 | <!-- ==================== PROPERTY DETAILS ==================== --> |
| 809 | <a name="section-PropertyDetails"></a> |
| 810 | <table class="details" border="1" cellpadding="3" |
| 811 | cellspacing="0" width="100%" bgcolor="white"> |
| 812 | <tr bgcolor="#70b0f0" class="table-header"> |
| 813 | <td colspan="2" class="table-header"> |
| 814 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 815 | <tr valign="top"> |
| 816 | <td align="left"><span class="table-header">Property Details</span></td> |
| 817 | <td align="right" valign="top" |
| 818 | ><span class="options">[<a href="#section-PropertyDetails" |
| 819 | class="privatelink" onclick="toggle_private();" |
| 820 | >hide private</a>]</span></td> |
| 821 | </tr> |
| 822 | </table> |
| 823 | </td> |
| 824 | </tr> |
| 825 | </table> |
| 826 | <a name="access_token_expired"></a> |
| 827 | <div> |
| 828 | <table class="details" border="1" cellpadding="3" |
| 829 | cellspacing="0" width="100%" bgcolor="white"> |
| 830 | <tr><td> |
| 831 | <h3 class="epydoc">access_token_expired</h3> |
| 832 | <pre class="literalblock"> |
| 833 | True if the credential is expired or invalid. |
| 834 | |
| 835 | If the token_expiry isn't set, we assume the token doesn't expire. |
| 836 | |
| 837 | </pre> |
| 838 | <dl class="fields"> |
| 839 | <dt>Get Method:</dt> |
| 840 | <dd class="value"><span class="summary-sig"><i>unreachable</i>.access_token_expired(<span class="summary-sig-arg">self</span>)</span> |
| 841 | - True if the credential is expired or invalid. |
| 842 | </dd> |
| 843 | </dl> |
| 844 | </td></tr></table> |
| 845 | </div> |
| 846 | <br /> |
| 847 | <!-- ==================== NAVIGATION BAR ==================== --> |
| 848 | <table class="navbar" border="0" width="100%" cellpadding="0" |
| 849 | bgcolor="#a0c0ff" cellspacing="0"> |
| 850 | <tr valign="middle"> |
| 851 | |
| 852 | <!-- Tree link --> |
| 853 | <th> <a |
| 854 | href="module-tree.html">Trees</a> </th> |
| 855 | |
| 856 | <!-- Index link --> |
| 857 | <th> <a |
| 858 | href="identifier-index.html">Indices</a> </th> |
| 859 | |
| 860 | <!-- Help link --> |
| 861 | <th> <a |
| 862 | href="help.html">Help</a> </th> |
| 863 | |
| 864 | <th class="navbar" width="100%"></th> |
| 865 | </tr> |
| 866 | </table> |
| 867 | <table border="0" cellpadding="0" cellspacing="0" width="100%%"> |
| 868 | <tr> |
| 869 | <td align="left" class="footer"> |
Joe Gregorio | 6621203 | 2012-06-14 09:10:14 -0400 | [diff] [blame] | 870 | Generated by Epydoc 3.0.1 on Thu Jun 14 08:01:57 2012 |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 871 | </td> |
| 872 | <td align="right" class="footer"> |
| 873 | <a target="mainFrame" href="http://epydoc.sourceforge.net" |
| 874 | >http://epydoc.sourceforge.net</a> |
| 875 | </td> |
| 876 | </tr> |
| 877 | </table> |
| 878 | |
| 879 | <script type="text/javascript"> |
| 880 | <!-- |
| 881 | // Private objects are initially displayed (because if |
| 882 | // javascript is turned off then we want them to be |
| 883 | // visible); but by default, we want to hide them. So hide |
| 884 | // them unless we have a cookie that says to show them. |
| 885 | checkCookie(); |
| 886 | // --> |
| 887 | </script> |
| 888 | </body> |
| 889 | </html> |