blob: 757871fb98b0fb3dbc02e6abd43f1b7c43052d46 [file] [log] [blame]
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>oauth2client.client</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Tree link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Index link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Help link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
<th class="navbar" width="100%"></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
<a href="oauth2client-module.html">Package&nbsp;oauth2client</a> ::
Module&nbsp;client
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>]&nbsp;|&nbsp;<a href="oauth2client.client-module.html"
target="_top">no&nbsp;frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module client</h1><p class="nomargin-top"><span class="codelink"><a href="oauth2client.client-pysrc.html">source&nbsp;code</a></span></p>
<pre class="literalblock">
An OAuth 2.0 client.
Tools for interacting with OAuth 2.0 protected resources.
</pre>
<hr />
<div class="fields"> <p><strong>Author:</strong>
jcgregorio@google.com (Joe Gregorio)
</p>
</div><!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Classes</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Classes"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.Error-class.html" class="summary-name">Error</a><br />
Base error for this module.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.FlowExchangeError-class.html" class="summary-name">FlowExchangeError</a><br />
Error trying to exchange an authorization grant for an access token.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.AccessTokenRefreshError-class.html" class="summary-name">AccessTokenRefreshError</a><br />
Error trying to refresh an expired access token.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.UnknownClientSecretsFlowError-class.html" class="summary-name">UnknownClientSecretsFlowError</a><br />
The client secrets file called for an unknown type of OAuth 2.0 flow.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.AccessTokenCredentialsError-class.html" class="summary-name">AccessTokenCredentialsError</a><br />
Having only the access_token means no refresh is possible.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.VerifyJwtTokenError-class.html" class="summary-name">VerifyJwtTokenError</a><br />
Could on retrieve certificates for validation.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.MemoryCache-class.html" class="summary-name">MemoryCache</a><br />
httplib2 Cache implementation which only caches locally.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.Credentials-class.html" class="summary-name">Credentials</a><br />
Base class for all Credentials objects.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.Flow-class.html" class="summary-name">Flow</a><br />
Base class for all Flow objects.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.Storage-class.html" class="summary-name">Storage</a><br />
Base class for all Storage objects.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.OAuth2Credentials-class.html" class="summary-name">OAuth2Credentials</a><br />
Credentials object for OAuth 2.0.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.AccessTokenCredentials-class.html" class="summary-name">AccessTokenCredentials</a><br />
Credentials object for OAuth 2.0.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.AssertionCredentials-class.html" class="summary-name">AssertionCredentials</a><br />
Abstract Credentials object used for OAuth 2.0 assertion grants.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.SignedJwtAssertionCredentials-class.html" class="summary-name">SignedJwtAssertionCredentials</a><br />
Credentials object used for OAuth 2.0 Signed JWT assertion grants.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client.OAuth2WebServerFlow-class.html" class="summary-name">OAuth2WebServerFlow</a><br />
Does the Web Server Flow for OAuth 2.0.
</td>
</tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Functions</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Functions"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="_abstract"></a><span class="summary-sig-name">_abstract</span>()</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="oauth2client.client-pysrc.html#_abstract">source&nbsp;code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="oauth2client.client-module.html#verify_id_token" class="summary-sig-name">verify_id_token</a>(<span class="summary-sig-arg">id_token</span>,
<span class="summary-sig-arg">audience</span>,
<span class="summary-sig-arg">http</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">cert_uri</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">https://www.googleapis.com/oauth2/v1/certs</code><code class="variable-quote">'</code></span>)</span><br />
Verifies a signed JWT id_token.</td>
<td align="right" valign="top">
<span class="codelink"><a href="oauth2client.client-pysrc.html#verify_id_token">source&nbsp;code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="_urlsafe_b64decode"></a><span class="summary-sig-name">_urlsafe_b64decode</span>(<span class="summary-sig-arg">b64string</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="oauth2client.client-pysrc.html#_urlsafe_b64decode">source&nbsp;code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="oauth2client.client-module.html#_extract_id_token" class="summary-sig-name" onclick="show_private();">_extract_id_token</a>(<span class="summary-sig-arg">id_token</span>)</span><br />
Extract the JSON payload from a JWT.</td>
<td align="right" valign="top">
<span class="codelink"><a href="oauth2client.client-pysrc.html#_extract_id_token">source&nbsp;code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="oauth2client.client-module.html#flow_from_clientsecrets" class="summary-sig-name">flow_from_clientsecrets</a>(<span class="summary-sig-arg">filename</span>,
<span class="summary-sig-arg">scope</span>,
<span class="summary-sig-arg">message</span>=<span class="summary-sig-default">None</span>)</span><br />
Create a Flow from a clientsecrets file.</td>
<td align="right" valign="top">
<span class="codelink"><a href="oauth2client.client-pysrc.html#flow_from_clientsecrets">source&nbsp;code</a></span>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Variables</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Variables"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="HAS_OPENSSL"></a><span class="summary-name">HAS_OPENSSL</span> = <code title="True">True</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="logger"></a><span class="summary-name">logger</span> = <code title="logging.getLogger(__name__)">logging.getLogger(__name__)</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="EXPIRY_FORMAT"></a><span class="summary-name">EXPIRY_FORMAT</span> = <code title="'%Y-%m-%dT%H:%M:%SZ'"><code class="variable-quote">'</code><code class="variable-string">%Y-%m-%dT%H:%M:%SZ</code><code class="variable-quote">'</code></code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a href="oauth2client.client-module.html#ID_TOKEN_VERIFICATON_CERTS" class="summary-name">ID_TOKEN_VERIFICATON_CERTS</a> = <code title="'https://www.googleapis.com/oauth2/v1/certs'"><code class="variable-quote">'</code><code class="variable-string">https://www.googleapis.com/oauth</code><code class="variable-ellipsis">...</code></code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="OOB_CALLBACK_URN"></a><span class="summary-name">OOB_CALLBACK_URN</span> = <code title="'urn:ietf:wg:oauth:2.0:oob'"><code class="variable-quote">'</code><code class="variable-string">urn:ietf:wg:oauth:2.0:oob</code><code class="variable-quote">'</code></code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="_cached_http"></a><span class="summary-name">_cached_http</span> = <code title="httplib2.Http(MemoryCache())">httplib2.Http(MemoryCache())</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<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>
</td>
</tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Function Details</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-FunctionDetails"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="verify_id_token"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">verify_id_token</span>(<span class="sig-arg">id_token</span>,
<span class="sig-arg">audience</span>,
<span class="sig-arg">http</span>=<span class="sig-default">None</span>,
<span class="sig-arg">cert_uri</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">https://www.googleapis.com/oauth2/v1/certs</code><code class="variable-quote">'</code></span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="oauth2client.client-pysrc.html#verify_id_token">source&nbsp;code</a></span>&nbsp;
</td>
</tr></table>
<pre class="literalblock">
Verifies a signed JWT id_token.
Args:
id_token: string, A Signed JWT.
audience: string, The audience 'aud' that the token should be for.
http: httplib2.Http, instance to use to make the HTTP request. Callers
should supply an instance that has caching enabled.
cert_uri: string, URI of the certificates in JSON format to
verify the JWT against.
Returns:
The deserialized JSON in the JWT.
Raises:
oauth2client.crypt.AppIdentityError if the JWT fails to verify.
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="_extract_id_token"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">_extract_id_token</span>(<span class="sig-arg">id_token</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="oauth2client.client-pysrc.html#_extract_id_token">source&nbsp;code</a></span>&nbsp;
</td>
</tr></table>
<pre class="literalblock">
Extract the JSON payload from a JWT.
Does the extraction w/o checking the signature.
Args:
id_token: string, OAuth 2.0 id_token.
Returns:
object, The deserialized JSON payload.
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="flow_from_clientsecrets"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">flow_from_clientsecrets</span>(<span class="sig-arg">filename</span>,
<span class="sig-arg">scope</span>,
<span class="sig-arg">message</span>=<span class="sig-default">None</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="oauth2client.client-pysrc.html#flow_from_clientsecrets">source&nbsp;code</a></span>&nbsp;
</td>
</tr></table>
<pre class="literalblock">
Create a Flow from a clientsecrets file.
Will create the right kind of Flow based on the contents of the clientsecrets
file or will raise InvalidClientSecretsError for unknown types of Flows.
Args:
filename: string, File name of client secrets.
scope: string or list of strings, scope(s) to request.
message: string, A friendly string to display to the user if the
clientsecrets file is missing or invalid. If message is provided then
sys.exit will be called in the case of an error. If message in not
provided then clientsecrets.InvalidClientSecretsError will be raised.
Returns:
A Flow object.
Raises:
UnknownClientSecretsFlowError if the file describes an unknown kind of Flow.
clientsecrets.InvalidClientSecretsError if the clientsecrets file is
invalid.
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<br />
<!-- ==================== VARIABLES DETAILS ==================== -->
<a name="section-VariablesDetails"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Variables Details</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-VariablesDetails"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="ID_TOKEN_VERIFICATON_CERTS"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<h3 class="epydoc">ID_TOKEN_VERIFICATON_CERTS</h3>
<dl class="fields">
</dl>
<dl class="fields">
<dt>Value:</dt>
<dd><table><tr><td><pre class="variable">
<code class="variable-quote">'</code><code class="variable-string">https://www.googleapis.com/oauth2/v1/certs</code><code class="variable-quote">'</code>
</pre></td></tr></table>
</dd>
</dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Tree link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Index link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Help link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
<th class="navbar" width="100%"></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Tue Jun 5 09:03:05 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
>http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie();
// -->
</script>
</body>
</html>