blob: cdae5ea9802cdfde867a40f77bf8316c0378d0de [file] [log] [blame]
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -04001<?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.tools</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>&nbsp;&nbsp;&nbsp;<a
20 href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
21
22 <!-- Index link -->
23 <th>&nbsp;&nbsp;&nbsp;<a
24 href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
25
26 <!-- Help link -->
27 <th>&nbsp;&nbsp;&nbsp;<a
28 href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</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&nbsp;oauth2client</a> ::
38 Module&nbsp;tools
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&nbsp;private</a>]</span></td></tr>
46 <tr><td align="right"><span class="options"
47 >[<a href="frames.html" target="_top">frames</a
48 >]&nbsp;|&nbsp;<a href="oauth2client.tools-module.html"
49 target="_top">no&nbsp;frames</a>]</span></td></tr>
50 </table>
51 </td>
52 </tr>
53</table>
54<!-- ==================== MODULE DESCRIPTION ==================== -->
55<h1 class="epydoc">Module tools</h1><p class="nomargin-top"><span class="codelink"><a href="oauth2client.tools-pysrc.html">source&nbsp;code</a></span></p>
56<pre class="literalblock">
57Command-line tools for authenticating via OAuth 2.0
58
59Do the OAuth 2.0 Web Server dance for a command line application. Stores the
60generated credentials in a common file that is used by other example apps in
61the same directory.
62
63</pre>
64
65<hr />
66<div class="fields"> <p><strong>Author:</strong>
67 jcgregorio@google.com (Joe Gregorio)
68 </p>
69</div><!-- ==================== CLASSES ==================== -->
70<a name="section-Classes"></a>
71<table class="summary" border="1" cellpadding="3"
72 cellspacing="0" width="100%" bgcolor="white">
73<tr bgcolor="#70b0f0" class="table-header">
74 <td colspan="2" class="table-header">
75 <table border="0" cellpadding="0" cellspacing="0" width="100%">
76 <tr valign="top">
77 <td align="left"><span class="table-header">Classes</span></td>
78 <td align="right" valign="top"
79 ><span class="options">[<a href="#section-Classes"
80 class="privatelink" onclick="toggle_private();"
81 >hide private</a>]</span></td>
82 </tr>
83 </table>
84 </td>
85</tr>
86<tr class="private">
87 <td width="15%" align="right" valign="top" class="summary">
88 <span class="summary-type">&nbsp;</span>
89 </td><td class="summary">
90 <a href="oauth2client.tools.ClientRedirectServer-class.html" class="summary-name" onclick="show_private();">ClientRedirectServer</a><br />
91 A server to handle OAuth 2.0 redirects back to localhost.
92 </td>
93 </tr>
94<tr class="private">
95 <td width="15%" align="right" valign="top" class="summary">
96 <span class="summary-type">&nbsp;</span>
97 </td><td class="summary">
98 <a href="oauth2client.tools.ClientRedirectHandler-class.html" class="summary-name" onclick="show_private();">ClientRedirectHandler</a><br />
99 A handler for OAuth 2.0 redirects back to localhost.
100 </td>
101 </tr>
102</table>
103<!-- ==================== FUNCTIONS ==================== -->
104<a name="section-Functions"></a>
105<table class="summary" border="1" cellpadding="3"
106 cellspacing="0" width="100%" bgcolor="white">
107<tr bgcolor="#70b0f0" class="table-header">
108 <td colspan="2" class="table-header">
109 <table border="0" cellpadding="0" cellspacing="0" width="100%">
110 <tr valign="top">
111 <td align="left"><span class="table-header">Functions</span></td>
112 <td align="right" valign="top"
113 ><span class="options">[<a href="#section-Functions"
114 class="privatelink" onclick="toggle_private();"
115 >hide private</a>]</span></td>
116 </tr>
117 </table>
118 </td>
119</tr>
120<tr>
121 <td width="15%" align="right" valign="top" class="summary">
122 <span class="summary-type">&nbsp;</span>
123 </td><td class="summary">
124 <table width="100%" cellpadding="0" cellspacing="0" border="0">
125 <tr>
Joe Gregoriof4839b02012-09-06 13:47:24 -0400126 <td><span class="summary-sig"><a href="oauth2client.tools-module.html#run" class="summary-sig-name">run</a>(<span class="summary-sig-arg">flow</span>,
127 <span class="summary-sig-arg">storage</span>,
128 <span class="summary-sig-arg">http</span>=<span class="summary-sig-default">None</span>)</span><br />
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -0400129 Core code for a command-line application.</td>
130 <td align="right" valign="top">
Joe Gregoriof4839b02012-09-06 13:47:24 -0400131 <span class="codelink"><a href="oauth2client.tools-pysrc.html#run">source&nbsp;code</a></span>
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -0400132
133 </td>
134 </tr>
135 </table>
136
137 </td>
138 </tr>
139</table>
140<!-- ==================== VARIABLES ==================== -->
141<a name="section-Variables"></a>
142<table class="summary" border="1" cellpadding="3"
143 cellspacing="0" width="100%" bgcolor="white">
144<tr bgcolor="#70b0f0" class="table-header">
145 <td colspan="2" class="table-header">
146 <table border="0" cellpadding="0" cellspacing="0" width="100%">
147 <tr valign="top">
148 <td align="left"><span class="table-header">Variables</span></td>
149 <td align="right" valign="top"
150 ><span class="options">[<a href="#section-Variables"
151 class="privatelink" onclick="toggle_private();"
152 >hide private</a>]</span></td>
153 </tr>
154 </table>
155 </td>
156</tr>
157<tr class="private">
158 <td width="15%" align="right" valign="top" class="summary">
159 <span class="summary-type">&nbsp;</span>
160 </td><td class="summary">
161 <a name="FLAGS"></a><span class="summary-name">FLAGS</span> = <code title="gflags.FLAGS">gflags.FLAGS</code>
162 </td>
163 </tr>
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -0400164</table>
165<!-- ==================== FUNCTION DETAILS ==================== -->
166<a name="section-FunctionDetails"></a>
167<table class="details" border="1" cellpadding="3"
168 cellspacing="0" width="100%" bgcolor="white">
169<tr bgcolor="#70b0f0" class="table-header">
170 <td colspan="2" class="table-header">
171 <table border="0" cellpadding="0" cellspacing="0" width="100%">
172 <tr valign="top">
173 <td align="left"><span class="table-header">Function Details</span></td>
174 <td align="right" valign="top"
175 ><span class="options">[<a href="#section-FunctionDetails"
176 class="privatelink" onclick="toggle_private();"
177 >hide private</a>]</span></td>
178 </tr>
179 </table>
180 </td>
181</tr>
182</table>
183<a name="run"></a>
184<div>
185<table class="details" border="1" cellpadding="3"
186 cellspacing="0" width="100%" bgcolor="white">
187<tr><td>
188 <table width="100%" cellpadding="0" cellspacing="0" border="0">
189 <tr valign="top"><td>
Joe Gregoriof4839b02012-09-06 13:47:24 -0400190 <h3 class="epydoc"><span class="sig"><span class="sig-name">run</span>(<span class="sig-arg">flow</span>,
191 <span class="sig-arg">storage</span>,
192 <span class="sig-arg">http</span>=<span class="sig-default">None</span>)</span>
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -0400193 </h3>
194 </td><td align="right" valign="top"
Joe Gregoriof4839b02012-09-06 13:47:24 -0400195 ><span class="codelink"><a href="oauth2client.tools-pysrc.html#run">source&nbsp;code</a></span>&nbsp;
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -0400196 </td>
197 </tr></table>
198
199 <pre class="literalblock">
200Core code for a command-line application.
201
Joe Gregorio5350efb2012-10-24 08:54:11 -0400202The run() function is called from your application and runs through all the
203steps to obtain credentials. It takes a Flow argument and attempts to open an
204authorization server page in the user's default web browser. The server asks
205the user to grant your application access to the user's data. If the user
206grants access, the run() function returns new credentials. The new credentials
207are also stored in the Storage argument, which updates the file associated
208with the Storage object.
209
210It presumes it is run from a command-line application and supports the
211following flags:
212
213 --[no]auth_local_webserver
214
215 Run a local web server to handle redirects during OAuth authorization.
216
217 --auth_host_name
218
219 Host name to use when running a local web server to handle redirects
220 during OAuth authorization.
221
222 --auth_host_port
223
224 Port to use when running a local web server to handle redirects during
225 OAuth authorization.
226
227Since it uses flags make sure to initialize the gflags module before calling
228run().
229
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -0400230Args:
231 flow: Flow, an OAuth 2.0 Flow to step through.
232 storage: Storage, a Storage to store the credential in.
233 http: An instance of httplib2.Http.request
234 or something that acts like it.
235
236Returns:
237 Credentials, the obtained credential.
238
239</pre>
240 <dl class="fields">
Joe Gregorio1b425aa2012-08-24 12:04:34 -0400241 <dt>Decorators:</dt>
242 <dd><ul class="nomargin-top">
243 <li><code>@util.positional(2)</code></li>
244 </ul></dd>
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -0400245 </dl>
246</td></tr></table>
247</div>
248<br />
249<!-- ==================== NAVIGATION BAR ==================== -->
250<table class="navbar" border="0" width="100%" cellpadding="0"
251 bgcolor="#a0c0ff" cellspacing="0">
252 <tr valign="middle">
253
254 <!-- Tree link -->
255 <th>&nbsp;&nbsp;&nbsp;<a
256 href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
257
258 <!-- Index link -->
259 <th>&nbsp;&nbsp;&nbsp;<a
260 href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
261
262 <!-- Help link -->
263 <th>&nbsp;&nbsp;&nbsp;<a
264 href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
265
266 <th class="navbar" width="100%"></th>
267 </tr>
268</table>
269<table border="0" cellpadding="0" cellspacing="0" width="100%%">
270 <tr>
271 <td align="left" class="footer">
Joe Gregorio7578da52012-11-01 14:20:00 -0400272 Generated by Epydoc 3.0.1 on Tue Oct 30 14:36:16 2012
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -0400273 </td>
274 <td align="right" class="footer">
275 <a target="mainFrame" href="http://epydoc.sourceforge.net"
276 >http://epydoc.sourceforge.net</a>
277 </td>
278 </tr>
279</table>
280
281<script type="text/javascript">
282 <!--
283 // Private objects are initially displayed (because if
284 // javascript is turned off then we want them to be
285 // visible); but by default, we want to hide them. So hide
286 // them unless we have a cookie that says to show them.
287 checkCookie();
288 // -->
289</script>
290</body>
291</html>