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>googleapiclient.sample_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  <!-- Home link -->
18      <th>&nbsp;&nbsp;&nbsp;<a
19        href="googleapiclient-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
20
21  <!-- Tree link -->
22      <th>&nbsp;&nbsp;&nbsp;<a
23        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
24
25  <!-- Index link -->
26      <th>&nbsp;&nbsp;&nbsp;<a
27        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
28
29  <!-- Help link -->
30      <th>&nbsp;&nbsp;&nbsp;<a
31        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
32
33      <th class="navbar" width="100%"></th>
34  </tr>
35</table>
36<table width="100%" cellpadding="0" cellspacing="0">
37  <tr valign="top">
38    <td width="100%">
39      <span class="breadcrumbs">
40        <a href="googleapiclient-module.html">Package&nbsp;googleapiclient</a> ::
41        Module&nbsp;sample_tools
42      </span>
43    </td>
44    <td>
45      <table cellpadding="0" cellspacing="0">
46        <!-- hide/show private -->
47        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
48    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
49        <tr><td align="right"><span class="options"
50            >[<a href="frames.html" target="_top">frames</a
51            >]&nbsp;|&nbsp;<a href="googleapiclient.sample_tools-module.html"
52            target="_top">no&nbsp;frames</a>]</span></td></tr>
53      </table>
54    </td>
55  </tr>
56</table>
57<!-- ==================== MODULE DESCRIPTION ==================== -->
58<h1 class="epydoc">Module sample_tools</h1><p class="nomargin-top"><span class="codelink"><a href="googleapiclient.sample_tools-pysrc.html">source&nbsp;code</a></span></p>
59<pre class="literalblock">
60Utilities for making samples.
61
62Consolidates a lot of code commonly repeated in sample applications.
63
64</pre>
65
66<hr />
67<div class="fields">      <p><strong>Author:</strong>
68        jcgregorio@google.com (Joe Gregorio)
69      </p>
70</div><!-- ==================== FUNCTIONS ==================== -->
71<a name="section-Functions"></a>
72<table class="summary" border="1" cellpadding="3"
73       cellspacing="0" width="100%" bgcolor="white">
74<tr bgcolor="#70b0f0" class="table-header">
75  <td colspan="2" class="table-header">
76    <table border="0" cellpadding="0" cellspacing="0" width="100%">
77      <tr valign="top">
78        <td align="left"><span class="table-header">Functions</span></td>
79        <td align="right" valign="top"
80         ><span class="options">[<a href="#section-Functions"
81         class="privatelink" onclick="toggle_private();"
82         >hide private</a>]</span></td>
83      </tr>
84    </table>
85  </td>
86</tr>
87<tr>
88    <td width="15%" align="right" valign="top" class="summary">
89      <span class="summary-type">&nbsp;</span>
90    </td><td class="summary">
91      <table width="100%" cellpadding="0" cellspacing="0" border="0">
92        <tr>
93          <td><span class="summary-sig"><a href="googleapiclient.sample_tools-module.html#init" class="summary-sig-name">init</a>(<span class="summary-sig-arg">argv</span>,
94        <span class="summary-sig-arg">name</span>,
95        <span class="summary-sig-arg">version</span>,
96        <span class="summary-sig-arg">doc</span>,
97        <span class="summary-sig-arg">filename</span>,
98        <span class="summary-sig-arg">scope</span>=<span class="summary-sig-default">None</span>,
99        <span class="summary-sig-arg">parents</span>=<span class="summary-sig-default">[]</span>,
100        <span class="summary-sig-arg">discovery_filename</span>=<span class="summary-sig-default">None</span>)</span><br />
101      A common initialization routine for samples.</td>
102          <td align="right" valign="top">
103            <span class="codelink"><a href="googleapiclient.sample_tools-pysrc.html#init">source&nbsp;code</a></span>
104
105          </td>
106        </tr>
107      </table>
108
109    </td>
110  </tr>
111</table>
112<!-- ==================== FUNCTION DETAILS ==================== -->
113<a name="section-FunctionDetails"></a>
114<table class="details" border="1" cellpadding="3"
115       cellspacing="0" width="100%" bgcolor="white">
116<tr bgcolor="#70b0f0" class="table-header">
117  <td colspan="2" class="table-header">
118    <table border="0" cellpadding="0" cellspacing="0" width="100%">
119      <tr valign="top">
120        <td align="left"><span class="table-header">Function Details</span></td>
121        <td align="right" valign="top"
122         ><span class="options">[<a href="#section-FunctionDetails"
123         class="privatelink" onclick="toggle_private();"
124         >hide private</a>]</span></td>
125      </tr>
126    </table>
127  </td>
128</tr>
129</table>
130<a name="init"></a>
131<div>
132<table class="details" border="1" cellpadding="3"
133       cellspacing="0" width="100%" bgcolor="white">
134<tr><td>
135  <table width="100%" cellpadding="0" cellspacing="0" border="0">
136  <tr valign="top"><td>
137  <h3 class="epydoc"><span class="sig"><span class="sig-name">init</span>(<span class="sig-arg">argv</span>,
138        <span class="sig-arg">name</span>,
139        <span class="sig-arg">version</span>,
140        <span class="sig-arg">doc</span>,
141        <span class="sig-arg">filename</span>,
142        <span class="sig-arg">scope</span>=<span class="sig-default">None</span>,
143        <span class="sig-arg">parents</span>=<span class="sig-default">[]</span>,
144        <span class="sig-arg">discovery_filename</span>=<span class="sig-default">None</span>)</span>
145  </h3>
146  </td><td align="right" valign="top"
147    ><span class="codelink"><a href="googleapiclient.sample_tools-pysrc.html#init">source&nbsp;code</a></span>&nbsp;
148    </td>
149  </tr></table>
150
151  <pre class="literalblock">
152A common initialization routine for samples.
153
154Many of the sample applications do the same initialization, which has now
155been consolidated into this function. This function uses common idioms found
156in almost all the samples, i.e. for an API with name 'apiname', the
157credentials are stored in a file named apiname.dat, and the
158client_secrets.json file is stored in the same directory as the application
159main file.
160
161Args:
162  argv: list of string, the command-line parameters of the application.
163  name: string, name of the API.
164  version: string, version of the API.
165  doc: string, description of the application. Usually set to __doc__.
166  file: string, filename of the application. Usually set to __file__.
167  parents: list of argparse.ArgumentParser, additional command-line flags.
168  scope: string, The OAuth scope used.
169  discovery_filename: string, name of local discovery file (JSON). Use when discovery doc not available via URL.
170
171Returns:
172  A tuple of (service, flags), where service is the service object and flags
173  is the parsed command-line flags.
174
175</pre>
176  <dl class="fields">
177  </dl>
178</td></tr></table>
179</div>
180<br />
181<!-- ==================== NAVIGATION BAR ==================== -->
182<table class="navbar" border="0" width="100%" cellpadding="0"
183       bgcolor="#a0c0ff" cellspacing="0">
184  <tr valign="middle">
185  <!-- Home link -->
186      <th>&nbsp;&nbsp;&nbsp;<a
187        href="googleapiclient-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
188
189  <!-- Tree link -->
190      <th>&nbsp;&nbsp;&nbsp;<a
191        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
192
193  <!-- Index link -->
194      <th>&nbsp;&nbsp;&nbsp;<a
195        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
196
197  <!-- Help link -->
198      <th>&nbsp;&nbsp;&nbsp;<a
199        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
200
201      <th class="navbar" width="100%"></th>
202  </tr>
203</table>
204<table border="0" cellpadding="0" cellspacing="0" width="100%%">
205  <tr>
206    <td align="left" class="footer">
207    Generated by Epydoc 3.0.1 on Fri Jun 14 15:57:27 2019
208    </td>
209    <td align="right" class="footer">
210      <a target="mainFrame" href="http://epydoc.sourceforge.net"
211        >http://epydoc.sourceforge.net</a>
212    </td>
213  </tr>
214</table>
215
216<script type="text/javascript">
217  <!--
218  // Private objects are initially displayed (because if
219  // javascript is turned off then we want them to be
220  // visible); but by default, we want to hide them.  So hide
221  // them unless we have a cookie that says to show them.
222  checkCookie();
223  // -->
224</script>
225</body>
226</html>
227