Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 1 | <?xml version="1.0" encoding="ascii"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 3 | "DTD/xhtml1-transitional.dtd"> |
| 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 5 | <head> |
| 6 | <title>oauth2client.clientsecrets</title> |
| 7 | <link rel="stylesheet" href="epydoc.css" type="text/css" /> |
| 8 | <script type="text/javascript" src="epydoc.js"></script> |
| 9 | </head> |
| 10 | |
| 11 | <body bgcolor="white" text="black" link="blue" vlink="#204080" |
| 12 | alink="#204080"> |
| 13 | <!-- ==================== NAVIGATION BAR ==================== --> |
| 14 | <table class="navbar" border="0" width="100%" cellpadding="0" |
| 15 | bgcolor="#a0c0ff" cellspacing="0"> |
| 16 | <tr valign="middle"> |
| 17 | |
| 18 | <!-- Tree link --> |
| 19 | <th> <a |
| 20 | href="module-tree.html">Trees</a> </th> |
| 21 | |
| 22 | <!-- Index link --> |
| 23 | <th> <a |
| 24 | href="identifier-index.html">Indices</a> </th> |
| 25 | |
| 26 | <!-- Help link --> |
| 27 | <th> <a |
| 28 | href="help.html">Help</a> </th> |
| 29 | |
| 30 | <th class="navbar" width="100%"></th> |
| 31 | </tr> |
| 32 | </table> |
| 33 | <table width="100%" cellpadding="0" cellspacing="0"> |
| 34 | <tr valign="top"> |
| 35 | <td width="100%"> |
| 36 | <span class="breadcrumbs"> |
| 37 | <a href="oauth2client-module.html">Package oauth2client</a> :: |
| 38 | Module clientsecrets |
| 39 | </span> |
| 40 | </td> |
| 41 | <td> |
| 42 | <table cellpadding="0" cellspacing="0"> |
| 43 | <!-- hide/show private --> |
| 44 | <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" |
| 45 | onclick="toggle_private();">hide private</a>]</span></td></tr> |
| 46 | <tr><td align="right"><span class="options" |
| 47 | >[<a href="frames.html" target="_top">frames</a |
| 48 | >] | <a href="oauth2client.clientsecrets-module.html" |
| 49 | target="_top">no frames</a>]</span></td></tr> |
| 50 | </table> |
| 51 | </td> |
| 52 | </tr> |
| 53 | </table> |
| 54 | <!-- ==================== MODULE DESCRIPTION ==================== --> |
| 55 | <h1 class="epydoc">Module clientsecrets</h1><p class="nomargin-top"><span class="codelink"><a href="oauth2client.clientsecrets-pysrc.html">source code</a></span></p> |
| 56 | <pre class="literalblock"> |
| 57 | Utilities for reading OAuth 2.0 client secret files. |
| 58 | |
| 59 | A client_secrets.json file contains all the information needed to interact with |
| 60 | an OAuth 2.0 protected service. |
| 61 | |
| 62 | </pre> |
| 63 | |
| 64 | <hr /> |
| 65 | <div class="fields"> <p><strong>Author:</strong> |
| 66 | jcgregorio@google.com (Joe Gregorio) |
| 67 | </p> |
| 68 | </div><!-- ==================== CLASSES ==================== --> |
| 69 | <a name="section-Classes"></a> |
| 70 | <table class="summary" border="1" cellpadding="3" |
| 71 | cellspacing="0" width="100%" bgcolor="white"> |
| 72 | <tr bgcolor="#70b0f0" class="table-header"> |
| 73 | <td colspan="2" class="table-header"> |
| 74 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 75 | <tr valign="top"> |
| 76 | <td align="left"><span class="table-header">Classes</span></td> |
| 77 | <td align="right" valign="top" |
| 78 | ><span class="options">[<a href="#section-Classes" |
| 79 | class="privatelink" onclick="toggle_private();" |
| 80 | >hide private</a>]</span></td> |
| 81 | </tr> |
| 82 | </table> |
| 83 | </td> |
| 84 | </tr> |
| 85 | <tr> |
| 86 | <td width="15%" align="right" valign="top" class="summary"> |
| 87 | <span class="summary-type"> </span> |
| 88 | </td><td class="summary"> |
| 89 | <a href="oauth2client.clientsecrets.Error-class.html" class="summary-name">Error</a><br /> |
| 90 | Base error for this module. |
| 91 | </td> |
| 92 | </tr> |
| 93 | <tr> |
| 94 | <td width="15%" align="right" valign="top" class="summary"> |
| 95 | <span class="summary-type"> </span> |
| 96 | </td><td class="summary"> |
| 97 | <a href="oauth2client.clientsecrets.InvalidClientSecretsError-class.html" class="summary-name">InvalidClientSecretsError</a><br /> |
| 98 | Format of ClientSecrets file is invalid. |
| 99 | </td> |
| 100 | </tr> |
| 101 | </table> |
| 102 | <!-- ==================== FUNCTIONS ==================== --> |
| 103 | <a name="section-Functions"></a> |
| 104 | <table class="summary" border="1" cellpadding="3" |
| 105 | cellspacing="0" width="100%" bgcolor="white"> |
| 106 | <tr bgcolor="#70b0f0" class="table-header"> |
| 107 | <td colspan="2" class="table-header"> |
| 108 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 109 | <tr valign="top"> |
| 110 | <td align="left"><span class="table-header">Functions</span></td> |
| 111 | <td align="right" valign="top" |
| 112 | ><span class="options">[<a href="#section-Functions" |
| 113 | class="privatelink" onclick="toggle_private();" |
| 114 | >hide private</a>]</span></td> |
| 115 | </tr> |
| 116 | </table> |
| 117 | </td> |
| 118 | </tr> |
| 119 | <tr class="private"> |
| 120 | <td width="15%" align="right" valign="top" class="summary"> |
| 121 | <span class="summary-type"> </span> |
| 122 | </td><td class="summary"> |
| 123 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 124 | <tr> |
| 125 | <td><span class="summary-sig"><a name="_validate_clientsecrets"></a><span class="summary-sig-name">_validate_clientsecrets</span>(<span class="summary-sig-arg">obj</span>)</span></td> |
| 126 | <td align="right" valign="top"> |
| 127 | <span class="codelink"><a href="oauth2client.clientsecrets-pysrc.html#_validate_clientsecrets">source code</a></span> |
| 128 | |
| 129 | </td> |
| 130 | </tr> |
| 131 | </table> |
| 132 | |
| 133 | </td> |
| 134 | </tr> |
| 135 | <tr> |
| 136 | <td width="15%" align="right" valign="top" class="summary"> |
| 137 | <span class="summary-type"> </span> |
| 138 | </td><td class="summary"> |
| 139 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 140 | <tr> |
| 141 | <td><span class="summary-sig"><a name="load"></a><span class="summary-sig-name">load</span>(<span class="summary-sig-arg">fp</span>)</span></td> |
| 142 | <td align="right" valign="top"> |
| 143 | <span class="codelink"><a href="oauth2client.clientsecrets-pysrc.html#load">source code</a></span> |
| 144 | |
| 145 | </td> |
| 146 | </tr> |
| 147 | </table> |
| 148 | |
| 149 | </td> |
| 150 | </tr> |
| 151 | <tr> |
| 152 | <td width="15%" align="right" valign="top" class="summary"> |
| 153 | <span class="summary-type"> </span> |
| 154 | </td><td class="summary"> |
| 155 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 156 | <tr> |
| 157 | <td><span class="summary-sig"><a name="loads"></a><span class="summary-sig-name">loads</span>(<span class="summary-sig-arg">s</span>)</span></td> |
| 158 | <td align="right" valign="top"> |
| 159 | <span class="codelink"><a href="oauth2client.clientsecrets-pysrc.html#loads">source code</a></span> |
| 160 | |
| 161 | </td> |
| 162 | </tr> |
| 163 | </table> |
| 164 | |
| 165 | </td> |
| 166 | </tr> |
Joe Gregorio | fa08c2e | 2012-07-23 16:52:03 -0400 | [diff] [blame^] | 167 | <tr class="private"> |
| 168 | <td width="15%" align="right" valign="top" class="summary"> |
| 169 | <span class="summary-type"> </span> |
| 170 | </td><td class="summary"> |
| 171 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 172 | <tr> |
| 173 | <td><span class="summary-sig"><a name="_loadfile"></a><span class="summary-sig-name">_loadfile</span>(<span class="summary-sig-arg">filename</span>)</span></td> |
| 174 | <td align="right" valign="top"> |
| 175 | <span class="codelink"><a href="oauth2client.clientsecrets-pysrc.html#_loadfile">source code</a></span> |
| 176 | |
| 177 | </td> |
| 178 | </tr> |
| 179 | </table> |
| 180 | |
| 181 | </td> |
| 182 | </tr> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 183 | <tr> |
| 184 | <td width="15%" align="right" valign="top" class="summary"> |
| 185 | <span class="summary-type"> </span> |
| 186 | </td><td class="summary"> |
| 187 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 188 | <tr> |
Joe Gregorio | fa08c2e | 2012-07-23 16:52:03 -0400 | [diff] [blame^] | 189 | <td><span class="summary-sig"><a href="oauth2client.clientsecrets-module.html#loadfile" class="summary-sig-name">loadfile</a>(<span class="summary-sig-arg">filename</span>, |
| 190 | <span class="summary-sig-arg">cache</span>=<span class="summary-sig-default">None</span>)</span><br /> |
| 191 | Loading of client_secrets JSON file, optionally backed by a cache.</td> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 192 | <td align="right" valign="top"> |
| 193 | <span class="codelink"><a href="oauth2client.clientsecrets-pysrc.html#loadfile">source code</a></span> |
| 194 | |
| 195 | </td> |
| 196 | </tr> |
| 197 | </table> |
| 198 | |
| 199 | </td> |
| 200 | </tr> |
| 201 | </table> |
| 202 | <!-- ==================== VARIABLES ==================== --> |
| 203 | <a name="section-Variables"></a> |
| 204 | <table class="summary" border="1" cellpadding="3" |
| 205 | cellspacing="0" width="100%" bgcolor="white"> |
| 206 | <tr bgcolor="#70b0f0" class="table-header"> |
| 207 | <td colspan="2" class="table-header"> |
| 208 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 209 | <tr valign="top"> |
| 210 | <td align="left"><span class="table-header">Variables</span></td> |
| 211 | <td align="right" valign="top" |
| 212 | ><span class="options">[<a href="#section-Variables" |
| 213 | class="privatelink" onclick="toggle_private();" |
| 214 | >hide private</a>]</span></td> |
| 215 | </tr> |
| 216 | </table> |
| 217 | </td> |
| 218 | </tr> |
| 219 | <tr> |
| 220 | <td width="15%" align="right" valign="top" class="summary"> |
| 221 | <span class="summary-type"> </span> |
| 222 | </td><td class="summary"> |
| 223 | <a name="TYPE_WEB"></a><span class="summary-name">TYPE_WEB</span> = <code title="'web'"><code class="variable-quote">'</code><code class="variable-string">web</code><code class="variable-quote">'</code></code> |
| 224 | </td> |
| 225 | </tr> |
| 226 | <tr> |
| 227 | <td width="15%" align="right" valign="top" class="summary"> |
| 228 | <span class="summary-type"> </span> |
| 229 | </td><td class="summary"> |
| 230 | <a name="TYPE_INSTALLED"></a><span class="summary-name">TYPE_INSTALLED</span> = <code title="'installed'"><code class="variable-quote">'</code><code class="variable-string">installed</code><code class="variable-quote">'</code></code> |
| 231 | </td> |
| 232 | </tr> |
| 233 | <tr> |
| 234 | <td width="15%" align="right" valign="top" class="summary"> |
| 235 | <span class="summary-type"> </span> |
| 236 | </td><td class="summary"> |
| 237 | <a href="oauth2client.clientsecrets-module.html#VALID_CLIENT" class="summary-name">VALID_CLIENT</a> = <code title="{'installed': {'required': ['client_id', |
| 238 | 'client_secret', |
| 239 | 'redirect_uris', |
| 240 | 'auth_uri', |
| 241 | 'token_uri'], |
| 242 | 'string': ['client_id', 'client_secret']}, |
| 243 | 'web': {'required': ['client_id', |
| 244 | 'client_secret', |
| 245 | ..."><code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">installed</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">required</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-group">[</code><code class="variable-quote">'</code><code class="variable-string">client_id</code><code class="variable-quote">'</code><code class="variable-op">, </code><code class="variable-quote">'</code><code class="variable-string">clien</code><code class="variable-ellipsis">...</code></code> |
| 246 | </td> |
| 247 | </tr> |
| 248 | <tr> |
| 249 | <td width="15%" align="right" valign="top" class="summary"> |
| 250 | <span class="summary-type"> </span> |
| 251 | </td><td class="summary"> |
| 252 | <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="'oauth2client'"><code class="variable-quote">'</code><code class="variable-string">oauth2client</code><code class="variable-quote">'</code></code> |
| 253 | </td> |
| 254 | </tr> |
| 255 | </table> |
Joe Gregorio | fa08c2e | 2012-07-23 16:52:03 -0400 | [diff] [blame^] | 256 | <!-- ==================== FUNCTION DETAILS ==================== --> |
| 257 | <a name="section-FunctionDetails"></a> |
| 258 | <table class="details" border="1" cellpadding="3" |
| 259 | cellspacing="0" width="100%" bgcolor="white"> |
| 260 | <tr bgcolor="#70b0f0" class="table-header"> |
| 261 | <td colspan="2" class="table-header"> |
| 262 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 263 | <tr valign="top"> |
| 264 | <td align="left"><span class="table-header">Function Details</span></td> |
| 265 | <td align="right" valign="top" |
| 266 | ><span class="options">[<a href="#section-FunctionDetails" |
| 267 | class="privatelink" onclick="toggle_private();" |
| 268 | >hide private</a>]</span></td> |
| 269 | </tr> |
| 270 | </table> |
| 271 | </td> |
| 272 | </tr> |
| 273 | </table> |
| 274 | <a name="loadfile"></a> |
| 275 | <div> |
| 276 | <table class="details" border="1" cellpadding="3" |
| 277 | cellspacing="0" width="100%" bgcolor="white"> |
| 278 | <tr><td> |
| 279 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 280 | <tr valign="top"><td> |
| 281 | <h3 class="epydoc"><span class="sig"><span class="sig-name">loadfile</span>(<span class="sig-arg">filename</span>, |
| 282 | <span class="sig-arg">cache</span>=<span class="sig-default">None</span>)</span> |
| 283 | </h3> |
| 284 | </td><td align="right" valign="top" |
| 285 | ><span class="codelink"><a href="oauth2client.clientsecrets-pysrc.html#loadfile">source code</a></span> |
| 286 | </td> |
| 287 | </tr></table> |
| 288 | |
| 289 | <pre class="literalblock"> |
| 290 | Loading of client_secrets JSON file, optionally backed by a cache. |
| 291 | |
| 292 | Typical cache storage would be App Engine memcache service, |
| 293 | but you can pass in any other cache client that implements |
| 294 | these methods: |
| 295 | - get(key, namespace=ns) |
| 296 | - set(key, value, namespace=ns) |
| 297 | |
| 298 | Usage: |
| 299 | # without caching |
| 300 | client_type, client_info = loadfile('secrets.json') |
| 301 | # using App Engine memcache service |
| 302 | from google.appengine.api import memcache |
| 303 | client_type, client_info = loadfile('secrets.json', cache=memcache) |
| 304 | |
| 305 | Args: |
| 306 | filename: string, Path to a client_secrets.json file on a filesystem. |
| 307 | cache: An optional cache service client that implements get() and set() |
| 308 | methods. If not specified, the file is always being loaded from |
| 309 | a filesystem. |
| 310 | |
| 311 | Raises: |
| 312 | InvalidClientSecretsError: In case of a validation error or some |
| 313 | I/O failure. Can happen only on cache miss. |
| 314 | |
| 315 | Returns: |
| 316 | (client_type, client_info) tuple, as _loadfile() normally would. |
| 317 | JSON contents is validated only during first load. Cache hits are not |
| 318 | validated. |
| 319 | |
| 320 | </pre> |
| 321 | <dl class="fields"> |
| 322 | </dl> |
| 323 | </td></tr></table> |
| 324 | </div> |
| 325 | <br /> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 326 | <!-- ==================== VARIABLES DETAILS ==================== --> |
| 327 | <a name="section-VariablesDetails"></a> |
| 328 | <table class="details" border="1" cellpadding="3" |
| 329 | cellspacing="0" width="100%" bgcolor="white"> |
| 330 | <tr bgcolor="#70b0f0" class="table-header"> |
| 331 | <td colspan="2" class="table-header"> |
| 332 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 333 | <tr valign="top"> |
| 334 | <td align="left"><span class="table-header">Variables Details</span></td> |
| 335 | <td align="right" valign="top" |
| 336 | ><span class="options">[<a href="#section-VariablesDetails" |
| 337 | class="privatelink" onclick="toggle_private();" |
| 338 | >hide private</a>]</span></td> |
| 339 | </tr> |
| 340 | </table> |
| 341 | </td> |
| 342 | </tr> |
| 343 | </table> |
| 344 | <a name="VALID_CLIENT"></a> |
| 345 | <div> |
| 346 | <table class="details" border="1" cellpadding="3" |
| 347 | cellspacing="0" width="100%" bgcolor="white"> |
| 348 | <tr><td> |
| 349 | <h3 class="epydoc">VALID_CLIENT</h3> |
| 350 | |
| 351 | <dl class="fields"> |
| 352 | </dl> |
| 353 | <dl class="fields"> |
| 354 | <dt>Value:</dt> |
| 355 | <dd><table><tr><td><pre class="variable"> |
| 356 | <code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">installed</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">required</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-group">[</code><code class="variable-quote">'</code><code class="variable-string">client_id</code><code class="variable-quote">'</code><code class="variable-op">,</code> |
| 357 | <code class="variable-quote">'</code><code class="variable-string">client_secret</code><code class="variable-quote">'</code><code class="variable-op">,</code> |
| 358 | <code class="variable-quote">'</code><code class="variable-string">redirect_uris</code><code class="variable-quote">'</code><code class="variable-op">,</code> |
| 359 | <code class="variable-quote">'</code><code class="variable-string">auth_uri</code><code class="variable-quote">'</code><code class="variable-op">,</code> |
| 360 | <code class="variable-quote">'</code><code class="variable-string">token_uri</code><code class="variable-quote">'</code><code class="variable-group">]</code><code class="variable-op">,</code> |
| 361 | <code class="variable-quote">'</code><code class="variable-string">string</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-group">[</code><code class="variable-quote">'</code><code class="variable-string">client_id</code><code class="variable-quote">'</code><code class="variable-op">, </code><code class="variable-quote">'</code><code class="variable-string">client_secret</code><code class="variable-quote">'</code><code class="variable-group">]</code><code class="variable-group">}</code><code class="variable-op">,</code> |
| 362 | <code class="variable-quote">'</code><code class="variable-string">web</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">required</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-group">[</code><code class="variable-quote">'</code><code class="variable-string">client_id</code><code class="variable-quote">'</code><code class="variable-op">,</code> |
| 363 | <code class="variable-quote">'</code><code class="variable-string">client_secret</code><code class="variable-quote">'</code><code class="variable-op">,</code> |
| 364 | <code class="variable-ellipsis">...</code> |
| 365 | </pre></td></tr></table> |
| 366 | </dd> |
| 367 | </dl> |
| 368 | </td></tr></table> |
| 369 | </div> |
| 370 | <br /> |
| 371 | <!-- ==================== NAVIGATION BAR ==================== --> |
| 372 | <table class="navbar" border="0" width="100%" cellpadding="0" |
| 373 | bgcolor="#a0c0ff" cellspacing="0"> |
| 374 | <tr valign="middle"> |
| 375 | |
| 376 | <!-- Tree link --> |
| 377 | <th> <a |
| 378 | href="module-tree.html">Trees</a> </th> |
| 379 | |
| 380 | <!-- Index link --> |
| 381 | <th> <a |
| 382 | href="identifier-index.html">Indices</a> </th> |
| 383 | |
| 384 | <!-- Help link --> |
| 385 | <th> <a |
| 386 | href="help.html">Help</a> </th> |
| 387 | |
| 388 | <th class="navbar" width="100%"></th> |
| 389 | </tr> |
| 390 | </table> |
| 391 | <table border="0" cellpadding="0" cellspacing="0" width="100%%"> |
| 392 | <tr> |
| 393 | <td align="left" class="footer"> |
Joe Gregorio | fa08c2e | 2012-07-23 16:52:03 -0400 | [diff] [blame^] | 394 | Generated by Epydoc 3.0.1 on Mon Jul 23 15:49:56 2012 |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 395 | </td> |
| 396 | <td align="right" class="footer"> |
| 397 | <a target="mainFrame" href="http://epydoc.sourceforge.net" |
| 398 | >http://epydoc.sourceforge.net</a> |
| 399 | </td> |
| 400 | </tr> |
| 401 | </table> |
| 402 | |
| 403 | <script type="text/javascript"> |
| 404 | <!-- |
| 405 | // Private objects are initially displayed (because if |
| 406 | // javascript is turned off then we want them to be |
| 407 | // visible); but by default, we want to hide them. So hide |
| 408 | // them unless we have a cookie that says to show them. |
| 409 | checkCookie(); |
| 410 | // --> |
| 411 | </script> |
| 412 | </body> |
| 413 | </html> |