Skip to content

Commit

Permalink
Renamed repo to gdrive2
Browse files Browse the repository at this point in the history
  • Loading branch information
preethampaul committed Apr 20, 2021
1 parent d755993 commit 6300e3b
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 95 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

# Do not push confidential secrets data
gdrive/api_data
gdrive2/api_data
pypi_push.ssh
gdrive/gd
gdrive2/gd

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
# **gdrive**
## What is gdrive?
# **gdrive2**
## What is gdrive2?

[![Documentation Status](https://readthedocs.org/projects/gdrive/badge/?version=latest)](https://gdrive.readthedocs.io/en/latest/?badge=latest)
[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/preethampaul/gdrive/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/Naereen/StrapDown.js.svg)](https://GitHub.com/preethampaul/gdrive/releases/)
[![Documentation Status](https://readthedocs.org/projects/gdrive2/badge/?version=latest)](https://gdrive2.readthedocs.io/en/latest/?badge=latest)
[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/preethampaul/gdrive2/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/Naereen/StrapDown.js.svg)](https://GitHub.com/preethampaul/gdrive2/releases/)


gdrive helps users to easily access files from Google Drive using paths, instead of File ids. Google API requires the users to know the File ID to access it, but this package which is built using the pyDrive package allows users to use a file path to access the file or folder.
gdrive2 helps users to easily access files from Google Drive using paths, instead of File ids. Google API requires the users to know the File ID to access it, but this package which is built using the pyDrive package allows users to use a file path to access the file or folder.

In addition to this, the package also provides commands that can be called from a terminal, like cd, ls, pull or push, to quickly view, modify, download or upload files from or to Google drive using a python code or just the command line.

## Setup:
<pre>pip install -i https://test.pypi.org/simple/ gdrive</pre>
<pre>pip install -i https://test.pypi.org/simple/ gdrive2</pre>

## Documentation:
For more details about **setup** and **commands**, check [gdrive.readthedocs.io](https://gdrive.readthedocs.io).
For more details about **setup** and **commands**, check [gdrive2.readthedocs.io](https://gdrive2.readthedocs.io).

### Quickdemo 1 : Basics

Lets see how gdrive can be used from command line.
Lets see how gdrive2 can be used from command line.

Open terminal and set some folder where you intend to download or from where you intend to upload files.

<pre><code>$ gd init</code></pre>

When asked for a username, this is not same as the google username. More about this explained in the *username* documentation.
Enter some nickname (for example, ***mygdrive***) you would like to give to your google account, so that you can use this for quick authentication into your account in future.
Enter some nickname (for example, ***mygdrive2***) you would like to give to your google account, so that you can use this for quick authentication into your account in future.
This should take you to a Oauth Consent screen, where you'll be asked to enter your Google username and password. You are good, if you see this a html page showing this.

> The authentication is successful.
Once authentication is done, from the current working folder, you can try several gdrive commands. Just like `git`, gdrive also creates a hidden folder **.gd** which contains information about the fileIDs, driveIDs etc. More about this explained in the *parents* documentation.
Once authentication is done, from the current working folder, you can try several gdrive2 commands. Just like `git`, gdrive2 also creates a hidden folder **.gd** which contains information about the fileIDs, driveIDs etc. More about this explained in the *parents* documentation.

> :warning: After authentication of a new account, the credentials are stored in **ROOT_PATH/api_data** folder. The contents of this folder must be handled with discretion.
After, initialization and authentication, you can use all the gdrive commands from this directory.
After, initialization and authentication, you can use all the gdrive2 commands from this directory.

<pre><code>$ gd status
---------------
Parent dicts :
---------------
// origin // <DEFAULT>
username : mygdrive
username : mygdrive2
path : ''
id : 'root'
drive : 'My Drive'
Expand Down Expand Up @@ -100,7 +100,7 @@ $ gd status
Parent dicts :
---------------
// origin // <DEFAULT>
username : mygdrive
username : mygdrive2
path : 'fruits/hard'
id : '34eWf..iT23'
drive : 'My Drive'
Expand Down Expand Up @@ -142,13 +142,13 @@ Once a parent is added (say, origin2), we can assign different parameters (like

All these commands can be used in a python script as shown below. The only difference from the terminal commands is that apart from the main function (init, status, etc), the optional arguements must be passed as strings in a list. If there is no arguements, an empty list must be passed in the function.

<pre><code>>> import gdrive as gd
<pre><code>>> import gdrive2 as gd
>>
>> gd.init([])
>> gd.status([])
>> gd.add(['berry.jpg', 'mango.jpg'])</code></pre>

For more details, check [gdrive.readthedocs.io](https://gdrive.readthedocs.io)
For more details, check [gdrive2.readthedocs.io](https://gdrive2.readthedocs.io)


#### Please post issues here or email me at preeth@uw.edu
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import sys
sys.path.insert(0, os.path.abspath('../'))

from gdrive.paths import VERSION
from gdrive2.paths import VERSION

# -- Project information -----------------------------------------------------

project = 'gdrive'
project = 'gdrive2'
copyright = '2020, Preetham Paul'
author = 'Preetham Paul'

Expand Down
60 changes: 30 additions & 30 deletions docs/gdrive.rst
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
gdrive Functions and Commands
gdrive2 Functions and Commands
==============

The following submodules are present in the package:
::

gdrive
gdrive2
|_______gd
|_______drive_util
|_______auth_util
|_______paths

The main module that is automatically imported when gdrive is imported is **gdrive.gd**.Other modules are utility modules, whose functions are used in **gd**. **paths** module only contains file paths which are imported as constants in other modules.
The main module that is automatically imported when gdrive2 is imported is **gdrive2.gd**.Other modules are utility modules, whose functions are used in **gd**. **paths** module only contains file paths which are imported as constants in other modules.

gdrive.gd module
gdrive2.gd module
####################

This module need not be imported explicilty and is imported automatically when gdrive is imported.
This module need not be imported explicilty and is imported automatically when gdrive2 is imported.
All the commands and the functions that can be readily used are from this module. The following command gives the list of commands callable.
From python console, **gdrive.help()** can be used.
From python console, **gdrive2.help()** can be used.
::

$ gd -h
Expand All @@ -29,7 +29,7 @@ From python console, **gdrive.help()** can be used.

Overview of initializing/listing fucnctions:
--------------------------------
'init' : initialize gdrive, add new parents to initialized dir., add new clients
'init' : initialize gdrive2, add new parents to initialized dir., add new clients
'status' : show parents list, show stage list, show users and clients list
'reset' : changes default parent, client secrets
changes parent information like user_names, paths, root folders (Ex: shared drives), clients
Expand All @@ -49,7 +49,7 @@ From python console, **gdrive.help()** can be used.
Miscelleneous functions:
---------------------------------
'help' : Shows the list of functions or commands available
'rmgd' : Removes the gd file created by importing gdrive
'rmgd' : Removes the gd file created by importing gdrive2
'default' : Brings the package to its default state (removes all clients, auth. data and the gd commandline functionality)
'version' : Prints the current version

Expand All @@ -63,22 +63,22 @@ From python console, **gdrive.help()** can be used.

Initilizing/Listing:
-----------------------
.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: init

.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: status

.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: reset

.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: ls

.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: find

Query for gdrive.find:
Query for gdrive2.find:
*************************
A query made with `fnmatch <https://docs.python.org/3/library/fnmatch.html>`_ (slighlty different from glob) patterns must be passed as a string enclosed by " ". It can have only the following logical operators - **and**, **or** and **not**. All the fnmatch patterns and the operators must be separated by **spaces** as shown in examples below. **not** operates on the immediately following pattern. Similarly, **and** and **or** operates on the following pattern or on the result of a **not** operation. To search for only files, append **%f** in the beginning of the query and for only folders, append **%d**. In the and-separated query, the first string (after %f, %d or not, if present) sets the initial list of paths. The latter strings or conditions connected by 'and' to the previous one must lead to a subset of paths of the previous list. For the conditions connected by 'or', they are evaluated separately and the final list is the union of the sets obtained from individual condition evaluations. See examples below:

Expand Down Expand Up @@ -163,60 +163,60 @@ Fnmatch Wilcard characters:
| | not in *seq*. |
+--------------+----------------------+
Note that these do not have ** character as in glob patterns. To get the functionality of path search, use *--path-search* arguement
in **gdrive.find** or **path_search = True** in **gdrive.drive_util.query_to_paths()**.
in **gdrive2.find** or **path_search = True** in **gdrive2.drive_util.query_to_paths()**.


.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: cd

.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: mkdir

.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: rm

Upload/Download:
--------------------
.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: add

.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: push

.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: pull

Miscellaneous:
--------------------
.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: help

.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: rmgd

.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: default

.. currentmodule:: gdrive.gd
.. currentmodule:: gdrive2.gd
.. autofunction:: version


gdrive.drive\_util module
gdrive2.drive\_util module
####################

These functions are utility functions which are used in gd to control files in gdrive. The functions here take pyDrive.GoogleDrive() object as an arguement to do this.
These functions are utility functions which are used in gd to control files in gdrive2. The functions here take pyDrive.GoogleDrive() object as an arguement to do this.

.. automodule:: gdrive.drive_util
.. automodule:: gdrive2.drive_util
:members:
:undoc-members:
:show-inheritance:

gdrive.auth\_util module
gdrive2.auth\_util module
####################

This module contains functions which are responsible for managing the pyDrive.GoogleAuth() object. The functions here are used in gd to authenticate users, check for username cedentials and adding client files on the system.

.. automodule:: gdrive.auth_util
.. automodule:: gdrive2.auth_util
:members:
:undoc-members:
:show-inheritance:

0 comments on commit 6300e3b

Please sign in to comment.