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 | 6621203 | 2012-06-14 09:10:14 -0400 | [diff] [blame] | 11 | ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/jcgregorio/projects/clean/oauth2client/client.py">/home/jcgregorio/projects/clean/oauth2client/client.py</a></font></td></tr></table> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 12 | <p><tt>An OAuth 2.0 client.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 13 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 14 | Tools for interacting with OAuth 2.0 protected resources.</tt></p> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 15 | <p> |
| 16 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 17 | <tr bgcolor="#aa55cc"> |
| 18 | <td colspan=3 valign=bottom> <br> |
| 19 | <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> |
| 20 | |
| 21 | <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 22 | <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="base64.html">base64</a><br> |
| 23 | <a href="oauth2client.clientsecrets.html">oauth2client.clientsecrets</a><br> |
Joe Gregorio | 761c456 | 2011-10-28 14:36:24 -0400 | [diff] [blame] | 24 | <a href="copy.html">copy</a><br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 25 | </td><td width="25%" valign=top><a href="datetime.html">datetime</a><br> |
| 26 | <a href="httplib2.html">httplib2</a><br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 27 | <a href="logging.html">logging</a><br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 28 | </td><td width="25%" valign=top><a href="os.html">os</a><br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 29 | <a href="json.html">json</a><br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 30 | <a href="sys.html">sys</a><br> |
| 31 | </td><td width="25%" valign=top><a href="time.html">time</a><br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 32 | <a href="urllib.html">urllib</a><br> |
Joe Gregorio | 761c456 | 2011-10-28 14:36:24 -0400 | [diff] [blame] | 33 | <a href="urlparse.html">urlparse</a><br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 34 | </td></tr></table></td></tr></table><p> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 35 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 36 | <tr bgcolor="#ee77aa"> |
| 37 | <td colspan=3 valign=bottom> <br> |
| 38 | <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> |
| 39 | |
| 40 | <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> |
| 41 | <td width="100%"><dl> |
| 42 | <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> |
| 43 | </font></dt><dd> |
| 44 | <dl> |
| 45 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Credentials">Credentials</a> |
| 46 | </font></dt><dd> |
| 47 | <dl> |
| 48 | <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] | 49 | </font></dt><dd> |
| 50 | <dl> |
| 51 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#AccessTokenCredentials">AccessTokenCredentials</a> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 52 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.client.html#AssertionCredentials">AssertionCredentials</a> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 53 | </font></dt><dd> |
| 54 | <dl> |
| 55 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#SignedJwtAssertionCredentials">SignedJwtAssertionCredentials</a> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 56 | </font></dt></dl> |
| 57 | </dd> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 58 | </dl> |
| 59 | </dd> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 60 | </dl> |
| 61 | </dd> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 62 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Flow">Flow</a> |
| 63 | </font></dt><dd> |
| 64 | <dl> |
| 65 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#OAuth2WebServerFlow">OAuth2WebServerFlow</a> |
| 66 | </font></dt></dl> |
| 67 | </dd> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 68 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#MemoryCache">MemoryCache</a> |
| 69 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.client.html#Storage">Storage</a> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 70 | </font></dt></dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 71 | </dd> |
| 72 | <dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>) |
| 73 | </font></dt><dd> |
| 74 | <dl> |
| 75 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Error">Error</a> |
| 76 | </font></dt><dd> |
| 77 | <dl> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 78 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#AccessTokenCredentialsError">AccessTokenCredentialsError</a> |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 79 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.client.html#AccessTokenRefreshError">AccessTokenRefreshError</a> |
| 80 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.client.html#FlowExchangeError">FlowExchangeError</a> |
Joe Gregorio | 761c456 | 2011-10-28 14:36:24 -0400 | [diff] [blame] | 81 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.client.html#UnknownClientSecretsFlowError">UnknownClientSecretsFlowError</a> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 82 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.client.html#VerifyJwtTokenError">VerifyJwtTokenError</a> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 83 | </font></dt></dl> |
| 84 | </dd> |
| 85 | </dl> |
| 86 | </dd> |
| 87 | </dl> |
| 88 | <p> |
| 89 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 90 | <tr bgcolor="#ffc8d8"> |
| 91 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 92 | <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> |
| 93 | |
| 94 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 95 | <td colspan=2><tt><a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> for OAuth 2.0.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 96 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 97 | <a href="#Credentials">Credentials</a> can be applied to an httplib2.Http <a href="__builtin__.html#object">object</a> using the<br> |
| 98 | <a href="#AccessTokenCredentials-authorize">authorize</a>() method, which then signs each request from that <a href="__builtin__.html#object">object</a><br> |
| 99 | with the OAuth 2.0 access token. This set of credentials is for the<br> |
| 100 | use case where you have acquired an OAuth 2.0 access_token from<br> |
| 101 | another place such as a JavaScript client or another web<br> |
| 102 | application, and wish to use it from Python. Because only the<br> |
| 103 | access_token is present it can not be refreshed and will in time<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 104 | expire.<br> |
| 105 | <br> |
Joe Gregorio | fffa7d7 | 2011-02-18 17:20:39 -0500 | [diff] [blame] | 106 | <a href="#AccessTokenCredentials">AccessTokenCredentials</a> objects may be safely pickled and unpickled.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 107 | <br> |
| 108 | Usage:<br> |
| 109 | credentials = <a href="#AccessTokenCredentials">AccessTokenCredentials</a>('<an access token>',<br> |
| 110 | 'my-user-agent/1.0')<br> |
| 111 | http = httplib2.Http()<br> |
| 112 | http = credentials.<a href="#AccessTokenCredentials-authorize">authorize</a>(http)<br> |
| 113 | <br> |
| 114 | Exceptions:<br> |
| 115 | AccessTokenCredentialsExpired: raised when the access_token expires or is<br> |
| 116 | revoked.<br> </tt></td></tr> |
| 117 | <tr><td> </td> |
| 118 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 119 | <dd><a href="oauth2client.client.html#AccessTokenCredentials">AccessTokenCredentials</a></dd> |
| 120 | <dd><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a></dd> |
| 121 | <dd><a href="oauth2client.client.html#Credentials">Credentials</a></dd> |
| 122 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 123 | </dl> |
| 124 | <hr> |
| 125 | Methods defined here:<br> |
| 126 | <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> |
| 127 | <br> |
| 128 | This is one of the few types if <a href="#Credentials">Credentials</a> that you should contrust,<br> |
| 129 | <a href="#Credentials">Credentials</a> objects are usually instantiated by a <a href="#Flow">Flow</a>.<br> |
| 130 | <br> |
| 131 | Args:<br> |
Joe Gregorio | 9384170 | 2011-03-02 16:12:05 -0800 | [diff] [blame] | 132 | access_token: string, access token.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 133 | user_agent: string, The HTTP User-Agent to provide for this application.<br> |
| 134 | <br> |
| 135 | Notes:<br> |
| 136 | store: callable, a callable that when passed a Credential<br> |
| 137 | will store the credential back to where it came from.</tt></dd></dl> |
| 138 | |
| 139 | <hr> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 140 | Class methods defined here:<br> |
| 141 | <dl><dt><a name="AccessTokenCredentials-from_json"><strong>from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt></dl> |
| 142 | |
| 143 | <hr> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 144 | Methods inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
| 145 | <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> |
| 146 | |
| 147 | <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> |
| 148 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 149 | <dl><dt><a name="AccessTokenCredentials-apply"><strong>apply</strong></a>(self, headers)</dt><dd><tt>Add the authorization to the headers.<br> |
| 150 | <br> |
| 151 | Args:<br> |
| 152 | headers: dict, the headers to add the Authorization header to.</tt></dd></dl> |
| 153 | |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 154 | <dl><dt><a name="AccessTokenCredentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Authorize an httplib2.Http instance with these credentials.<br> |
| 155 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 156 | The modified http.request method will add authentication headers to each<br> |
| 157 | request and will refresh access_tokens when a 401 is received on a<br> |
| 158 | request. In addition the http.request method has a credentials property,<br> |
| 159 | http.request.credentials, which is the <a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> that authorized<br> |
| 160 | it.<br> |
| 161 | <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 162 | Args:<br> |
| 163 | http: An instance of httplib2.Http<br> |
| 164 | or something that acts like it.<br> |
| 165 | <br> |
| 166 | Returns:<br> |
| 167 | A modified instance of http that was passed in.<br> |
| 168 | <br> |
| 169 | Example:<br> |
| 170 | <br> |
| 171 | h = httplib2.Http()<br> |
| 172 | h = credentials.<a href="#AccessTokenCredentials-authorize">authorize</a>(h)<br> |
| 173 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 174 | You can't create a new OAuth subclass of httplib2.Authenication<br> |
| 175 | because it never gets passed the absolute URI, which is needed for<br> |
| 176 | signing. So instead we have to overload 'request' with a closure<br> |
| 177 | that adds in the Authorization header and then calls the original<br> |
| 178 | version of 'request()'.</tt></dd></dl> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 179 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 180 | <dl><dt><a name="AccessTokenCredentials-refresh"><strong>refresh</strong></a>(self, http)</dt><dd><tt>Forces a refresh of the access_token.<br> |
| 181 | <br> |
| 182 | Args:<br> |
| 183 | http: httplib2.Http, an http <a href="__builtin__.html#object">object</a> to be used to make the refresh<br> |
| 184 | request.</tt></dd></dl> |
| 185 | |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 186 | <dl><dt><a name="AccessTokenCredentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set the <a href="#Storage">Storage</a> for the credential.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 187 | <br> |
| 188 | Args:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 189 | store: <a href="#Storage">Storage</a>, an implementation of Stroage <a href="__builtin__.html#object">object</a>.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 190 | This is needed to store the latest access_token if it<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 191 | has expired and been refreshed. This implementation uses<br> |
| 192 | locking to check for updates before updating the<br> |
| 193 | access_token.</tt></dd></dl> |
| 194 | |
| 195 | <dl><dt><a name="AccessTokenCredentials-to_json"><strong>to_json</strong></a>(self)</dt></dl> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 196 | |
| 197 | <hr> |
Joe Gregorio | 9ce4b62 | 2011-02-17 15:32:11 -0500 | [diff] [blame] | 198 | Data descriptors inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 199 | <dl><dt><strong>access_token_expired</strong></dt> |
| 200 | <dd><tt>True if the credential is expired or invalid.<br> |
| 201 | <br> |
| 202 | If the token_expiry isn't set, we assume the token doesn't expire.</tt></dd> |
Joe Gregorio | 9ce4b62 | 2011-02-17 15:32:11 -0500 | [diff] [blame] | 203 | </dl> |
| 204 | <hr> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 205 | Class methods inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 206 | <dl><dt><a name="AccessTokenCredentials-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility class method to instantiate a <a href="#Credentials">Credentials</a> subclass from a JSON<br> |
| 207 | representation produced by <a href="#AccessTokenCredentials-to_json">to_json</a>().<br> |
| 208 | <br> |
| 209 | Args:<br> |
| 210 | s: string, JSON from <a href="#AccessTokenCredentials-to_json">to_json</a>().<br> |
| 211 | <br> |
| 212 | Returns:<br> |
| 213 | An instance of the subclass of <a href="#Credentials">Credentials</a> that was serialized with<br> |
| 214 | <a href="#AccessTokenCredentials-to_json">to_json</a>().</tt></dd></dl> |
| 215 | |
| 216 | <hr> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 217 | Data descriptors inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 218 | <dl><dt><strong>__dict__</strong></dt> |
| 219 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 220 | </dl> |
| 221 | <dl><dt><strong>__weakref__</strong></dt> |
| 222 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 223 | </dl> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 224 | <hr> |
| 225 | Data and other attributes inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 226 | <dl><dt><strong>NON_SERIALIZED_MEMBERS</strong> = ['store']</dl> |
| 227 | |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 228 | </td></tr></table> <p> |
| 229 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 230 | <tr bgcolor="#ffc8d8"> |
| 231 | <td colspan=3 valign=bottom> <br> |
| 232 | <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> |
| 233 | |
| 234 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 235 | <td colspan=2><tt>Having only the access_token means no refresh is possible.<br> </tt></td></tr> |
| 236 | <tr><td> </td> |
| 237 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 238 | <dd><a href="oauth2client.client.html#AccessTokenCredentialsError">AccessTokenCredentialsError</a></dd> |
| 239 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 240 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 241 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 242 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 243 | </dl> |
| 244 | <hr> |
| 245 | Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br> |
| 246 | <dl><dt><strong>__weakref__</strong></dt> |
| 247 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 248 | </dl> |
| 249 | <hr> |
| 250 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 251 | <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> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 252 | |
| 253 | <hr> |
| 254 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 255 | <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> |
| 256 | |
| 257 | <hr> |
| 258 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 259 | <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> |
| 260 | |
| 261 | <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> |
| 262 | |
| 263 | <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> |
| 264 | |
| 265 | <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> |
| 266 | <br> |
| 267 | Use of negative indices is not supported.</tt></dd></dl> |
| 268 | |
| 269 | <dl><dt><a name="AccessTokenCredentialsError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 270 | |
| 271 | <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> |
| 272 | |
| 273 | <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> |
| 274 | |
| 275 | <dl><dt><a name="AccessTokenCredentialsError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 276 | |
| 277 | <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> |
| 278 | |
| 279 | <dl><dt><a name="AccessTokenCredentialsError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 280 | |
| 281 | <hr> |
| 282 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 283 | <dl><dt><strong>__dict__</strong></dt> |
| 284 | </dl> |
| 285 | <dl><dt><strong>args</strong></dt> |
| 286 | </dl> |
| 287 | <dl><dt><strong>message</strong></dt> |
| 288 | </dl> |
| 289 | </td></tr></table> <p> |
| 290 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 291 | <tr bgcolor="#ffc8d8"> |
| 292 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 293 | <font color="#000000" face="helvetica, arial"><a name="AccessTokenRefreshError">class <strong>AccessTokenRefreshError</strong></a>(<a href="oauth2client.client.html#Error">Error</a>)</font></td></tr> |
| 294 | |
| 295 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | ad258e2 | 2011-02-22 22:53:30 -0500 | [diff] [blame] | 296 | <td colspan=2><tt><a href="#Error">Error</a> trying to refresh an expired access token.<br> </tt></td></tr> |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 297 | <tr><td> </td> |
| 298 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 299 | <dd><a href="oauth2client.client.html#AccessTokenRefreshError">AccessTokenRefreshError</a></dd> |
| 300 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 301 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 302 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 303 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 304 | </dl> |
| 305 | <hr> |
| 306 | Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br> |
| 307 | <dl><dt><strong>__weakref__</strong></dt> |
| 308 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 309 | </dl> |
| 310 | <hr> |
| 311 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 312 | <dl><dt><a name="AccessTokenRefreshError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenRefreshError-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl> |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 313 | |
| 314 | <hr> |
| 315 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 316 | <dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#AccessTokenRefreshError-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> |
| 317 | |
| 318 | <hr> |
| 319 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 320 | <dl><dt><a name="AccessTokenRefreshError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenRefreshError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> |
| 321 | |
| 322 | <dl><dt><a name="AccessTokenRefreshError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenRefreshError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> |
| 323 | |
| 324 | <dl><dt><a name="AccessTokenRefreshError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenRefreshError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> |
| 325 | |
| 326 | <dl><dt><a name="AccessTokenRefreshError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenRefreshError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> |
| 327 | <br> |
| 328 | Use of negative indices is not supported.</tt></dd></dl> |
| 329 | |
| 330 | <dl><dt><a name="AccessTokenRefreshError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 331 | |
| 332 | <dl><dt><a name="AccessTokenRefreshError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenRefreshError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> |
| 333 | |
| 334 | <dl><dt><a name="AccessTokenRefreshError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenRefreshError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> |
| 335 | |
| 336 | <dl><dt><a name="AccessTokenRefreshError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 337 | |
| 338 | <dl><dt><a name="AccessTokenRefreshError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#AccessTokenRefreshError-__str__">__str__</a>() <==> str(x)</tt></dd></dl> |
| 339 | |
| 340 | <dl><dt><a name="AccessTokenRefreshError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 341 | |
| 342 | <hr> |
| 343 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 344 | <dl><dt><strong>__dict__</strong></dt> |
| 345 | </dl> |
| 346 | <dl><dt><strong>args</strong></dt> |
| 347 | </dl> |
| 348 | <dl><dt><strong>message</strong></dt> |
| 349 | </dl> |
| 350 | </td></tr></table> <p> |
| 351 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 352 | <tr bgcolor="#ffc8d8"> |
| 353 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 354 | <font color="#000000" face="helvetica, arial"><a name="AssertionCredentials">class <strong>AssertionCredentials</strong></a>(<a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>)</font></td></tr> |
| 355 | |
| 356 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 357 | <td colspan=2><tt>Abstract <a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> used for OAuth 2.0 assertion grants.<br> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 358 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 359 | This credential does not require a flow to instantiate because it<br> |
| 360 | represents a two legged flow, and therefore has all of the required<br> |
| 361 | information to generate and refresh its own access tokens. It must<br> |
| 362 | be subclassed to generate the appropriate assertion string.<br> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 363 | <br> |
| 364 | <a href="#AssertionCredentials">AssertionCredentials</a> objects may be safely pickled and unpickled.<br> </tt></td></tr> |
| 365 | <tr><td> </td> |
| 366 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 367 | <dd><a href="oauth2client.client.html#AssertionCredentials">AssertionCredentials</a></dd> |
| 368 | <dd><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a></dd> |
| 369 | <dd><a href="oauth2client.client.html#Credentials">Credentials</a></dd> |
| 370 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 371 | </dl> |
| 372 | <hr> |
| 373 | Methods defined here:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 374 | <dl><dt><a name="AssertionCredentials-__init__"><strong>__init__</strong></a>(self, assertion_type, user_agent, token_uri<font color="#909090">='https://accounts.google.com/o/oauth2/token'</font>, **unused_kwargs)</dt><dd><tt>Constructor for AssertionFlowCredentials.<br> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 375 | <br> |
| 376 | Args:<br> |
| 377 | assertion_type: string, assertion type that will be declared to the auth<br> |
| 378 | server<br> |
| 379 | user_agent: string, The HTTP User-Agent to provide for this application.<br> |
| 380 | token_uri: string, URI for token endpoint. For convenience<br> |
| 381 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.</tt></dd></dl> |
| 382 | |
| 383 | <hr> |
| 384 | Methods inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
| 385 | <dl><dt><a name="AssertionCredentials-__getstate__"><strong>__getstate__</strong></a>(self)</dt><dd><tt>Trim the state down to something that can be pickled.</tt></dd></dl> |
| 386 | |
| 387 | <dl><dt><a name="AssertionCredentials-__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> |
| 388 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 389 | <dl><dt><a name="AssertionCredentials-apply"><strong>apply</strong></a>(self, headers)</dt><dd><tt>Add the authorization to the headers.<br> |
| 390 | <br> |
| 391 | Args:<br> |
| 392 | headers: dict, the headers to add the Authorization header to.</tt></dd></dl> |
| 393 | |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 394 | <dl><dt><a name="AssertionCredentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Authorize an httplib2.Http instance with these credentials.<br> |
| 395 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 396 | The modified http.request method will add authentication headers to each<br> |
| 397 | request and will refresh access_tokens when a 401 is received on a<br> |
| 398 | request. In addition the http.request method has a credentials property,<br> |
| 399 | http.request.credentials, which is the <a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> that authorized<br> |
| 400 | it.<br> |
| 401 | <br> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 402 | Args:<br> |
| 403 | http: An instance of httplib2.Http<br> |
| 404 | or something that acts like it.<br> |
| 405 | <br> |
| 406 | Returns:<br> |
| 407 | A modified instance of http that was passed in.<br> |
| 408 | <br> |
| 409 | Example:<br> |
| 410 | <br> |
| 411 | h = httplib2.Http()<br> |
| 412 | h = credentials.<a href="#AssertionCredentials-authorize">authorize</a>(h)<br> |
| 413 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 414 | You can't create a new OAuth subclass of httplib2.Authenication<br> |
| 415 | because it never gets passed the absolute URI, which is needed for<br> |
| 416 | signing. So instead we have to overload 'request' with a closure<br> |
| 417 | that adds in the Authorization header and then calls the original<br> |
| 418 | version of 'request()'.</tt></dd></dl> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 419 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 420 | <dl><dt><a name="AssertionCredentials-refresh"><strong>refresh</strong></a>(self, http)</dt><dd><tt>Forces a refresh of the access_token.<br> |
| 421 | <br> |
| 422 | Args:<br> |
| 423 | http: httplib2.Http, an http <a href="__builtin__.html#object">object</a> to be used to make the refresh<br> |
| 424 | request.</tt></dd></dl> |
| 425 | |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 426 | <dl><dt><a name="AssertionCredentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set the <a href="#Storage">Storage</a> for the credential.<br> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 427 | <br> |
| 428 | Args:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 429 | store: <a href="#Storage">Storage</a>, an implementation of Stroage <a href="__builtin__.html#object">object</a>.<br> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 430 | This is needed to store the latest access_token if it<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 431 | has expired and been refreshed. This implementation uses<br> |
| 432 | locking to check for updates before updating the<br> |
| 433 | access_token.</tt></dd></dl> |
| 434 | |
| 435 | <dl><dt><a name="AssertionCredentials-to_json"><strong>to_json</strong></a>(self)</dt></dl> |
| 436 | |
| 437 | <hr> |
| 438 | Class methods inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
| 439 | <dl><dt><a name="AssertionCredentials-from_json"><strong>from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Instantiate a <a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> from a JSON description of it. The JSON<br> |
| 440 | should have been produced by calling .<a href="#AssertionCredentials-to_json">to_json</a>() on the <a href="__builtin__.html#object">object</a>.<br> |
| 441 | <br> |
| 442 | Args:<br> |
| 443 | data: dict, A deserialized JSON <a href="__builtin__.html#object">object</a>.<br> |
| 444 | <br> |
| 445 | Returns:<br> |
| 446 | An instance of a <a href="#Credentials">Credentials</a> subclass.</tt></dd></dl> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 447 | |
| 448 | <hr> |
| 449 | Data descriptors inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 450 | <dl><dt><strong>access_token_expired</strong></dt> |
| 451 | <dd><tt>True if the credential is expired or invalid.<br> |
| 452 | <br> |
| 453 | If the token_expiry isn't set, we assume the token doesn't expire.</tt></dd> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 454 | </dl> |
| 455 | <hr> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 456 | Class methods inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 457 | <dl><dt><a name="AssertionCredentials-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility class method to instantiate a <a href="#Credentials">Credentials</a> subclass from a JSON<br> |
| 458 | representation produced by <a href="#AssertionCredentials-to_json">to_json</a>().<br> |
| 459 | <br> |
| 460 | Args:<br> |
| 461 | s: string, JSON from <a href="#AssertionCredentials-to_json">to_json</a>().<br> |
| 462 | <br> |
| 463 | Returns:<br> |
| 464 | An instance of the subclass of <a href="#Credentials">Credentials</a> that was serialized with<br> |
| 465 | <a href="#AssertionCredentials-to_json">to_json</a>().</tt></dd></dl> |
| 466 | |
| 467 | <hr> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 468 | Data descriptors inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 469 | <dl><dt><strong>__dict__</strong></dt> |
| 470 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 471 | </dl> |
| 472 | <dl><dt><strong>__weakref__</strong></dt> |
| 473 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 474 | </dl> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 475 | <hr> |
| 476 | Data and other attributes inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 477 | <dl><dt><strong>NON_SERIALIZED_MEMBERS</strong> = ['store']</dl> |
| 478 | |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 479 | </td></tr></table> <p> |
| 480 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 481 | <tr bgcolor="#ffc8d8"> |
| 482 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 483 | <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> |
| 484 | |
| 485 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 486 | <td colspan=2><tt>Base class for all <a href="#Credentials">Credentials</a> objects.<br> |
| 487 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 488 | Subclasses must define an <a href="#Credentials-authorize">authorize</a>() method that applies the credentials to<br> |
| 489 | an HTTP transport.<br> |
| 490 | <br> |
| 491 | Subclasses must also specify a classmethod named 'from_json' that takes a JSON<br> |
Joe Gregorio | d02bf5e | 2012-03-02 13:21:32 -0800 | [diff] [blame] | 492 | string as input and returns an instaniated <a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a>.<br> </tt></td></tr> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 493 | <tr><td> </td> |
| 494 | <td width="100%">Methods defined here:<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 495 | <dl><dt><a name="Credentials-apply"><strong>apply</strong></a>(self, headers)</dt><dd><tt>Add the authorization to the headers.<br> |
| 496 | <br> |
| 497 | Args:<br> |
| 498 | headers: dict, the headers to add the Authorization header to.</tt></dd></dl> |
| 499 | |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 500 | <dl><dt><a name="Credentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Take an httplib2.Http instance (or equivalent) and<br> |
| 501 | authorizes it for the set of credentials, usually by<br> |
| 502 | replacing http.request() with a method that adds in<br> |
| 503 | the appropriate headers and then delegates to the original<br> |
| 504 | Http.request() method.</tt></dd></dl> |
| 505 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 506 | <dl><dt><a name="Credentials-refresh"><strong>refresh</strong></a>(self, http)</dt><dd><tt>Forces a refresh of the access_token.<br> |
| 507 | <br> |
| 508 | Args:<br> |
| 509 | http: httplib2.Http, an http <a href="__builtin__.html#object">object</a> to be used to make the refresh<br> |
| 510 | request.</tt></dd></dl> |
| 511 | |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 512 | <dl><dt><a name="Credentials-to_json"><strong>to_json</strong></a>(self)</dt><dd><tt>Creating a JSON representation of an instance of <a href="#Credentials">Credentials</a>.<br> |
| 513 | <br> |
| 514 | Returns:<br> |
| 515 | string, a JSON representation of this instance, suitable to pass to<br> |
Joe Gregorio | 6121dd9 | 2012-04-13 07:50:04 -0400 | [diff] [blame] | 516 | <a href="#Credentials-from_json">from_json</a>().</tt></dd></dl> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 517 | |
| 518 | <hr> |
| 519 | Class methods defined here:<br> |
Joe Gregorio | 6621203 | 2012-06-14 09:10:14 -0400 | [diff] [blame] | 520 | <dl><dt><a name="Credentials-from_json"><strong>from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Instantiate a <a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> from a JSON description of it.<br> |
| 521 | <br> |
| 522 | The JSON should have been produced by calling .<a href="#Credentials-to_json">to_json</a>() on the <a href="__builtin__.html#object">object</a>.<br> |
Joe Gregorio | 6121dd9 | 2012-04-13 07:50:04 -0400 | [diff] [blame] | 523 | <br> |
| 524 | Args:<br> |
| 525 | data: dict, A deserialized JSON <a href="__builtin__.html#object">object</a>.<br> |
| 526 | <br> |
| 527 | Returns:<br> |
| 528 | An instance of a <a href="#Credentials">Credentials</a> subclass.</tt></dd></dl> |
| 529 | |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 530 | <dl><dt><a name="Credentials-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility class method to instantiate a <a href="#Credentials">Credentials</a> subclass from a JSON<br> |
| 531 | representation produced by <a href="#Credentials-to_json">to_json</a>().<br> |
| 532 | <br> |
| 533 | Args:<br> |
| 534 | s: string, JSON from <a href="#Credentials-to_json">to_json</a>().<br> |
| 535 | <br> |
| 536 | Returns:<br> |
| 537 | An instance of the subclass of <a href="#Credentials">Credentials</a> that was serialized with<br> |
| 538 | <a href="#Credentials-to_json">to_json</a>().</tt></dd></dl> |
| 539 | |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 540 | <hr> |
| 541 | Data descriptors defined here:<br> |
| 542 | <dl><dt><strong>__dict__</strong></dt> |
| 543 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 544 | </dl> |
| 545 | <dl><dt><strong>__weakref__</strong></dt> |
| 546 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 547 | </dl> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 548 | <hr> |
| 549 | Data and other attributes defined here:<br> |
| 550 | <dl><dt><strong>NON_SERIALIZED_MEMBERS</strong> = ['store']</dl> |
| 551 | |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 552 | </td></tr></table> <p> |
| 553 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 554 | <tr bgcolor="#ffc8d8"> |
| 555 | <td colspan=3 valign=bottom> <br> |
| 556 | <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> |
| 557 | |
| 558 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 559 | <td colspan=2><tt>Base error for this module.<br> </tt></td></tr> |
| 560 | <tr><td> </td> |
| 561 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 562 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 563 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 564 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 565 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 566 | </dl> |
| 567 | <hr> |
| 568 | Data descriptors defined here:<br> |
| 569 | <dl><dt><strong>__weakref__</strong></dt> |
| 570 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 571 | </dl> |
| 572 | <hr> |
| 573 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 574 | <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> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 575 | |
| 576 | <hr> |
| 577 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 578 | <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> |
| 579 | |
| 580 | <hr> |
| 581 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 582 | <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> |
| 583 | |
| 584 | <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> |
| 585 | |
| 586 | <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> |
| 587 | |
| 588 | <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> |
| 589 | <br> |
| 590 | Use of negative indices is not supported.</tt></dd></dl> |
| 591 | |
| 592 | <dl><dt><a name="Error-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 593 | |
| 594 | <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> |
| 595 | |
| 596 | <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> |
| 597 | |
| 598 | <dl><dt><a name="Error-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 599 | |
| 600 | <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> |
| 601 | |
| 602 | <dl><dt><a name="Error-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 603 | |
| 604 | <hr> |
| 605 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 606 | <dl><dt><strong>__dict__</strong></dt> |
| 607 | </dl> |
| 608 | <dl><dt><strong>args</strong></dt> |
| 609 | </dl> |
| 610 | <dl><dt><strong>message</strong></dt> |
| 611 | </dl> |
| 612 | </td></tr></table> <p> |
| 613 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 614 | <tr bgcolor="#ffc8d8"> |
| 615 | <td colspan=3 valign=bottom> <br> |
| 616 | <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> |
| 617 | |
| 618 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 619 | <td colspan=2><tt>Base class for all <a href="#Flow">Flow</a> objects.<br> </tt></td></tr> |
| 620 | <tr><td> </td> |
| 621 | <td width="100%">Data descriptors defined here:<br> |
| 622 | <dl><dt><strong>__dict__</strong></dt> |
| 623 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 624 | </dl> |
| 625 | <dl><dt><strong>__weakref__</strong></dt> |
| 626 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 627 | </dl> |
| 628 | </td></tr></table> <p> |
| 629 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 630 | <tr bgcolor="#ffc8d8"> |
| 631 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 632 | <font color="#000000" face="helvetica, arial"><a name="FlowExchangeError">class <strong>FlowExchangeError</strong></a>(<a href="oauth2client.client.html#Error">Error</a>)</font></td></tr> |
| 633 | |
| 634 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | ad258e2 | 2011-02-22 22:53:30 -0500 | [diff] [blame] | 635 | <td colspan=2><tt><a href="#Error">Error</a> trying to exchange an authorization grant for an access token.<br> </tt></td></tr> |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 636 | <tr><td> </td> |
| 637 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 638 | <dd><a href="oauth2client.client.html#FlowExchangeError">FlowExchangeError</a></dd> |
| 639 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 640 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 641 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 642 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 643 | </dl> |
| 644 | <hr> |
| 645 | Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br> |
| 646 | <dl><dt><strong>__weakref__</strong></dt> |
| 647 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 648 | </dl> |
| 649 | <hr> |
| 650 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 651 | <dl><dt><a name="FlowExchangeError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#FlowExchangeError-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl> |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 652 | |
| 653 | <hr> |
| 654 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 655 | <dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#FlowExchangeError-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> |
| 656 | |
| 657 | <hr> |
| 658 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 659 | <dl><dt><a name="FlowExchangeError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#FlowExchangeError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> |
| 660 | |
| 661 | <dl><dt><a name="FlowExchangeError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#FlowExchangeError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> |
| 662 | |
| 663 | <dl><dt><a name="FlowExchangeError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#FlowExchangeError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> |
| 664 | |
| 665 | <dl><dt><a name="FlowExchangeError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#FlowExchangeError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> |
| 666 | <br> |
| 667 | Use of negative indices is not supported.</tt></dd></dl> |
| 668 | |
| 669 | <dl><dt><a name="FlowExchangeError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 670 | |
| 671 | <dl><dt><a name="FlowExchangeError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#FlowExchangeError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> |
| 672 | |
| 673 | <dl><dt><a name="FlowExchangeError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#FlowExchangeError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> |
| 674 | |
| 675 | <dl><dt><a name="FlowExchangeError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 676 | |
| 677 | <dl><dt><a name="FlowExchangeError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#FlowExchangeError-__str__">__str__</a>() <==> str(x)</tt></dd></dl> |
| 678 | |
| 679 | <dl><dt><a name="FlowExchangeError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 680 | |
| 681 | <hr> |
| 682 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 683 | <dl><dt><strong>__dict__</strong></dt> |
| 684 | </dl> |
| 685 | <dl><dt><strong>args</strong></dt> |
| 686 | </dl> |
| 687 | <dl><dt><strong>message</strong></dt> |
| 688 | </dl> |
| 689 | </td></tr></table> <p> |
| 690 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 691 | <tr bgcolor="#ffc8d8"> |
| 692 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 693 | <font color="#000000" face="helvetica, arial"><a name="MemoryCache">class <strong>MemoryCache</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> |
| 694 | |
| 695 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 696 | <td colspan=2><tt>httplib2 Cache implementation which only caches locally.<br> </tt></td></tr> |
| 697 | <tr><td> </td> |
| 698 | <td width="100%">Methods defined here:<br> |
| 699 | <dl><dt><a name="MemoryCache-__init__"><strong>__init__</strong></a>(self)</dt></dl> |
| 700 | |
| 701 | <dl><dt><a name="MemoryCache-delete"><strong>delete</strong></a>(self, key)</dt></dl> |
| 702 | |
| 703 | <dl><dt><a name="MemoryCache-get"><strong>get</strong></a>(self, key)</dt></dl> |
| 704 | |
| 705 | <dl><dt><a name="MemoryCache-set"><strong>set</strong></a>(self, key, value)</dt></dl> |
| 706 | |
| 707 | <hr> |
| 708 | Data descriptors defined here:<br> |
| 709 | <dl><dt><strong>__dict__</strong></dt> |
| 710 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 711 | </dl> |
| 712 | <dl><dt><strong>__weakref__</strong></dt> |
| 713 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 714 | </dl> |
| 715 | </td></tr></table> <p> |
| 716 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 717 | <tr bgcolor="#ffc8d8"> |
| 718 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 719 | <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> |
| 720 | |
| 721 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 722 | <td colspan=2><tt><a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> for OAuth 2.0.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 723 | <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 724 | <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> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 725 | method, which then adds the OAuth 2.0 access token to each request.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 726 | <br> |
| 727 | <a href="#OAuth2Credentials">OAuth2Credentials</a> objects may be safely pickled and unpickled.<br> </tt></td></tr> |
| 728 | <tr><td> </td> |
| 729 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 730 | <dd><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a></dd> |
| 731 | <dd><a href="oauth2client.client.html#Credentials">Credentials</a></dd> |
| 732 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 733 | </dl> |
| 734 | <hr> |
| 735 | Methods defined here:<br> |
| 736 | <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> |
| 737 | |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 738 | <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, id_token<font color="#909090">=None</font>)</dt><dd><tt>Create an instance of <a href="#OAuth2Credentials">OAuth2Credentials</a>.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 739 | <br> |
| 740 | This constructor is not usually called by the user, instead<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 741 | <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] | 742 | <br> |
| 743 | Args:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 744 | access_token: string, access token.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 745 | client_id: string, client identifier.<br> |
| 746 | client_secret: string, client secret.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 747 | refresh_token: string, refresh token.<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 748 | token_expiry: datetime, when the access_token expires.<br> |
| 749 | token_uri: string, URI of token endpoint.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 750 | user_agent: string, The HTTP User-Agent to provide for this application.<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 751 | id_token: <a href="__builtin__.html#object">object</a>, The identity of the resource owner.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 752 | <br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 753 | Notes:<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 754 | store: callable, A callable that when passed a Credential<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 755 | will store the credential back to where it came from.<br> |
| 756 | This is needed to store the latest access_token if it<br> |
| 757 | has expired and been refreshed.</tt></dd></dl> |
| 758 | |
| 759 | <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> |
| 760 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 761 | <dl><dt><a name="OAuth2Credentials-apply"><strong>apply</strong></a>(self, headers)</dt><dd><tt>Add the authorization to the headers.<br> |
| 762 | <br> |
| 763 | Args:<br> |
| 764 | headers: dict, the headers to add the Authorization header to.</tt></dd></dl> |
| 765 | |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 766 | <dl><dt><a name="OAuth2Credentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Authorize an httplib2.Http instance with these credentials.<br> |
| 767 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 768 | The modified http.request method will add authentication headers to each<br> |
| 769 | request and will refresh access_tokens when a 401 is received on a<br> |
| 770 | request. In addition the http.request method has a credentials property,<br> |
| 771 | http.request.credentials, which is the <a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> that authorized<br> |
| 772 | it.<br> |
| 773 | <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 774 | Args:<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 775 | http: An instance of httplib2.Http<br> |
| 776 | or something that acts like it.<br> |
| 777 | <br> |
| 778 | Returns:<br> |
| 779 | A modified instance of http that was passed in.<br> |
| 780 | <br> |
| 781 | Example:<br> |
| 782 | <br> |
| 783 | h = httplib2.Http()<br> |
| 784 | h = credentials.<a href="#OAuth2Credentials-authorize">authorize</a>(h)<br> |
| 785 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 786 | You can't create a new OAuth subclass of httplib2.Authenication<br> |
| 787 | because it never gets passed the absolute URI, which is needed for<br> |
| 788 | signing. So instead we have to overload 'request' with a closure<br> |
| 789 | that adds in the Authorization header and then calls the original<br> |
| 790 | version of 'request()'.</tt></dd></dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 791 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 792 | <dl><dt><a name="OAuth2Credentials-refresh"><strong>refresh</strong></a>(self, http)</dt><dd><tt>Forces a refresh of the access_token.<br> |
| 793 | <br> |
| 794 | Args:<br> |
| 795 | http: httplib2.Http, an http <a href="__builtin__.html#object">object</a> to be used to make the refresh<br> |
| 796 | request.</tt></dd></dl> |
| 797 | |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 798 | <dl><dt><a name="OAuth2Credentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set the <a href="#Storage">Storage</a> for the credential.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 799 | <br> |
| 800 | Args:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 801 | store: <a href="#Storage">Storage</a>, an implementation of Stroage <a href="__builtin__.html#object">object</a>.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 802 | This is needed to store the latest access_token if it<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 803 | has expired and been refreshed. This implementation uses<br> |
| 804 | locking to check for updates before updating the<br> |
| 805 | access_token.</tt></dd></dl> |
| 806 | |
| 807 | <dl><dt><a name="OAuth2Credentials-to_json"><strong>to_json</strong></a>(self)</dt></dl> |
| 808 | |
| 809 | <hr> |
| 810 | Class methods defined here:<br> |
| 811 | <dl><dt><a name="OAuth2Credentials-from_json"><strong>from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Instantiate a <a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> from a JSON description of it. The JSON<br> |
| 812 | should have been produced by calling .<a href="#OAuth2Credentials-to_json">to_json</a>() on the <a href="__builtin__.html#object">object</a>.<br> |
| 813 | <br> |
| 814 | Args:<br> |
| 815 | data: dict, A deserialized JSON <a href="__builtin__.html#object">object</a>.<br> |
| 816 | <br> |
| 817 | Returns:<br> |
| 818 | An instance of a <a href="#Credentials">Credentials</a> subclass.</tt></dd></dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 819 | |
| 820 | <hr> |
Joe Gregorio | 9ce4b62 | 2011-02-17 15:32:11 -0500 | [diff] [blame] | 821 | Data descriptors defined here:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 822 | <dl><dt><strong>access_token_expired</strong></dt> |
| 823 | <dd><tt>True if the credential is expired or invalid.<br> |
| 824 | <br> |
| 825 | If the token_expiry isn't set, we assume the token doesn't expire.</tt></dd> |
Joe Gregorio | 9ce4b62 | 2011-02-17 15:32:11 -0500 | [diff] [blame] | 826 | </dl> |
| 827 | <hr> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 828 | Class methods inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 829 | <dl><dt><a name="OAuth2Credentials-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility class method to instantiate a <a href="#Credentials">Credentials</a> subclass from a JSON<br> |
| 830 | representation produced by <a href="#OAuth2Credentials-to_json">to_json</a>().<br> |
| 831 | <br> |
| 832 | Args:<br> |
| 833 | s: string, JSON from <a href="#OAuth2Credentials-to_json">to_json</a>().<br> |
| 834 | <br> |
| 835 | Returns:<br> |
| 836 | An instance of the subclass of <a href="#Credentials">Credentials</a> that was serialized with<br> |
| 837 | <a href="#OAuth2Credentials-to_json">to_json</a>().</tt></dd></dl> |
| 838 | |
| 839 | <hr> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 840 | Data descriptors inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 841 | <dl><dt><strong>__dict__</strong></dt> |
| 842 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 843 | </dl> |
| 844 | <dl><dt><strong>__weakref__</strong></dt> |
| 845 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 846 | </dl> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 847 | <hr> |
| 848 | Data and other attributes inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 849 | <dl><dt><strong>NON_SERIALIZED_MEMBERS</strong> = ['store']</dl> |
| 850 | |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 851 | </td></tr></table> <p> |
| 852 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 853 | <tr bgcolor="#ffc8d8"> |
| 854 | <td colspan=3 valign=bottom> <br> |
| 855 | <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> |
| 856 | |
| 857 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 858 | <td colspan=2><tt>Does the Web Server <a href="#Flow">Flow</a> for OAuth 2.0.<br> |
| 859 | <br> |
| 860 | <a href="#OAuth2Credentials">OAuth2Credentials</a> objects may be safely pickled and unpickled.<br> </tt></td></tr> |
| 861 | <tr><td> </td> |
| 862 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 863 | <dd><a href="oauth2client.client.html#OAuth2WebServerFlow">OAuth2WebServerFlow</a></dd> |
| 864 | <dd><a href="oauth2client.client.html#Flow">Flow</a></dd> |
| 865 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 866 | </dl> |
| 867 | <hr> |
| 868 | Methods defined here:<br> |
Joe Gregorio | 761c456 | 2011-10-28 14:36:24 -0400 | [diff] [blame] | 869 | <dl><dt><a name="OAuth2WebServerFlow-__init__"><strong>__init__</strong></a>(self, client_id, client_secret, scope, user_agent<font color="#909090">=None</font>, auth_uri<font color="#909090">='https://accounts.google.com/o/oauth2/auth'</font>, token_uri<font color="#909090">='https://accounts.google.com/o/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] | 870 | <br> |
| 871 | Args:<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 872 | client_id: string, client identifier.<br> |
| 873 | client_secret: string client secret.<br> |
Joe Gregorio | 761c456 | 2011-10-28 14:36:24 -0400 | [diff] [blame] | 874 | scope: string or list of strings, scope(s) of the credentials being<br> |
| 875 | requested.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 876 | user_agent: string, HTTP User-Agent to provide for this application.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 877 | auth_uri: string, URI for authorization endpoint. For convenience<br> |
| 878 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.<br> |
| 879 | token_uri: string, URI for token endpoint. For convenience<br> |
| 880 | 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] | 881 | **kwargs: dict, The keyword arguments are all optional and required<br> |
| 882 | parameters for the OAuth calls.</tt></dd></dl> |
| 883 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 884 | <dl><dt><a name="OAuth2WebServerFlow-step1_get_authorize_url"><strong>step1_get_authorize_url</strong></a>(self, redirect_uri<font color="#909090">='urn:ietf:wg:oauth:2.0:oob'</font>)</dt><dd><tt>Returns a URI to redirect to the provider.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 885 | <br> |
| 886 | Args:<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 887 | redirect_uri: string, Either the string 'urn:ietf:wg:oauth:2.0:oob' for<br> |
| 888 | a non-web-based application, or a URI that handles the callback from<br> |
| 889 | the authorization server.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 890 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 891 | If redirect_uri is 'urn:ietf:wg:oauth:2.0:oob' then pass in the<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 892 | generated verification code to step2_exchange,<br> |
| 893 | otherwise pass in the query parameters received<br> |
| 894 | at the callback uri to step2_exchange.</tt></dd></dl> |
| 895 | |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 896 | <dl><dt><a name="OAuth2WebServerFlow-step2_exchange"><strong>step2_exchange</strong></a>(self, code, http<font color="#909090">=None</font>)</dt><dd><tt>Exhanges a code for <a href="#OAuth2Credentials">OAuth2Credentials</a>.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 897 | <br> |
| 898 | Args:<br> |
| 899 | code: string or dict, either the code as a string, or a dictionary<br> |
| 900 | of the query parameters to the redirect_uri, which contains<br> |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 901 | the code.<br> |
Joe Gregorio | 746096f | 2012-06-15 10:53:36 -0400 | [diff] [blame] | 902 | http: httplib2.Http, optional http instance to use to do the fetch<br> |
| 903 | <br> |
| 904 | Returns:<br> |
| 905 | An <a href="#OAuth2Credentials">OAuth2Credentials</a> <a href="__builtin__.html#object">object</a> that can be used to authorize requests.<br> |
| 906 | <br> |
| 907 | Raises:<br> |
| 908 | <a href="#FlowExchangeError">FlowExchangeError</a> if a problem occured exchanging the code for a<br> |
| 909 | refresh_token.</tt></dd></dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 910 | |
| 911 | <hr> |
| 912 | Data descriptors inherited from <a href="oauth2client.client.html#Flow">Flow</a>:<br> |
| 913 | <dl><dt><strong>__dict__</strong></dt> |
| 914 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 915 | </dl> |
| 916 | <dl><dt><strong>__weakref__</strong></dt> |
| 917 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 918 | </dl> |
| 919 | </td></tr></table> <p> |
| 920 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 921 | <tr bgcolor="#ffc8d8"> |
| 922 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 923 | <font color="#000000" face="helvetica, arial"><a name="SignedJwtAssertionCredentials">class <strong>SignedJwtAssertionCredentials</strong></a>(<a href="oauth2client.client.html#AssertionCredentials">AssertionCredentials</a>)</font></td></tr> |
| 924 | |
| 925 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 926 | <td colspan=2><tt><a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> used for OAuth 2.0 Signed JWT assertion grants.<br> |
| 927 | <br> |
| 928 | This credential does not require a flow to instantiate because it<br> |
| 929 | represents a two legged flow, and therefore has all of the required<br> |
| 930 | information to generate and refresh its own access tokens.<br> </tt></td></tr> |
| 931 | <tr><td> </td> |
| 932 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 933 | <dd><a href="oauth2client.client.html#SignedJwtAssertionCredentials">SignedJwtAssertionCredentials</a></dd> |
| 934 | <dd><a href="oauth2client.client.html#AssertionCredentials">AssertionCredentials</a></dd> |
| 935 | <dd><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a></dd> |
| 936 | <dd><a href="oauth2client.client.html#Credentials">Credentials</a></dd> |
| 937 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 938 | </dl> |
| 939 | <hr> |
| 940 | Methods defined here:<br> |
| 941 | <dl><dt><a name="SignedJwtAssertionCredentials-__init__"><strong>__init__</strong></a>(self, service_account_name, private_key, scope, private_key_password<font color="#909090">='notasecret'</font>, user_agent<font color="#909090">=None</font>, token_uri<font color="#909090">='https://accounts.google.com/o/oauth2/token'</font>, **kwargs)</dt><dd><tt>Constructor for <a href="#SignedJwtAssertionCredentials">SignedJwtAssertionCredentials</a>.<br> |
| 942 | <br> |
| 943 | Args:<br> |
| 944 | service_account_name: string, id for account, usually an email address.<br> |
| 945 | private_key: string, private key in P12 format.<br> |
| 946 | scope: string or list of strings, scope(s) of the credentials being<br> |
| 947 | requested.<br> |
| 948 | private_key_password: string, password for private_key.<br> |
| 949 | user_agent: string, HTTP User-Agent to provide for this application.<br> |
| 950 | token_uri: string, URI for token endpoint. For convenience<br> |
| 951 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.<br> |
| 952 | kwargs: kwargs, Additional parameters to add to the JWT token, for<br> |
| 953 | example prn=joe@xample.org.</tt></dd></dl> |
| 954 | |
| 955 | <hr> |
| 956 | Class methods defined here:<br> |
| 957 | <dl><dt><a name="SignedJwtAssertionCredentials-from_json"><strong>from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt></dl> |
| 958 | |
| 959 | <hr> |
| 960 | Data and other attributes defined here:<br> |
| 961 | <dl><dt><strong>MAX_TOKEN_LIFETIME_SECS</strong> = 3600</dl> |
| 962 | |
| 963 | <hr> |
| 964 | Methods inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
| 965 | <dl><dt><a name="SignedJwtAssertionCredentials-__getstate__"><strong>__getstate__</strong></a>(self)</dt><dd><tt>Trim the state down to something that can be pickled.</tt></dd></dl> |
| 966 | |
| 967 | <dl><dt><a name="SignedJwtAssertionCredentials-__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> |
| 968 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 969 | <dl><dt><a name="SignedJwtAssertionCredentials-apply"><strong>apply</strong></a>(self, headers)</dt><dd><tt>Add the authorization to the headers.<br> |
| 970 | <br> |
| 971 | Args:<br> |
| 972 | headers: dict, the headers to add the Authorization header to.</tt></dd></dl> |
| 973 | |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 974 | <dl><dt><a name="SignedJwtAssertionCredentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Authorize an httplib2.Http instance with these credentials.<br> |
| 975 | <br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 976 | The modified http.request method will add authentication headers to each<br> |
| 977 | request and will refresh access_tokens when a 401 is received on a<br> |
| 978 | request. In addition the http.request method has a credentials property,<br> |
| 979 | http.request.credentials, which is the <a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> that authorized<br> |
| 980 | it.<br> |
| 981 | <br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 982 | Args:<br> |
| 983 | http: An instance of httplib2.Http<br> |
| 984 | or something that acts like it.<br> |
| 985 | <br> |
| 986 | Returns:<br> |
| 987 | A modified instance of http that was passed in.<br> |
| 988 | <br> |
| 989 | Example:<br> |
| 990 | <br> |
| 991 | h = httplib2.Http()<br> |
| 992 | h = credentials.<a href="#SignedJwtAssertionCredentials-authorize">authorize</a>(h)<br> |
| 993 | <br> |
| 994 | You can't create a new OAuth subclass of httplib2.Authenication<br> |
| 995 | because it never gets passed the absolute URI, which is needed for<br> |
| 996 | signing. So instead we have to overload 'request' with a closure<br> |
| 997 | that adds in the Authorization header and then calls the original<br> |
| 998 | version of 'request()'.</tt></dd></dl> |
| 999 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 1000 | <dl><dt><a name="SignedJwtAssertionCredentials-refresh"><strong>refresh</strong></a>(self, http)</dt><dd><tt>Forces a refresh of the access_token.<br> |
| 1001 | <br> |
| 1002 | Args:<br> |
| 1003 | http: httplib2.Http, an http <a href="__builtin__.html#object">object</a> to be used to make the refresh<br> |
| 1004 | request.</tt></dd></dl> |
| 1005 | |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1006 | <dl><dt><a name="SignedJwtAssertionCredentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set the <a href="#Storage">Storage</a> for the credential.<br> |
| 1007 | <br> |
| 1008 | Args:<br> |
| 1009 | store: <a href="#Storage">Storage</a>, an implementation of Stroage <a href="__builtin__.html#object">object</a>.<br> |
| 1010 | This is needed to store the latest access_token if it<br> |
| 1011 | has expired and been refreshed. This implementation uses<br> |
| 1012 | locking to check for updates before updating the<br> |
| 1013 | access_token.</tt></dd></dl> |
| 1014 | |
| 1015 | <dl><dt><a name="SignedJwtAssertionCredentials-to_json"><strong>to_json</strong></a>(self)</dt></dl> |
| 1016 | |
| 1017 | <hr> |
| 1018 | Data descriptors inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
| 1019 | <dl><dt><strong>access_token_expired</strong></dt> |
| 1020 | <dd><tt>True if the credential is expired or invalid.<br> |
| 1021 | <br> |
| 1022 | If the token_expiry isn't set, we assume the token doesn't expire.</tt></dd> |
| 1023 | </dl> |
| 1024 | <hr> |
| 1025 | Class methods inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 1026 | <dl><dt><a name="SignedJwtAssertionCredentials-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility class method to instantiate a <a href="#Credentials">Credentials</a> subclass from a JSON<br> |
| 1027 | representation produced by <a href="#SignedJwtAssertionCredentials-to_json">to_json</a>().<br> |
| 1028 | <br> |
| 1029 | Args:<br> |
| 1030 | s: string, JSON from <a href="#SignedJwtAssertionCredentials-to_json">to_json</a>().<br> |
| 1031 | <br> |
| 1032 | Returns:<br> |
| 1033 | An instance of the subclass of <a href="#Credentials">Credentials</a> that was serialized with<br> |
| 1034 | <a href="#SignedJwtAssertionCredentials-to_json">to_json</a>().</tt></dd></dl> |
| 1035 | |
| 1036 | <hr> |
| 1037 | Data descriptors inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 1038 | <dl><dt><strong>__dict__</strong></dt> |
| 1039 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1040 | </dl> |
| 1041 | <dl><dt><strong>__weakref__</strong></dt> |
| 1042 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1043 | </dl> |
| 1044 | <hr> |
| 1045 | Data and other attributes inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 1046 | <dl><dt><strong>NON_SERIALIZED_MEMBERS</strong> = ['store']</dl> |
| 1047 | |
| 1048 | </td></tr></table> <p> |
| 1049 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 1050 | <tr bgcolor="#ffc8d8"> |
| 1051 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 1052 | <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> |
| 1053 | |
| 1054 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 1055 | <td colspan=2><tt>Base class for all <a href="#Storage">Storage</a> objects.<br> |
| 1056 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 1057 | Store and retrieve a single credential. This class supports locking<br> |
| 1058 | such that multiple processes and threads can operate on a single<br> |
| 1059 | store.<br> </tt></td></tr> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 1060 | <tr><td> </td> |
| 1061 | <td width="100%">Methods defined here:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 1062 | <dl><dt><a name="Storage-acquire_lock"><strong>acquire_lock</strong></a>(self)</dt><dd><tt>Acquires any lock necessary to access this <a href="#Storage">Storage</a>.<br> |
| 1063 | <br> |
| 1064 | This lock is not reentrant.</tt></dd></dl> |
| 1065 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 1066 | <dl><dt><a name="Storage-delete"><strong>delete</strong></a>(self)</dt><dd><tt>Delete credential.<br> |
| 1067 | <br> |
| 1068 | Frees any resources associated with storing the credential.<br> |
| 1069 | The <a href="#Storage">Storage</a> lock must *not* be held when this is called.<br> |
| 1070 | <br> |
| 1071 | Returns:<br> |
| 1072 | None</tt></dd></dl> |
| 1073 | |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 1074 | <dl><dt><a name="Storage-get"><strong>get</strong></a>(self)</dt><dd><tt>Retrieve credential.<br> |
| 1075 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 1076 | The <a href="#Storage">Storage</a> lock must *not* be held when this is called.<br> |
| 1077 | <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 1078 | Returns:<br> |
Joe Gregorio | 20a5aa9 | 2011-04-01 17:44:25 -0400 | [diff] [blame] | 1079 | oauth2client.client.<a href="#Credentials">Credentials</a></tt></dd></dl> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 1080 | |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 1081 | <dl><dt><a name="Storage-locked_delete"><strong>locked_delete</strong></a>(self)</dt><dd><tt>Delete a credential.<br> |
| 1082 | <br> |
| 1083 | The <a href="#Storage">Storage</a> lock must be held when this is called.</tt></dd></dl> |
| 1084 | |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 1085 | <dl><dt><a name="Storage-locked_get"><strong>locked_get</strong></a>(self)</dt><dd><tt>Retrieve credential.<br> |
| 1086 | <br> |
| 1087 | The <a href="#Storage">Storage</a> lock must be held when this is called.<br> |
| 1088 | <br> |
| 1089 | Returns:<br> |
| 1090 | oauth2client.client.<a href="#Credentials">Credentials</a></tt></dd></dl> |
| 1091 | |
| 1092 | <dl><dt><a name="Storage-locked_put"><strong>locked_put</strong></a>(self, credentials)</dt><dd><tt>Write a credential.<br> |
| 1093 | <br> |
| 1094 | The <a href="#Storage">Storage</a> lock must be held when this is called.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 1095 | <br> |
| 1096 | Args:<br> |
| 1097 | credentials: <a href="#Credentials">Credentials</a>, the credentials to store.</tt></dd></dl> |
| 1098 | |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 1099 | <dl><dt><a name="Storage-put"><strong>put</strong></a>(self, credentials)</dt><dd><tt>Write a credential.<br> |
| 1100 | <br> |
| 1101 | The <a href="#Storage">Storage</a> lock must be held when this is called.<br> |
| 1102 | <br> |
| 1103 | Args:<br> |
| 1104 | credentials: <a href="#Credentials">Credentials</a>, the credentials to store.</tt></dd></dl> |
| 1105 | |
| 1106 | <dl><dt><a name="Storage-release_lock"><strong>release_lock</strong></a>(self)</dt><dd><tt>Release the <a href="#Storage">Storage</a> lock.<br> |
| 1107 | <br> |
| 1108 | Trying to release a lock that isn't held will result in a<br> |
| 1109 | RuntimeError.</tt></dd></dl> |
| 1110 | |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 1111 | <hr> |
| 1112 | Data descriptors defined here:<br> |
| 1113 | <dl><dt><strong>__dict__</strong></dt> |
| 1114 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1115 | </dl> |
| 1116 | <dl><dt><strong>__weakref__</strong></dt> |
| 1117 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1118 | </dl> |
Joe Gregorio | 761c456 | 2011-10-28 14:36:24 -0400 | [diff] [blame] | 1119 | </td></tr></table> <p> |
| 1120 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 1121 | <tr bgcolor="#ffc8d8"> |
| 1122 | <td colspan=3 valign=bottom> <br> |
| 1123 | <font color="#000000" face="helvetica, arial"><a name="UnknownClientSecretsFlowError">class <strong>UnknownClientSecretsFlowError</strong></a>(<a href="oauth2client.client.html#Error">Error</a>)</font></td></tr> |
| 1124 | |
| 1125 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 1126 | <td colspan=2><tt>The client secrets file called for an unknown type of OAuth 2.0 flow.<br> </tt></td></tr> |
| 1127 | <tr><td> </td> |
| 1128 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 1129 | <dd><a href="oauth2client.client.html#UnknownClientSecretsFlowError">UnknownClientSecretsFlowError</a></dd> |
| 1130 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 1131 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 1132 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 1133 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 1134 | </dl> |
| 1135 | <hr> |
| 1136 | Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br> |
| 1137 | <dl><dt><strong>__weakref__</strong></dt> |
| 1138 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1139 | </dl> |
| 1140 | <hr> |
| 1141 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1142 | <dl><dt><a name="UnknownClientSecretsFlowError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#UnknownClientSecretsFlowError-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl> |
Joe Gregorio | 761c456 | 2011-10-28 14:36:24 -0400 | [diff] [blame] | 1143 | |
| 1144 | <hr> |
| 1145 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 1146 | <dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#UnknownClientSecretsFlowError-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> |
| 1147 | |
| 1148 | <hr> |
| 1149 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 1150 | <dl><dt><a name="UnknownClientSecretsFlowError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#UnknownClientSecretsFlowError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> |
| 1151 | |
| 1152 | <dl><dt><a name="UnknownClientSecretsFlowError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#UnknownClientSecretsFlowError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> |
| 1153 | |
| 1154 | <dl><dt><a name="UnknownClientSecretsFlowError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#UnknownClientSecretsFlowError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> |
| 1155 | |
| 1156 | <dl><dt><a name="UnknownClientSecretsFlowError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#UnknownClientSecretsFlowError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> |
| 1157 | <br> |
| 1158 | Use of negative indices is not supported.</tt></dd></dl> |
| 1159 | |
| 1160 | <dl><dt><a name="UnknownClientSecretsFlowError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 1161 | |
| 1162 | <dl><dt><a name="UnknownClientSecretsFlowError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#UnknownClientSecretsFlowError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> |
| 1163 | |
| 1164 | <dl><dt><a name="UnknownClientSecretsFlowError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#UnknownClientSecretsFlowError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> |
| 1165 | |
| 1166 | <dl><dt><a name="UnknownClientSecretsFlowError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 1167 | |
| 1168 | <dl><dt><a name="UnknownClientSecretsFlowError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#UnknownClientSecretsFlowError-__str__">__str__</a>() <==> str(x)</tt></dd></dl> |
| 1169 | |
| 1170 | <dl><dt><a name="UnknownClientSecretsFlowError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 1171 | |
| 1172 | <hr> |
| 1173 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 1174 | <dl><dt><strong>__dict__</strong></dt> |
| 1175 | </dl> |
| 1176 | <dl><dt><strong>args</strong></dt> |
| 1177 | </dl> |
| 1178 | <dl><dt><strong>message</strong></dt> |
| 1179 | </dl> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1180 | </td></tr></table> <p> |
| 1181 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 1182 | <tr bgcolor="#ffc8d8"> |
| 1183 | <td colspan=3 valign=bottom> <br> |
| 1184 | <font color="#000000" face="helvetica, arial"><a name="VerifyJwtTokenError">class <strong>VerifyJwtTokenError</strong></a>(<a href="oauth2client.client.html#Error">Error</a>)</font></td></tr> |
| 1185 | |
| 1186 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 1187 | <td colspan=2><tt>Could on retrieve certificates for validation.<br> </tt></td></tr> |
| 1188 | <tr><td> </td> |
| 1189 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 1190 | <dd><a href="oauth2client.client.html#VerifyJwtTokenError">VerifyJwtTokenError</a></dd> |
| 1191 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 1192 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 1193 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 1194 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 1195 | </dl> |
| 1196 | <hr> |
| 1197 | Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br> |
| 1198 | <dl><dt><strong>__weakref__</strong></dt> |
| 1199 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1200 | </dl> |
| 1201 | <hr> |
| 1202 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 1203 | <dl><dt><a name="VerifyJwtTokenError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#VerifyJwtTokenError-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl> |
| 1204 | |
| 1205 | <hr> |
| 1206 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 1207 | <dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#VerifyJwtTokenError-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> |
| 1208 | |
| 1209 | <hr> |
| 1210 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 1211 | <dl><dt><a name="VerifyJwtTokenError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#VerifyJwtTokenError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> |
| 1212 | |
| 1213 | <dl><dt><a name="VerifyJwtTokenError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#VerifyJwtTokenError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> |
| 1214 | |
| 1215 | <dl><dt><a name="VerifyJwtTokenError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#VerifyJwtTokenError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> |
| 1216 | |
| 1217 | <dl><dt><a name="VerifyJwtTokenError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#VerifyJwtTokenError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> |
| 1218 | <br> |
| 1219 | Use of negative indices is not supported.</tt></dd></dl> |
| 1220 | |
| 1221 | <dl><dt><a name="VerifyJwtTokenError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 1222 | |
| 1223 | <dl><dt><a name="VerifyJwtTokenError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#VerifyJwtTokenError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> |
| 1224 | |
| 1225 | <dl><dt><a name="VerifyJwtTokenError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#VerifyJwtTokenError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> |
| 1226 | |
| 1227 | <dl><dt><a name="VerifyJwtTokenError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 1228 | |
| 1229 | <dl><dt><a name="VerifyJwtTokenError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#VerifyJwtTokenError-__str__">__str__</a>() <==> str(x)</tt></dd></dl> |
| 1230 | |
| 1231 | <dl><dt><a name="VerifyJwtTokenError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 1232 | |
| 1233 | <hr> |
| 1234 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 1235 | <dl><dt><strong>__dict__</strong></dt> |
| 1236 | </dl> |
| 1237 | <dl><dt><strong>args</strong></dt> |
| 1238 | </dl> |
| 1239 | <dl><dt><strong>message</strong></dt> |
| 1240 | </dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1241 | </td></tr></table></td></tr></table><p> |
| 1242 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
Joe Gregorio | 761c456 | 2011-10-28 14:36:24 -0400 | [diff] [blame] | 1243 | <tr bgcolor="#eeaa77"> |
| 1244 | <td colspan=3 valign=bottom> <br> |
| 1245 | <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> |
| 1246 | |
| 1247 | <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> |
Joe Gregorio | 6621203 | 2012-06-14 09:10:14 -0400 | [diff] [blame] | 1248 | <td width="100%"><dl><dt><a name="-credentials_from_clientsecrets_and_code"><strong>credentials_from_clientsecrets_and_code</strong></a>(filename, scope, code, message<font color="#909090">=None</font>, redirect_uri<font color="#909090">='postmessage'</font>, http<font color="#909090">=None</font>)</dt><dd><tt>Returns <a href="#OAuth2Credentials">OAuth2Credentials</a> from a clientsecrets file and an auth code.<br> |
| 1249 | <br> |
| 1250 | Will create the right kind of <a href="#Flow">Flow</a> based on the contents of the clientsecrets<br> |
| 1251 | file or will raise InvalidClientSecretsError for unknown types of Flows.<br> |
| 1252 | <br> |
| 1253 | Args:<br> |
| 1254 | filename: string, File name of clientsecrets.<br> |
| 1255 | scope: string or list of strings, scope(s) to request.<br> |
| 1256 | code: string, An authroization code, most likely passed down from<br> |
| 1257 | the client<br> |
| 1258 | message: string, A friendly string to display to the user if the<br> |
| 1259 | clientsecrets file is missing or invalid. If message is provided then<br> |
| 1260 | sys.exit will be called in the case of an error. If message in not<br> |
| 1261 | provided then clientsecrets.InvalidClientSecretsError will be raised.<br> |
| 1262 | redirect_uri: string, this is generally set to 'postmessage' to match the<br> |
| 1263 | redirect_uri that the client specified<br> |
| 1264 | http: httplib2.Http, optional http instance to use to do the fetch<br> |
| 1265 | <br> |
| 1266 | Returns:<br> |
| 1267 | An <a href="#OAuth2Credentials">OAuth2Credentials</a> <a href="__builtin__.html#object">object</a>.<br> |
| 1268 | <br> |
| 1269 | Raises:<br> |
| 1270 | <a href="#FlowExchangeError">FlowExchangeError</a> if the authorization code cannot be exchanged for an<br> |
| 1271 | access token<br> |
| 1272 | <a href="#UnknownClientSecretsFlowError">UnknownClientSecretsFlowError</a> if the file describes an unknown kind of <a href="#Flow">Flow</a>.<br> |
| 1273 | clientsecrets.InvalidClientSecretsError if the clientsecrets file is<br> |
| 1274 | invalid.</tt></dd></dl> |
| 1275 | <dl><dt><a name="-credentials_from_code"><strong>credentials_from_code</strong></a>(client_id, client_secret, scope, code, redirect_uri<font color="#909090">='postmessage'</font>, http<font color="#909090">=None</font>, user_agent<font color="#909090">=None</font>, token_uri<font color="#909090">='https://accounts.google.com/o/oauth2/token'</font>)</dt><dd><tt>Exchanges an authorization code for an <a href="#OAuth2Credentials">OAuth2Credentials</a> <a href="__builtin__.html#object">object</a>.<br> |
| 1276 | <br> |
| 1277 | Args:<br> |
| 1278 | client_id: string, client identifier.<br> |
| 1279 | client_secret: string, client secret.<br> |
| 1280 | scope: string or list of strings, scope(s) to request.<br> |
| 1281 | code: string, An authroization code, most likely passed down from<br> |
| 1282 | the client<br> |
| 1283 | redirect_uri: string, this is generally set to 'postmessage' to match the<br> |
| 1284 | redirect_uri that the client specified<br> |
| 1285 | http: httplib2.Http, optional http instance to use to do the fetch<br> |
| 1286 | token_uri: string, URI for token endpoint. For convenience<br> |
| 1287 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.<br> |
| 1288 | Returns:<br> |
| 1289 | An <a href="#OAuth2Credentials">OAuth2Credentials</a> <a href="__builtin__.html#object">object</a>.<br> |
| 1290 | <br> |
| 1291 | Raises:<br> |
| 1292 | <a href="#FlowExchangeError">FlowExchangeError</a> if the authorization code cannot be exchanged for an<br> |
| 1293 | access token</tt></dd></dl> |
| 1294 | <dl><dt><a name="-flow_from_clientsecrets"><strong>flow_from_clientsecrets</strong></a>(filename, scope, message<font color="#909090">=None</font>)</dt><dd><tt>Create a <a href="#Flow">Flow</a> from a clientsecrets file.<br> |
Joe Gregorio | 761c456 | 2011-10-28 14:36:24 -0400 | [diff] [blame] | 1295 | <br> |
| 1296 | Will create the right kind of <a href="#Flow">Flow</a> based on the contents of the clientsecrets<br> |
| 1297 | file or will raise InvalidClientSecretsError for unknown types of Flows.<br> |
| 1298 | <br> |
| 1299 | Args:<br> |
| 1300 | filename: string, File name of client secrets.<br> |
| 1301 | scope: string or list of strings, scope(s) to request.<br> |
| 1302 | message: string, A friendly string to display to the user if the<br> |
| 1303 | clientsecrets file is missing or invalid. If message is provided then<br> |
| 1304 | sys.exit will be called in the case of an error. If message in not<br> |
| 1305 | provided then clientsecrets.InvalidClientSecretsError will be raised.<br> |
| 1306 | <br> |
| 1307 | Returns:<br> |
| 1308 | A <a href="#Flow">Flow</a> <a href="__builtin__.html#object">object</a>.<br> |
| 1309 | <br> |
| 1310 | Raises:<br> |
| 1311 | <a href="#UnknownClientSecretsFlowError">UnknownClientSecretsFlowError</a> if the file describes an unknown kind of <a href="#Flow">Flow</a>.<br> |
| 1312 | clientsecrets.InvalidClientSecretsError if the clientsecrets file is<br> |
| 1313 | invalid.</tt></dd></dl> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1314 | <dl><dt><a name="-verify_id_token"><strong>verify_id_token</strong></a>(id_token, audience, http<font color="#909090">=None</font>, cert_uri<font color="#909090">='https://www.googleapis.com/oauth2/v1/certs'</font>)</dt><dd><tt>Verifies a signed JWT id_token.<br> |
| 1315 | <br> |
| 1316 | Args:<br> |
| 1317 | id_token: string, A Signed JWT.<br> |
| 1318 | audience: string, The audience 'aud' that the token should be for.<br> |
| 1319 | http: httplib2.Http, instance to use to make the HTTP request. Callers<br> |
| 1320 | should supply an instance that has caching enabled.<br> |
| 1321 | cert_uri: string, URI of the certificates in JSON format to<br> |
| 1322 | verify the JWT against.<br> |
| 1323 | <br> |
| 1324 | Returns:<br> |
| 1325 | The deserialized JSON in the JWT.<br> |
| 1326 | <br> |
| 1327 | Raises:<br> |
| 1328 | oauth2client.crypt.AppIdentityError if the JWT fails to verify.</tt></dd></dl> |
Joe Gregorio | 761c456 | 2011-10-28 14:36:24 -0400 | [diff] [blame] | 1329 | </td></tr></table><p> |
| 1330 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1331 | <tr bgcolor="#55aa55"> |
| 1332 | <td colspan=3 valign=bottom> <br> |
| 1333 | <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> |
| 1334 | |
| 1335 | <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 1336 | <td width="100%"><strong>EXPIRY_FORMAT</strong> = '%Y-%m-%dT%H:%M:%SZ'<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1337 | <strong>HAS_OPENSSL</strong> = True<br> |
| 1338 | <strong>ID_TOKEN_VERIFICATON_CERTS</strong> = 'https://www.googleapis.com/oauth2/v1/certs'<br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 1339 | <strong>OOB_CALLBACK_URN</strong> = 'urn:ietf:wg:oauth:2.0:oob'<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 1340 | <strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'<br> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 1341 | <strong>logger</strong> = <logging.Logger instance></td></tr></table><p> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1342 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 1343 | <tr bgcolor="#7799ee"> |
| 1344 | <td colspan=3 valign=bottom> <br> |
| 1345 | <font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr> |
| 1346 | |
| 1347 | <tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td> |
| 1348 | <td width="100%">jcgregorio@google.com (Joe Gregorio)</td></tr></table> |
| 1349 | </body></html> |