Skip to content

Commit ee36831

Browse files
committed
rebuild docs after #69 got merged
1 parent afbec92 commit ee36831

File tree

6 files changed

+42
-36
lines changed

6 files changed

+42
-36
lines changed
125 Bytes
Binary file not shown.
1.42 KB
Binary file not shown.

docs/build/html/_sources/quickstart.rst.txt

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Run this code with *python quickstart.py* and you will see a web browser asking
3434
.. _`APIs Console`: https://console.developers.google.com/iam-admin/projects
3535
.. _`OAuth made easy`: ./oauth.html
3636

37-
Creating and updating file
38-
--------------------------
37+
Creating and Updating Files
38+
---------------------------
3939

4040
There are many methods to create and update file metadata and contents. With *PyDrive2*, all you have to know is
4141
`Upload()`_ method which makes optimal API call for you. Add the following code to your *quickstart.py* and run it.
@@ -57,8 +57,8 @@ This code will create a new file with title *Hello.txt* and its content *Hello W
5757
.. _`Google Drive`: https://drive.google.com
5858
.. _`File management made easy`: ./filemanagement.html
5959

60-
Getting list of files
61-
---------------------
60+
Listing Files
61+
-------------
6262

6363
*PyDrive2* handles paginations and parses response as list of `GoogleDriveFile`_. Let's get title and id of all the files in the root folder of Google Drive. Again, add the following code to *quickstart.py* and execute it.
6464

@@ -84,23 +84,26 @@ GoogleDrive treats everything as a file and assigns different mimetypes for diff
8484
return newFolder
8585
8686
87-
Get Id of the title
88-
-------------------
87+
Return File ID via File Title
88+
-----------------------------
8989

90-
``get_id_of_title`` is a function that return id of the given title's file in the directory.
90+
A common task is providing the Google Drive API with a file id.
91+
``get_id_of_title`` demonstrates a simple workflow to return the id of a file handle by searching the file titles in a
92+
given directory. The function takes two arguments, ``title`` and ``parent_directory_id``. ``title`` is a string that
93+
will be compared against file titles included in a directory identified by the ``parent_directory_id``.
9194

9295
.. code-block:: python
9396
9497
def get_id_of_title(title,parent_directory_id):
9598
foldered_list=drive.ListFile({'q': "'"+parent_directory_id+"' in parents and trashed=false"}).GetList()
9699
for file in foldered_list:
97-
if(file['title']==title):
98-
return file['id']
99-
return None
100+
if(file['title']==title):
101+
return file['id']
102+
return None
100103
101-
folder browser
104+
Browse Folders
102105
--------------
103-
This return a json output of the data in the directory with some important attributes like size, title, parent_id etc
106+
This returns a json output of the data in a directory with some important attributes like size, title, parent_id.
104107

105108
.. code-block:: python
106109
@@ -136,7 +139,7 @@ This return a json output of the data in the directory with some important attri
136139
137140
here ``folder_list`` is the list of folders that is present
138141
139-
You will see title and id of all the files and folders in root folder of your Google Drive. For more details, take a look at documentation: `File listing made easy`_
142+
You will see title and id of all the files and folders in root folder of your Google Drive. For more details, refer to the documentation: `File listing made easy`_
140143
141144
.. _`GoogleDriveFile`: ./pydrive2.html#pydrive2.files.GoogleDriveFile
142145
.. _`File listing made easy`: ./filelist.html

docs/build/html/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ <h1>Table of Contents<a class="headerlink" href="#table-of-contents" title="Perm
185185
<ul>
186186
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a><ul>
187187
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#authentication">Authentication</a></li>
188-
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#creating-and-updating-file">Creating and updating file</a></li>
189-
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#getting-list-of-files">Getting list of files</a></li>
188+
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#creating-and-updating-files">Creating and Updating Files</a></li>
189+
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#listing-files">Listing Files</a></li>
190190
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#creating-a-folder">Creating a Folder</a></li>
191-
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#get-id-of-the-title">Get Id of the title</a></li>
192-
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#folder-browser">folder browser</a></li>
191+
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#return-file-id-via-file-title">Return File ID via File Title</a></li>
192+
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#browse-folders">Browse Folders</a></li>
193193
</ul>
194194
</li>
195195
<li class="toctree-l1"><a class="reference internal" href="oauth.html">OAuth made easy</a><ul>

docs/build/html/quickstart.html

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@
8989
<ul class="current">
9090
<li class="toctree-l1 current"><a class="current reference internal" href="#">Quickstart</a><ul>
9191
<li class="toctree-l2"><a class="reference internal" href="#authentication">Authentication</a></li>
92-
<li class="toctree-l2"><a class="reference internal" href="#creating-and-updating-file">Creating and updating file</a></li>
93-
<li class="toctree-l2"><a class="reference internal" href="#getting-list-of-files">Getting list of files</a></li>
92+
<li class="toctree-l2"><a class="reference internal" href="#creating-and-updating-files">Creating and Updating Files</a></li>
93+
<li class="toctree-l2"><a class="reference internal" href="#listing-files">Listing Files</a></li>
9494
<li class="toctree-l2"><a class="reference internal" href="#creating-a-folder">Creating a Folder</a></li>
95-
<li class="toctree-l2"><a class="reference internal" href="#get-id-of-the-title">Get Id of the title</a></li>
96-
<li class="toctree-l2"><a class="reference internal" href="#folder-browser">folder browser</a></li>
95+
<li class="toctree-l2"><a class="reference internal" href="#return-file-id-via-file-title">Return File ID via File Title</a></li>
96+
<li class="toctree-l2"><a class="reference internal" href="#browse-folders">Browse Folders</a></li>
9797
</ul>
9898
</li>
9999
<li class="toctree-l1"><a class="reference internal" href="oauth.html">OAuth made easy</a></li>
@@ -198,8 +198,8 @@ <h2>Authentication<a class="headerlink" href="#authentication" title="Permalink
198198
</div>
199199
<p>Run this code with <em>python quickstart.py</em> and you will see a web browser asking you for authentication. Click <em>Accept</em> and you are done with authentication. For more details, take a look at documentation: <a class="reference external" href="./oauth.html">OAuth made easy</a></p>
200200
</div>
201-
<div class="section" id="creating-and-updating-file">
202-
<h2>Creating and updating file<a class="headerlink" href="#creating-and-updating-file" title="Permalink to this headline"></a></h2>
201+
<div class="section" id="creating-and-updating-files">
202+
<h2>Creating and Updating Files<a class="headerlink" href="#creating-and-updating-files" title="Permalink to this headline"></a></h2>
203203
<p>There are many methods to create and update file metadata and contents. With <em>PyDrive2</em>, all you have to know is
204204
<a class="reference external" href="./pydrive2.html#pydrive2.files.GoogleDriveFile.Upload">Upload()</a> method which makes optimal API call for you. Add the following code to your <em>quickstart.py</em> and run it.</p>
205205
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pydrive2.drive</span> <span class="kn">import</span> <span class="n">GoogleDrive</span>
@@ -216,8 +216,8 @@ <h2>Creating and updating file<a class="headerlink" href="#creating-and-updating
216216
</dd>
217217
</dl>
218218
</div>
219-
<div class="section" id="getting-list-of-files">
220-
<h2>Getting list of files<a class="headerlink" href="#getting-list-of-files" title="Permalink to this headline"></a></h2>
219+
<div class="section" id="listing-files">
220+
<h2>Listing Files<a class="headerlink" href="#listing-files" title="Permalink to this headline"></a></h2>
221221
<p><em>PyDrive2</em> handles paginations and parses response as list of <a class="reference external" href="./pydrive2.html#pydrive2.files.GoogleDriveFile">GoogleDriveFile</a>. Let’s get title and id of all the files in the root folder of Google Drive. Again, add the following code to <em>quickstart.py</em> and execute it.</p>
222222
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># Auto-iterate through all files that matches this query</span>
223223
<span class="n">file_list</span> <span class="o">=</span> <span class="n">drive</span><span class="o">.</span><span class="n">ListFile</span><span class="p">({</span><span class="s1">&#39;q&#39;</span><span class="p">:</span> <span class="s2">&quot;&#39;root&#39; in parents and trashed=false&quot;</span><span class="p">})</span><span class="o">.</span><span class="n">GetList</span><span class="p">()</span>
@@ -240,21 +240,24 @@ <h2>Creating a Folder<a class="headerlink" href="#creating-a-folder" title="Perm
240240
</pre></div>
241241
</div>
242242
</div>
243-
<div class="section" id="get-id-of-the-title">
244-
<h2>Get Id of the title<a class="headerlink" href="#get-id-of-the-title" title="Permalink to this headline"></a></h2>
245-
<p><code class="docutils literal notranslate"><span class="pre">get_id_of_title</span></code> is a function that return id of the given title’s file in the directory.</p>
243+
<div class="section" id="return-file-id-via-file-title">
244+
<h2>Return File ID via File Title<a class="headerlink" href="#return-file-id-via-file-title" title="Permalink to this headline"></a></h2>
245+
<p>A common task is providing the Google Drive API with a file id.
246+
<code class="docutils literal notranslate"><span class="pre">get_id_of_title</span></code> demonstrates a simple workflow to return the id of a file handle by searching the file titles in a
247+
given directory. The function takes two arguments, <code class="docutils literal notranslate"><span class="pre">title</span></code> and <code class="docutils literal notranslate"><span class="pre">parent_directory_id</span></code>. <code class="docutils literal notranslate"><span class="pre">title</span></code> is a string that
248+
will be compared against file titles included in a directory identified by the <code class="docutils literal notranslate"><span class="pre">parent_directory_id</span></code>.</p>
246249
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">get_id_of_title</span><span class="p">(</span><span class="n">title</span><span class="p">,</span><span class="n">parent_directory_id</span><span class="p">):</span>
247250
<span class="n">foldered_list</span><span class="o">=</span><span class="n">drive</span><span class="o">.</span><span class="n">ListFile</span><span class="p">({</span><span class="s1">&#39;q&#39;</span><span class="p">:</span> <span class="s2">&quot;&#39;&quot;</span><span class="o">+</span><span class="n">parent_directory_id</span><span class="o">+</span><span class="s2">&quot;&#39; in parents and trashed=false&quot;</span><span class="p">})</span><span class="o">.</span><span class="n">GetList</span><span class="p">()</span>
248251
<span class="k">for</span> <span class="n">file</span> <span class="ow">in</span> <span class="n">foldered_list</span><span class="p">:</span>
249-
<span class="k">if</span><span class="p">(</span><span class="n">file</span><span class="p">[</span><span class="s1">&#39;title&#39;</span><span class="p">]</span><span class="o">==</span><span class="n">title</span><span class="p">):</span>
250-
<span class="k">return</span> <span class="n">file</span><span class="p">[</span><span class="s1">&#39;id&#39;</span><span class="p">]</span>
251-
<span class="k">return</span> <span class="kc">None</span>
252+
<span class="k">if</span><span class="p">(</span><span class="n">file</span><span class="p">[</span><span class="s1">&#39;title&#39;</span><span class="p">]</span><span class="o">==</span><span class="n">title</span><span class="p">):</span>
253+
<span class="k">return</span> <span class="n">file</span><span class="p">[</span><span class="s1">&#39;id&#39;</span><span class="p">]</span>
254+
<span class="k">return</span> <span class="kc">None</span>
252255
</pre></div>
253256
</div>
254257
</div>
255-
<div class="section" id="folder-browser">
256-
<h2>folder browser<a class="headerlink" href="#folder-browser" title="Permalink to this headline"></a></h2>
257-
<p>This return a json output of the data in the directory with some important attributes like size, title, parent_id etc</p>
258+
<div class="section" id="browse-folders">
259+
<h2>Browse Folders<a class="headerlink" href="#browse-folders" title="Permalink to this headline"></a></h2>
260+
<p>This returns a json output of the data in a directory with some important attributes like size, title, parent_id.</p>
258261
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">browsed</span><span class="o">=</span><span class="p">[]</span>
259262
<span class="k">def</span> <span class="nf">folder_browser</span><span class="p">(</span><span class="n">folder_list</span><span class="p">,</span><span class="n">parent_id</span><span class="p">):</span>
260263
<span class="k">for</span> <span class="n">element</span> <span class="ow">in</span> <span class="n">folder_list</span><span class="p">:</span>
@@ -287,7 +290,7 @@ <h2>folder browser<a class="headerlink" href="#folder-browser" title="Permalink
287290
</pre></div>
288291
</div>
289292
<p>here <code class="docutils literal notranslate"><span class="pre">folder_list</span></code> is the list of folders that is present</p>
290-
<p>You will see title and id of all the files and folders in root folder of your Google Drive. For more details, take a look at documentation: <a class="reference external" href="./filelist.html">File listing made easy</a></p>
293+
<p>You will see title and id of all the files and folders in root folder of your Google Drive. For more details, refer to the documentation: <a class="reference external" href="./filelist.html">File listing made easy</a></p>
291294
</div>
292295
</div>
293296

0 commit comments

Comments
 (0)