All Projects → ab-anand → ZDrive

ab-anand / ZDrive

Licence: MIT license
Seamless download/upload contents via Google Drive 📂

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ZDrive

Nodestream
Storage-agnostic streaming library for binary data transfers
Stars: ✭ 70 (+180%)
Mutual labels:  download, upload
Ounotes
An Application built for students to access Notes , Question Papers , Syllabus and Resources for all Subjects of O.U (Osmania University) 📘👨‍🎓
Stars: ✭ 173 (+592%)
Mutual labels:  download, upload
Httptransfertasks
Cross Platform HTTP Transfers for downloading and uploading (supports background operations)
Stars: ✭ 87 (+248%)
Mutual labels:  download, upload
Casync
Content-Addressable Data Synchronization Tool
Stars: ✭ 890 (+3460%)
Mutual labels:  download, upload
rsync
gokrazy rsync
Stars: ✭ 308 (+1132%)
Mutual labels:  download, upload
Flickrsync
A command line tool to synchronise, upload, download, pictures between the local file system and Flickr. Image hash signature of the picture is used to uniquely identify the image.
Stars: ✭ 14 (-44%)
Mutual labels:  download, upload
Fgdownloader
用于断点下载、任务队列、上传进度、下载进度
Stars: ✭ 143 (+472%)
Mutual labels:  download, upload
kubefilebrowser
kubernetes container filebrowser and webshell
Stars: ✭ 23 (-8%)
Mutual labels:  download, upload
Bilibiliupload
Stream download and upload, not only for bilibili.
Stars: ✭ 232 (+828%)
Mutual labels:  download, upload
Sjnetwork
SJNetwork is a high level network request tool based on AFNetworking and inspired on YTKNetwork.
Stars: ✭ 231 (+824%)
Mutual labels:  download, upload
Transit
Easy file uploading and downloading for Laravel 5.
Stars: ✭ 5 (-80%)
Mutual labels:  download, upload
miniprogram-network
Redefine the Network API of Wechat MiniProgram (小程序网络库)
Stars: ✭ 93 (+272%)
Mutual labels:  download, upload
Rx Mvp
RxJava2+Retrofit2+RxLifecycle2+OkHttp3 封装RHttp 使用MVP模式构建项目
Stars: ✭ 343 (+1272%)
Mutual labels:  download, upload
Dropbox Stream
Upload & Download streams for Dropbox
Stars: ✭ 35 (+40%)
Mutual labels:  download, upload
Godfs
A simple fast, easy use distributed file system written in go.
Stars: ✭ 256 (+924%)
Mutual labels:  download, upload
Okhttps
如艺术一般优雅,像 1、2、3 一样简单,前后端通用,轻量却强大的 HTTP 客户端(同时支持 WebSocket 与 Stomp 协议)
Stars: ✭ 92 (+268%)
Mutual labels:  download, upload
PyroGramBot
pluggable Telegram Bot based on Pyrogram
Stars: ✭ 168 (+572%)
Mutual labels:  download, upload
UniBorg
Pluggable Telegram bot and userbot based on Telethon
Stars: ✭ 196 (+684%)
Mutual labels:  download, upload
Telegram Upload
Upload and download files from Telegram up to 2GiB using your account
Stars: ✭ 223 (+792%)
Mutual labels:  download, upload
Anydlbot
An Open Source GPLv3 All-In-One Telegram Bot
Stars: ✭ 236 (+844%)
Mutual labels:  download, upload

ZDrive

GitHub license PyPI PyPI - Python Version Monthly downloads

A lightweight and easy to use Python library to upload and download contents from Google Drive.

Author:Abhinav Anand

1   What is it

[back to top]

Google Drive is the most used cloud storage platform. A need for some minimal yet effective tool to transfer contents to and from Drive is important!

There is a number of such libraries already present with Pydrive being the most amazing. Pydrive has a lot of functionalities but there are certain major things that it lacks. The goal of this library is to address the bulk uploading/downloading functionality in a way that is easy-to-use and yet covers the users' requirements.

2   Features

[back to top]

  • Upload folders anywhere in the Drive maintaining the same directory structure as present locally.
  • Download folders from anywhere in the Drive to anywhere in the PC maintaining the same directory structure as present in the Drive.
  • Download or Upload whole directory in less than 5 lines of code.
  • Can sustain minor network interruptions.
  • Bulk upload/download made easy.
  • Minimal dependencies.
  • Easy to use.
  • Fast!
  • Returns JSON objects
  • Support
    • OS Support: Linux, Windows, Mac
    • Language Support: Python 2.x, 3.x

3   Installation

[back to top]

3.1   Option 1: installing through pip (Recommended)

pypi package link

$ pip install ZDrive

If you are behind a proxy

$ pip --proxy [username:password@]domain_name:port install ZDrive

Note: If you get command not found then $ sudo apt-get install python-pip should fix that

3.2   Option 2: Installing from source (Only if you must)

$ git clone https://github.com/ab-anand/ZDrive.git
$ cd ZDrive/
$ pip install -r requirements.txt
$ python setup.py install

Note: If you get permission denied then $ sudo python setup.py install should fix that

4   Usage

[back to top]

4.1   Initial Setup

  • Follow the article to get your drive-api credentials.
  • Once you have the clients-secret.json, rename it to credentials.json and place it in the same folder where you'll be running the script.

4.2   Downloader

  • Downloader() allows you to download folder/files from the Drive.
  • The output location where the files will get downloaded can be specified too.
  • Downloader() maintains the same directory tree structure while downloading from the Drive thus making it convenient to read.
  • Google Drive is a semantic (also called tag-based) file system meaning it stores files not based on their location, but based on an ID.
  • Semantic file systems allow you to have multiple files with the same name and to have one file appearing in multiple places.
  • Thus for performing any action related to a file/folder in Drive, we would need the IDs of the file/folder.
  • ZDrive allows you to retrieve a list of files/folders present inside the Drive along with their IDs.
  • Downloader() also uses multiprocessing for speeding up the download process.
  • Using the Downloader()
>>> from zdrive import Downloader
>>> output_directory = "/home/abhinav/Documents"
>>> d = Downloader()
>>> folder_id = 'XXXX-YYYY-ZZZZ'
>>> d.downloadFolder(folder_id, destinationFolder=output_directory)
  • If no destinationFolder is specified, then Downloader() would create a default folder named drive_content and it would download the contents there.
  • Also, if the specified destinationFolder doesn't already exist, Downloader() would create the folder first and the perform the downloading.

4.3   Uploader

  • Uploader() allows you to upload folder/files from the local PC to drive.
  • Uploading can be done from any specified location inside the local PC.
  • Data can be uploaded at the ROOT level of the Drive or inside any specific folder in the Drive.
  • In case of a minor internet interruption(~10-15 secs) the upload would be paused and once the internet connection is stable. The uploading will get resumed.
  • Uploader() also maintains the exact same directory tree structure while uploading from the local PC to Drive.
  • The level of child directories to be uploaded is decided by max_depth parameter as shown in the example below.
  • By default, max_depth = 5
  • Using Uploader()
>>> from zdrive import Uploader
>>> input_directory = "/home/abhinav/Downloads"
>>> u = Uploader()
>>> parent_folder_id = u.createFolder(name="Data")
>>> result = u.uploadFolder(input_directory, max_depth=3, parentId=parent_folder_id)
>>> print(result)

'{
    "files":
        {
            "/Users/abhinavanand/Downloads/test/def.pdf": "1pJNIu-0oyzaUgjLvnf6-3mk81iwLBXyS"
        },
    "folders":
        {
        "/Users/abhinavanand/Downloads/test/test-level-1":
            {
                "files":
                {
                    "/Users/abhinavanand/Downloads/test/test-level-1/abc.pdf": "1YwZs__92yzWdM2e7Nc2atF5lzLnyYV9i"
                },
                "folders": {},
                "id": "1zzh_hGImg94SnzrMC8LdH1vgbO3LMksD"
            }
        }
}'
  • If no parentId is specified, then Uploader() would upload the contents from local PC to the ROOT level in Drive.

5   Contributing

[back to top]

Please refer Contributing page for details

6   Bugs

[back to top]

Please report the bugs at the issue tracker

7   License

[back to top]

Built with by Abhinav Anand under the MIT License ©

You can find a copy of the License at http://abhinav.mit-license.org/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].