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 | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 11 | ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/jcgregorio/projects/apiclient/oauth2client/client.py">/usr/local/google/home/jcgregorio/projects/apiclient/oauth2client/client.py</a></font></td></tr></table> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 12 | <p><tt>An OAuth 2.0 client<br> |
| 13 | <br> |
| 14 | Tools for interacting with OAuth 2.0 protected<br> |
| 15 | resources.</tt></p> |
| 16 | <p> |
| 17 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 18 | <tr bgcolor="#aa55cc"> |
| 19 | <td colspan=3 valign=bottom> <br> |
| 20 | <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> |
| 21 | |
| 22 | <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> |
| 23 | <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="copy.html">copy</a><br> |
| 24 | <a href="datetime.html">datetime</a><br> |
| 25 | </td><td width="25%" valign=top><a href="httplib2.html">httplib2</a><br> |
| 26 | <a href="logging.html">logging</a><br> |
| 27 | </td><td width="25%" valign=top><a href="simplejson.html">simplejson</a><br> |
| 28 | <a href="urllib.html">urllib</a><br> |
| 29 | </td><td width="25%" valign=top><a href="urlparse.html">urlparse</a><br> |
| 30 | </td></tr></table></td></tr></table><p> |
| 31 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 32 | <tr bgcolor="#ee77aa"> |
| 33 | <td colspan=3 valign=bottom> <br> |
| 34 | <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> |
| 35 | |
| 36 | <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> |
| 37 | <td width="100%"><dl> |
| 38 | <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> |
| 39 | </font></dt><dd> |
| 40 | <dl> |
| 41 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Credentials">Credentials</a> |
| 42 | </font></dt><dd> |
| 43 | <dl> |
| 44 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 45 | </font></dt><dd> |
| 46 | <dl> |
| 47 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#AccessTokenCredentials">AccessTokenCredentials</a> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 48 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.client.html#AssertionCredentials">AssertionCredentials</a> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 49 | </font></dt></dl> |
| 50 | </dd> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 51 | </dl> |
| 52 | </dd> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 53 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Flow">Flow</a> |
| 54 | </font></dt><dd> |
| 55 | <dl> |
| 56 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#OAuth2WebServerFlow">OAuth2WebServerFlow</a> |
| 57 | </font></dt></dl> |
| 58 | </dd> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 59 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Storage">Storage</a> |
| 60 | </font></dt></dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 61 | </dd> |
| 62 | <dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>) |
| 63 | </font></dt><dd> |
| 64 | <dl> |
| 65 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Error">Error</a> |
| 66 | </font></dt><dd> |
| 67 | <dl> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 68 | <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] | 69 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.client.html#AccessTokenRefreshError">AccessTokenRefreshError</a> |
| 70 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.client.html#FlowExchangeError">FlowExchangeError</a> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 71 | </font></dt></dl> |
| 72 | </dd> |
| 73 | </dl> |
| 74 | </dd> |
| 75 | </dl> |
| 76 | <p> |
| 77 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 78 | <tr bgcolor="#ffc8d8"> |
| 79 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 80 | <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> |
| 81 | |
| 82 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 83 | <td colspan=2><tt><a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> for OAuth 2.0<br> |
| 84 | <br> |
| 85 | <a href="#Credentials">Credentials</a> can be applied to an httplib2.Http <a href="__builtin__.html#object">object</a> using the <a href="#AccessTokenCredentials-authorize">authorize</a>()<br> |
| 86 | method, which then signs each request from that <a href="__builtin__.html#object">object</a> with the OAuth 2.0<br> |
| 87 | access token. This set of credentials is for the use case where you have<br> |
| 88 | acquired an OAuth 2.0 access_token from another place such as a JavaScript<br> |
| 89 | client or another web application, and wish to use it from Python. Because<br> |
| 90 | only the access_token is present it can not be refreshed and will in time<br> |
| 91 | expire.<br> |
| 92 | <br> |
Joe Gregorio | fffa7d7 | 2011-02-18 17:20:39 -0500 | [diff] [blame] | 93 | <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] | 94 | <br> |
| 95 | Usage:<br> |
| 96 | credentials = <a href="#AccessTokenCredentials">AccessTokenCredentials</a>('<an access token>',<br> |
| 97 | 'my-user-agent/1.0')<br> |
| 98 | http = httplib2.Http()<br> |
| 99 | http = credentials.<a href="#AccessTokenCredentials-authorize">authorize</a>(http)<br> |
| 100 | <br> |
| 101 | Exceptions:<br> |
| 102 | AccessTokenCredentialsExpired: raised when the access_token expires or is<br> |
| 103 | revoked.<br> </tt></td></tr> |
| 104 | <tr><td> </td> |
| 105 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 106 | <dd><a href="oauth2client.client.html#AccessTokenCredentials">AccessTokenCredentials</a></dd> |
| 107 | <dd><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a></dd> |
| 108 | <dd><a href="oauth2client.client.html#Credentials">Credentials</a></dd> |
| 109 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 110 | </dl> |
| 111 | <hr> |
| 112 | Methods defined here:<br> |
| 113 | <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> |
| 114 | <br> |
| 115 | This is one of the few types if <a href="#Credentials">Credentials</a> that you should contrust,<br> |
| 116 | <a href="#Credentials">Credentials</a> objects are usually instantiated by a <a href="#Flow">Flow</a>.<br> |
| 117 | <br> |
| 118 | Args:<br> |
Joe Gregorio | 9384170 | 2011-03-02 16:12:05 -0800 | [diff] [blame] | 119 | access_token: string, access token.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 120 | user_agent: string, The HTTP User-Agent to provide for this application.<br> |
| 121 | <br> |
| 122 | Notes:<br> |
| 123 | store: callable, a callable that when passed a Credential<br> |
| 124 | will store the credential back to where it came from.</tt></dd></dl> |
| 125 | |
| 126 | <hr> |
| 127 | Methods inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
| 128 | <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> |
| 129 | |
| 130 | <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> |
| 131 | |
| 132 | <dl><dt><a name="AccessTokenCredentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Authorize an httplib2.Http instance with these credentials.<br> |
| 133 | <br> |
| 134 | Args:<br> |
| 135 | http: An instance of httplib2.Http<br> |
| 136 | or something that acts like it.<br> |
| 137 | <br> |
| 138 | Returns:<br> |
| 139 | A modified instance of http that was passed in.<br> |
| 140 | <br> |
| 141 | Example:<br> |
| 142 | <br> |
| 143 | h = httplib2.Http()<br> |
| 144 | h = credentials.<a href="#AccessTokenCredentials-authorize">authorize</a>(h)<br> |
| 145 | <br> |
| 146 | You can't create a new OAuth<br> |
| 147 | subclass of httplib2.Authenication because<br> |
| 148 | it never gets passed the absolute URI, which is<br> |
| 149 | needed for signing. So instead we have to overload<br> |
| 150 | 'request' with a closure that adds in the<br> |
| 151 | Authorization header and then calls the original version<br> |
| 152 | of 'request()'.</tt></dd></dl> |
| 153 | |
| 154 | <dl><dt><a name="AccessTokenCredentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set the storage for the credential.<br> |
| 155 | <br> |
| 156 | Args:<br> |
| 157 | store: callable, a callable that when passed a Credential<br> |
| 158 | will store the credential back to where it came from.<br> |
| 159 | This is needed to store the latest access_token if it<br> |
| 160 | has expired and been refreshed.</tt></dd></dl> |
| 161 | |
| 162 | <hr> |
Joe Gregorio | 9ce4b62 | 2011-02-17 15:32:11 -0500 | [diff] [blame] | 163 | Data descriptors inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
| 164 | <dl><dt><strong>invalid</strong></dt> |
| 165 | <dd><tt>True if the credentials are invalid, such as being revoked.</tt></dd> |
| 166 | </dl> |
| 167 | <hr> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 168 | Data descriptors inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 169 | <dl><dt><strong>__dict__</strong></dt> |
| 170 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 171 | </dl> |
| 172 | <dl><dt><strong>__weakref__</strong></dt> |
| 173 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 174 | </dl> |
| 175 | </td></tr></table> <p> |
| 176 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 177 | <tr bgcolor="#ffc8d8"> |
| 178 | <td colspan=3 valign=bottom> <br> |
| 179 | <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> |
| 180 | |
| 181 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 182 | <td colspan=2><tt>Having only the access_token means no refresh is possible.<br> </tt></td></tr> |
| 183 | <tr><td> </td> |
| 184 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 185 | <dd><a href="oauth2client.client.html#AccessTokenCredentialsError">AccessTokenCredentialsError</a></dd> |
| 186 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 187 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 188 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 189 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 190 | </dl> |
| 191 | <hr> |
| 192 | Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br> |
| 193 | <dl><dt><strong>__weakref__</strong></dt> |
| 194 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 195 | </dl> |
| 196 | <hr> |
| 197 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 198 | <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] | 199 | |
| 200 | <hr> |
| 201 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 202 | <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> |
| 203 | |
| 204 | <hr> |
| 205 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 206 | <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> |
| 207 | |
| 208 | <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> |
| 209 | |
| 210 | <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> |
| 211 | |
| 212 | <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> |
| 213 | <br> |
| 214 | Use of negative indices is not supported.</tt></dd></dl> |
| 215 | |
| 216 | <dl><dt><a name="AccessTokenCredentialsError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 217 | |
| 218 | <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> |
| 219 | |
| 220 | <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> |
| 221 | |
| 222 | <dl><dt><a name="AccessTokenCredentialsError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 223 | |
| 224 | <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> |
| 225 | |
| 226 | <dl><dt><a name="AccessTokenCredentialsError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 227 | |
| 228 | <hr> |
| 229 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 230 | <dl><dt><strong>__dict__</strong></dt> |
| 231 | </dl> |
| 232 | <dl><dt><strong>args</strong></dt> |
| 233 | </dl> |
| 234 | <dl><dt><strong>message</strong></dt> |
| 235 | </dl> |
| 236 | </td></tr></table> <p> |
| 237 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 238 | <tr bgcolor="#ffc8d8"> |
| 239 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 240 | <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> |
| 241 | |
| 242 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | ad258e2 | 2011-02-22 22:53:30 -0500 | [diff] [blame] | 243 | <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] | 244 | <tr><td> </td> |
| 245 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 246 | <dd><a href="oauth2client.client.html#AccessTokenRefreshError">AccessTokenRefreshError</a></dd> |
| 247 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 248 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 249 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 250 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 251 | </dl> |
| 252 | <hr> |
| 253 | Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br> |
| 254 | <dl><dt><strong>__weakref__</strong></dt> |
| 255 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 256 | </dl> |
| 257 | <hr> |
| 258 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 259 | <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] | 260 | |
| 261 | <hr> |
| 262 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 263 | <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> |
| 264 | |
| 265 | <hr> |
| 266 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 267 | <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> |
| 268 | |
| 269 | <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> |
| 270 | |
| 271 | <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> |
| 272 | |
| 273 | <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> |
| 274 | <br> |
| 275 | Use of negative indices is not supported.</tt></dd></dl> |
| 276 | |
| 277 | <dl><dt><a name="AccessTokenRefreshError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 278 | |
| 279 | <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> |
| 280 | |
| 281 | <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> |
| 282 | |
| 283 | <dl><dt><a name="AccessTokenRefreshError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 284 | |
| 285 | <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> |
| 286 | |
| 287 | <dl><dt><a name="AccessTokenRefreshError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 288 | |
| 289 | <hr> |
| 290 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 291 | <dl><dt><strong>__dict__</strong></dt> |
| 292 | </dl> |
| 293 | <dl><dt><strong>args</strong></dt> |
| 294 | </dl> |
| 295 | <dl><dt><strong>message</strong></dt> |
| 296 | </dl> |
| 297 | </td></tr></table> <p> |
| 298 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 299 | <tr bgcolor="#ffc8d8"> |
| 300 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 301 | <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> |
| 302 | |
| 303 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 304 | <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> |
| 305 | <br> |
| 306 | This credential does not require a flow to instantiate because it represents<br> |
| 307 | a two legged flow, and therefore has all of the required information to<br> |
| 308 | generate and refresh its own access tokens. It must be subclassed to<br> |
| 309 | generate the appropriate assertion string.<br> |
| 310 | <br> |
| 311 | <a href="#AssertionCredentials">AssertionCredentials</a> objects may be safely pickled and unpickled.<br> </tt></td></tr> |
| 312 | <tr><td> </td> |
| 313 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 314 | <dd><a href="oauth2client.client.html#AssertionCredentials">AssertionCredentials</a></dd> |
| 315 | <dd><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a></dd> |
| 316 | <dd><a href="oauth2client.client.html#Credentials">Credentials</a></dd> |
| 317 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 318 | </dl> |
| 319 | <hr> |
| 320 | Methods defined here:<br> |
| 321 | <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>, **kwargs)</dt><dd><tt>Constructor for AssertionFlowCredentials<br> |
| 322 | <br> |
| 323 | Args:<br> |
| 324 | assertion_type: string, assertion type that will be declared to the auth<br> |
| 325 | server<br> |
| 326 | user_agent: string, The HTTP User-Agent to provide for this application.<br> |
| 327 | token_uri: string, URI for token endpoint. For convenience<br> |
| 328 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.</tt></dd></dl> |
| 329 | |
| 330 | <hr> |
| 331 | Methods inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
| 332 | <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> |
| 333 | |
| 334 | <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> |
| 335 | |
| 336 | <dl><dt><a name="AssertionCredentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Authorize an httplib2.Http instance with these credentials.<br> |
| 337 | <br> |
| 338 | Args:<br> |
| 339 | http: An instance of httplib2.Http<br> |
| 340 | or something that acts like it.<br> |
| 341 | <br> |
| 342 | Returns:<br> |
| 343 | A modified instance of http that was passed in.<br> |
| 344 | <br> |
| 345 | Example:<br> |
| 346 | <br> |
| 347 | h = httplib2.Http()<br> |
| 348 | h = credentials.<a href="#AssertionCredentials-authorize">authorize</a>(h)<br> |
| 349 | <br> |
| 350 | You can't create a new OAuth<br> |
| 351 | subclass of httplib2.Authenication because<br> |
| 352 | it never gets passed the absolute URI, which is<br> |
| 353 | needed for signing. So instead we have to overload<br> |
| 354 | 'request' with a closure that adds in the<br> |
| 355 | Authorization header and then calls the original version<br> |
| 356 | of 'request()'.</tt></dd></dl> |
| 357 | |
| 358 | <dl><dt><a name="AssertionCredentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set the storage for the credential.<br> |
| 359 | <br> |
| 360 | Args:<br> |
| 361 | store: callable, a callable that when passed a Credential<br> |
| 362 | will store the credential back to where it came from.<br> |
| 363 | This is needed to store the latest access_token if it<br> |
| 364 | has expired and been refreshed.</tt></dd></dl> |
| 365 | |
| 366 | <hr> |
| 367 | Data descriptors inherited from <a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a>:<br> |
| 368 | <dl><dt><strong>invalid</strong></dt> |
| 369 | <dd><tt>True if the credentials are invalid, such as being revoked.</tt></dd> |
| 370 | </dl> |
| 371 | <hr> |
| 372 | Data descriptors inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 373 | <dl><dt><strong>__dict__</strong></dt> |
| 374 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 375 | </dl> |
| 376 | <dl><dt><strong>__weakref__</strong></dt> |
| 377 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 378 | </dl> |
| 379 | </td></tr></table> <p> |
| 380 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 381 | <tr bgcolor="#ffc8d8"> |
| 382 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 383 | <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> |
| 384 | |
| 385 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 386 | <td colspan=2><tt>Base class for all <a href="#Credentials">Credentials</a> objects.<br> |
| 387 | <br> |
| 388 | Subclasses must define an <a href="#Credentials-authorize">authorize</a>() method<br> |
| 389 | that applies the credentials to an HTTP transport.<br> </tt></td></tr> |
| 390 | <tr><td> </td> |
| 391 | <td width="100%">Methods defined here:<br> |
| 392 | <dl><dt><a name="Credentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Take an httplib2.Http instance (or equivalent) and<br> |
| 393 | authorizes it for the set of credentials, usually by<br> |
| 394 | replacing http.request() with a method that adds in<br> |
| 395 | the appropriate headers and then delegates to the original<br> |
| 396 | Http.request() method.</tt></dd></dl> |
| 397 | |
| 398 | <hr> |
| 399 | Data descriptors defined here:<br> |
| 400 | <dl><dt><strong>__dict__</strong></dt> |
| 401 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 402 | </dl> |
| 403 | <dl><dt><strong>__weakref__</strong></dt> |
| 404 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 405 | </dl> |
| 406 | </td></tr></table> <p> |
| 407 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 408 | <tr bgcolor="#ffc8d8"> |
| 409 | <td colspan=3 valign=bottom> <br> |
| 410 | <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> |
| 411 | |
| 412 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 413 | <td colspan=2><tt>Base error for this module.<br> </tt></td></tr> |
| 414 | <tr><td> </td> |
| 415 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 416 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 417 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 418 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 419 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 420 | </dl> |
| 421 | <hr> |
| 422 | Data descriptors defined here:<br> |
| 423 | <dl><dt><strong>__weakref__</strong></dt> |
| 424 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 425 | </dl> |
| 426 | <hr> |
| 427 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 428 | <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] | 429 | |
| 430 | <hr> |
| 431 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 432 | <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> |
| 433 | |
| 434 | <hr> |
| 435 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 436 | <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> |
| 437 | |
| 438 | <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> |
| 439 | |
| 440 | <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> |
| 441 | |
| 442 | <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> |
| 443 | <br> |
| 444 | Use of negative indices is not supported.</tt></dd></dl> |
| 445 | |
| 446 | <dl><dt><a name="Error-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 447 | |
| 448 | <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> |
| 449 | |
| 450 | <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> |
| 451 | |
| 452 | <dl><dt><a name="Error-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 453 | |
| 454 | <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> |
| 455 | |
| 456 | <dl><dt><a name="Error-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 457 | |
| 458 | <hr> |
| 459 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 460 | <dl><dt><strong>__dict__</strong></dt> |
| 461 | </dl> |
| 462 | <dl><dt><strong>args</strong></dt> |
| 463 | </dl> |
| 464 | <dl><dt><strong>message</strong></dt> |
| 465 | </dl> |
| 466 | </td></tr></table> <p> |
| 467 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 468 | <tr bgcolor="#ffc8d8"> |
| 469 | <td colspan=3 valign=bottom> <br> |
| 470 | <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> |
| 471 | |
| 472 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 473 | <td colspan=2><tt>Base class for all <a href="#Flow">Flow</a> objects.<br> </tt></td></tr> |
| 474 | <tr><td> </td> |
| 475 | <td width="100%">Data descriptors defined here:<br> |
| 476 | <dl><dt><strong>__dict__</strong></dt> |
| 477 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 478 | </dl> |
| 479 | <dl><dt><strong>__weakref__</strong></dt> |
| 480 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 481 | </dl> |
| 482 | </td></tr></table> <p> |
| 483 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 484 | <tr bgcolor="#ffc8d8"> |
| 485 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 486 | <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> |
| 487 | |
| 488 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | ad258e2 | 2011-02-22 22:53:30 -0500 | [diff] [blame] | 489 | <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] | 490 | <tr><td> </td> |
| 491 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 492 | <dd><a href="oauth2client.client.html#FlowExchangeError">FlowExchangeError</a></dd> |
| 493 | <dd><a href="oauth2client.client.html#Error">Error</a></dd> |
| 494 | <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> |
| 495 | <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> |
| 496 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 497 | </dl> |
| 498 | <hr> |
| 499 | Data descriptors inherited from <a href="oauth2client.client.html#Error">Error</a>:<br> |
| 500 | <dl><dt><strong>__weakref__</strong></dt> |
| 501 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 502 | </dl> |
| 503 | <hr> |
| 504 | Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 505 | <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] | 506 | |
| 507 | <hr> |
| 508 | Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> |
| 509 | <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> |
| 510 | |
| 511 | <hr> |
| 512 | Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 513 | <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> |
| 514 | |
| 515 | <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> |
| 516 | |
| 517 | <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> |
| 518 | |
| 519 | <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> |
| 520 | <br> |
| 521 | Use of negative indices is not supported.</tt></dd></dl> |
| 522 | |
| 523 | <dl><dt><a name="FlowExchangeError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> |
| 524 | |
| 525 | <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> |
| 526 | |
| 527 | <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> |
| 528 | |
| 529 | <dl><dt><a name="FlowExchangeError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> |
| 530 | |
| 531 | <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> |
| 532 | |
| 533 | <dl><dt><a name="FlowExchangeError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> |
| 534 | |
| 535 | <hr> |
| 536 | Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> |
| 537 | <dl><dt><strong>__dict__</strong></dt> |
| 538 | </dl> |
| 539 | <dl><dt><strong>args</strong></dt> |
| 540 | </dl> |
| 541 | <dl><dt><strong>message</strong></dt> |
| 542 | </dl> |
| 543 | </td></tr></table> <p> |
| 544 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 545 | <tr bgcolor="#ffc8d8"> |
| 546 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 547 | <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> |
| 548 | |
| 549 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 550 | <td colspan=2><tt><a href="#Credentials">Credentials</a> <a href="__builtin__.html#object">object</a> for OAuth 2.0<br> |
| 551 | <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 552 | <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> |
| 553 | method, which then signs each request from that <a href="__builtin__.html#object">object</a> with the OAuth 2.0<br> |
| 554 | access token.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 555 | <br> |
| 556 | <a href="#OAuth2Credentials">OAuth2Credentials</a> objects may be safely pickled and unpickled.<br> </tt></td></tr> |
| 557 | <tr><td> </td> |
| 558 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 559 | <dd><a href="oauth2client.client.html#OAuth2Credentials">OAuth2Credentials</a></dd> |
| 560 | <dd><a href="oauth2client.client.html#Credentials">Credentials</a></dd> |
| 561 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 562 | </dl> |
| 563 | <hr> |
| 564 | Methods defined here:<br> |
| 565 | <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> |
| 566 | |
| 567 | <dl><dt><a name="OAuth2Credentials-__init__"><strong>__init__</strong></a>(self, access_token, client_id, client_secret, refresh_token, token_expiry, token_uri, user_agent)</dt><dd><tt>Create an instance of <a href="#OAuth2Credentials">OAuth2Credentials</a><br> |
| 568 | <br> |
| 569 | This constructor is not usually called by the user, instead<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 570 | <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] | 571 | <br> |
| 572 | Args:<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 573 | token_uri: string, URI of token endpoint.<br> |
| 574 | client_id: string, client identifier.<br> |
| 575 | client_secret: string, client secret.<br> |
| 576 | access_token: string, access token.<br> |
| 577 | token_expiry: datetime, when the access_token expires.<br> |
| 578 | refresh_token: string, refresh token.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 579 | user_agent: string, The HTTP User-Agent to provide for this application.<br> |
| 580 | <br> |
| 581 | <br> |
| 582 | Notes:<br> |
| 583 | store: callable, a callable that when passed a Credential<br> |
| 584 | will store the credential back to where it came from.<br> |
| 585 | This is needed to store the latest access_token if it<br> |
| 586 | has expired and been refreshed.</tt></dd></dl> |
| 587 | |
| 588 | <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> |
| 589 | |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 590 | <dl><dt><a name="OAuth2Credentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Authorize an httplib2.Http instance with these credentials.<br> |
| 591 | <br> |
| 592 | Args:<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 593 | http: An instance of httplib2.Http<br> |
| 594 | or something that acts like it.<br> |
| 595 | <br> |
| 596 | Returns:<br> |
| 597 | A modified instance of http that was passed in.<br> |
| 598 | <br> |
| 599 | Example:<br> |
| 600 | <br> |
| 601 | h = httplib2.Http()<br> |
| 602 | h = credentials.<a href="#OAuth2Credentials-authorize">authorize</a>(h)<br> |
| 603 | <br> |
| 604 | You can't create a new OAuth<br> |
| 605 | subclass of httplib2.Authenication because<br> |
| 606 | it never gets passed the absolute URI, which is<br> |
| 607 | needed for signing. So instead we have to overload<br> |
| 608 | 'request' with a closure that adds in the<br> |
| 609 | Authorization header and then calls the original version<br> |
| 610 | of 'request()'.</tt></dd></dl> |
| 611 | |
| 612 | <dl><dt><a name="OAuth2Credentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set the storage for the credential.<br> |
| 613 | <br> |
| 614 | Args:<br> |
| 615 | store: callable, a callable that when passed a Credential<br> |
| 616 | will store the credential back to where it came from.<br> |
| 617 | This is needed to store the latest access_token if it<br> |
| 618 | has expired and been refreshed.</tt></dd></dl> |
| 619 | |
| 620 | <hr> |
Joe Gregorio | 9ce4b62 | 2011-02-17 15:32:11 -0500 | [diff] [blame] | 621 | Data descriptors defined here:<br> |
| 622 | <dl><dt><strong>invalid</strong></dt> |
| 623 | <dd><tt>True if the credentials are invalid, such as being revoked.</tt></dd> |
| 624 | </dl> |
| 625 | <hr> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 626 | Data descriptors inherited from <a href="oauth2client.client.html#Credentials">Credentials</a>:<br> |
| 627 | <dl><dt><strong>__dict__</strong></dt> |
| 628 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 629 | </dl> |
| 630 | <dl><dt><strong>__weakref__</strong></dt> |
| 631 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 632 | </dl> |
| 633 | </td></tr></table> <p> |
| 634 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 635 | <tr bgcolor="#ffc8d8"> |
| 636 | <td colspan=3 valign=bottom> <br> |
| 637 | <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> |
| 638 | |
| 639 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 640 | <td colspan=2><tt>Does the Web Server <a href="#Flow">Flow</a> for OAuth 2.0.<br> |
| 641 | <br> |
| 642 | <a href="#OAuth2Credentials">OAuth2Credentials</a> objects may be safely pickled and unpickled.<br> </tt></td></tr> |
| 643 | <tr><td> </td> |
| 644 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 645 | <dd><a href="oauth2client.client.html#OAuth2WebServerFlow">OAuth2WebServerFlow</a></dd> |
| 646 | <dd><a href="oauth2client.client.html#Flow">Flow</a></dd> |
| 647 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 648 | </dl> |
| 649 | <hr> |
| 650 | Methods defined here:<br> |
Joe Gregorio | 4258d6b | 2011-03-18 10:20:16 -0400 | [diff] [blame] | 651 | <dl><dt><a name="OAuth2WebServerFlow-__init__"><strong>__init__</strong></a>(self, client_id, client_secret, scope, user_agent, 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] | 652 | <br> |
| 653 | Args:<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 654 | client_id: string, client identifier.<br> |
| 655 | client_secret: string client secret.<br> |
| 656 | scope: string, scope of the credentials being requested.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 657 | user_agent: string, HTTP User-Agent to provide for this application.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 658 | auth_uri: string, URI for authorization endpoint. For convenience<br> |
| 659 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.<br> |
| 660 | token_uri: string, URI for token endpoint. For convenience<br> |
| 661 | 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] | 662 | **kwargs: dict, The keyword arguments are all optional and required<br> |
| 663 | parameters for the OAuth calls.</tt></dd></dl> |
| 664 | |
| 665 | <dl><dt><a name="OAuth2WebServerFlow-step1_get_authorize_url"><strong>step1_get_authorize_url</strong></a>(self, redirect_uri<font color="#909090">='oob'</font>)</dt><dd><tt>Returns a URI to redirect to the provider.<br> |
| 666 | <br> |
| 667 | Args:<br> |
| 668 | redirect_uri: string, Either the string 'oob' for a non-web-based<br> |
| 669 | application, or a URI that handles the callback from<br> |
| 670 | the authorization server.<br> |
| 671 | <br> |
| 672 | If redirect_uri is 'oob' then pass in the<br> |
| 673 | generated verification code to step2_exchange,<br> |
| 674 | otherwise pass in the query parameters received<br> |
| 675 | at the callback uri to step2_exchange.</tt></dd></dl> |
| 676 | |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 677 | <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] | 678 | <br> |
| 679 | Args:<br> |
| 680 | code: string or dict, either the code as a string, or a dictionary<br> |
| 681 | of the query parameters to the redirect_uri, which contains<br> |
Joe Gregorio | f826111 | 2011-02-19 14:51:56 -0500 | [diff] [blame] | 682 | the code.<br> |
| 683 | http: httplib2.Http, optional http instance to use to do the fetch</tt></dd></dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 684 | |
| 685 | <hr> |
| 686 | Data descriptors inherited from <a href="oauth2client.client.html#Flow">Flow</a>:<br> |
| 687 | <dl><dt><strong>__dict__</strong></dt> |
| 688 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 689 | </dl> |
| 690 | <dl><dt><strong>__weakref__</strong></dt> |
| 691 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 692 | </dl> |
| 693 | </td></tr></table> <p> |
| 694 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 695 | <tr bgcolor="#ffc8d8"> |
| 696 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 697 | <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> |
| 698 | |
| 699 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 700 | <td colspan=2><tt>Base class for all <a href="#Storage">Storage</a> objects.<br> |
| 701 | <br> |
| 702 | Store and retrieve a single credential.<br> </tt></td></tr> |
| 703 | <tr><td> </td> |
| 704 | <td width="100%">Methods defined here:<br> |
| 705 | <dl><dt><a name="Storage-get"><strong>get</strong></a>(self)</dt><dd><tt>Retrieve credential.<br> |
| 706 | <br> |
| 707 | Returns:<br> |
Joe Gregorio | 20a5aa9 | 2011-04-01 17:44:25 -0400 | [diff] [blame] | 708 | oauth2client.client.<a href="#Credentials">Credentials</a></tt></dd></dl> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 709 | |
| 710 | <dl><dt><a name="Storage-put"><strong>put</strong></a>(self, credentials)</dt><dd><tt>Write a credential.<br> |
| 711 | <br> |
| 712 | Args:<br> |
| 713 | credentials: <a href="#Credentials">Credentials</a>, the credentials to store.</tt></dd></dl> |
| 714 | |
| 715 | <hr> |
| 716 | Data descriptors defined here:<br> |
| 717 | <dl><dt><strong>__dict__</strong></dt> |
| 718 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 719 | </dl> |
| 720 | <dl><dt><strong>__weakref__</strong></dt> |
| 721 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 722 | </dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 723 | </td></tr></table></td></tr></table><p> |
| 724 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 725 | <tr bgcolor="#55aa55"> |
| 726 | <td colspan=3 valign=bottom> <br> |
| 727 | <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> |
| 728 | |
| 729 | <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> |
| 730 | <td width="100%"><strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'</td></tr></table><p> |
| 731 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 732 | <tr bgcolor="#7799ee"> |
| 733 | <td colspan=3 valign=bottom> <br> |
| 734 | <font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr> |
| 735 | |
| 736 | <tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td> |
| 737 | <td width="100%">jcgregorio@google.com (Joe Gregorio)</td></tr></table> |
| 738 | </body></html> |