Skip to main content

CurlGoogle

CurlGoogle is a lightweight, easy-to-use, and extremely simple library that allows you to link devices to Google accounts and transfer files (upload/download) using nothing more than the command line. Built on the principles demonstrated in this article, this library offers a lean alternative to more extensive libraries such as google-drive.

With absolutely no specific dependencies needed apart from curl, you can get up and running with file transfers on Google Drive in no time. The library's minimalistic design makes it not only easy to install but also to understand and use.

Installation

To install the library, open your terminal and type the following command:

pip install curlgoogle

This command installs the library from the source directory (TODO: add to PyPI).

Usage

(Disclaimer: Most of the explanation here is derived from this article.)

Installing curl

You should install curl on the device you are trying to run this package (this is the only dependency).

sudo apt install curl # Linux Debian/Ubuntu
brew install curl # Mac

Creating a Google Cloud Platform Project and Acquiring Credentials

In order to manage access to our Google Drive, we need to establish a level of control. This can be achieved by creating a project that incorporates user-specified permissions. This project will function as an intermediary between our users (or us, when using a different machine) and our Google account. The initial step in this process is to navigate to the specified page and set up a new project.

Now, select the Credentials tab and then create credentials which is OAuth Client ID in particular. For app type, you may select anything!

After setting up, you now have a client ID and a client secret. You will need these to authenticate your requests. To automate the process, we use [Dotenv] to store your secrets. Make sure to add .env in your .gitignore file to avoid sharing your secrets with the world!

Run the following commands to install dotenv and create a .env file with the appropriate variables:

pip install python-dotenv
dotenv set GDRIVE_CLIENT_ID <your_client_id>
dotenv set GDRIVE_CLIENT_SECRET <your_client_secret>

Upload and Download

After the setup phase, you're good to go! You do not need to repeat this phase again for your project as the credentials are safely stored in your .env file and the library automatically loads them when you import it.

You can use either a commandline interface (CLI) to upload/download files, or use the library sdk.

CLI

Use the following format for download and upload

curlgoogle_upload <file_name> <file1> <file2> ... <fileN> (optional)<file_id>

file_name will determine the zip file that will be created and uploaded to your Google Drive. file1 to fileN are the files that you want to upload. file_id is the id of the folder you want to upload to. If you do not specify a file_id, the file will be uploaded to the root directory of your Google Drive.

For download use the following format:

curlgoogle_download <file_id>

This will automatically download the file with the specified file_id to your current directory and unzip it for you.

SDK

You can also use the following functions for upload and download while development. Note that this will automatically prompt you to authenticate your Google account mid-run; therefore, it might not be the ideal use case for production.

# Uplaoding function
curlgoogle.upload(
    file_name: str, 
    file_list: List[str], 
    folder_id: Optional[str] = None
)
# Downloading function
curlgoogle.download(
    file_id: str
)

License

This project is licensed under MIT License.

Metadata

Release files for curlgoogle 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for curlgoogle 0.0.1
File Size Uploaded Provenance Actions
curlgoogle-0.0.1.tar.gz 7.4 kB Without provenance Details for curlgoogle-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for curlgoogle 0.0.1
File Interpreter ABI Platform Actions
curlgoogle-0.0.1-py3-none-any.whl Python 3 none any Details for curlgoogle-0.0.1-py3-none-any.whl

Total release size: 15.5 kB

Release files / curlgoogle-0.0.1.tar.gz

Download URL curlgoogle-0.0.1.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e860e0846ad4f503b611a6404a6759726d3cb82035c8402df3d2452b3609fe66
BLAKE2b-256 checksum
How to use checksums
9a350309826156a2975d71ad8e514d81718abf4de99186f74d18372309e905bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17

Release files / curlgoogle-0.0.1-py3-none-any.whl

Download URL curlgoogle-0.0.1-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29917bca36481941dcbbb8e105d266e06d3a04975e4be75b6cf24a40c4df65b9
BLAKE2b-256 checksum
How to use checksums
87f2cc4ab10f50b5c5f4962d1588b7330f4070b9321a7711414f40b0bf6dc504
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17

Security for curlgoogle 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page