GS: A minimalistic Google Storage client
gs is a command line interface (CLI) and Python library that provides a set of essential commands for Google Cloud Storage. It is modeled after the AWS CLI’s aws s3 command. Its features are:
Python 3 compatibility
A minimalistic set of dependencies
A tiny footprint
Intuitive convention-driven configuration of API credentials without browser login prompts
Checksum validation to ensure end-to-end data integrity in uploads and downloads
Progress bars for long-running upload and download operations
Resumable uploads and downloads
Multithreaded directory sync and batch delete, capable of handling large numbers of objects
An attractive paging and table layout interface
A JSON object metadata output mode for feeding data to other utilities
Installation
pip install gs
Synopsis
- Usage:
gs [OPTIONS] COMMAND [ARGS]...
- Options:
- --version
Show the version and exit.
- --help
Show this message and exit.
- Commands:
gs configure
Set gs config options, including the API key.
gs ls
List buckets or objects in a bucket/prefix.
gs cp
Copy files to, from, or between buckets.
gs mv
Move files to, from, or between buckets.
gs mb
Create a new Google Storage bucket.
gs rb
Permanently delete an empty bucket.
gs rm
Delete objects (files) from buckets.
gs sync
Sync a directory of files with bucket/prefix.
gs api
Use httpie to perform a raw HTTP API request.
gs presign
Get a pre-signed URL for accessing an object.
Run gs configure to configure Google service account access credentials that will be used by the gs command. You can create a new service account key at https://console.cloud.google.com/iam-admin/serviceaccounts.
Credentials
Before making API calls, gs ingests API credentials in the following order of priority:
First, gs checks if a GOOGLE_APPLICATION_CREDENTIALS environment variable is set. If so, it attempts to load and use credentials from the service account credentials filename referenced by the variable.
If that varible is not set, gs attempts to load service account credentials previously configured with gs configure (stored in ~/.config/gs/config.json).
If that fails, gs attempts to load a service account API token from Google instance metadata.
If that fails, gs prints a warning and attempts to make API requests anonymously.
Using the Python library interface
from gs import GSClient
client = GSClient()
object_meta = client.get("b/my-bucket/o/my-object")
with client.get("b/my-bucket/o/my-object", params=dict(alt="media"), stream=True) as res:
object_bytes = res.raw.read()
presigned_url = client.get_presigned_url("my-bucket", "my-object", expires_at=time.time()+3600)
Links
Bugs
Please report bugs, issues, feature requests, etc. on GitHub.
License
Licensed under the terms of the MIT License.
Metadata
Release files for gs 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gs-1.1.1.tar.gz | 26.6 kB | Without provenance | Details for gs-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gs-1.1.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for gs-1.1.1-py2.py3-none-any.whl |
Total release size: 53.9 kB
Release files / gs-1.1.1.tar.gz
| Download URL | gs-1.1.1.tar.gz |
|---|---|
| Size | 26.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1587d521cfeef4f8e0de5dbc9d5081375532a1c2b8c20418adfaca9e5700cc28
|
|
BLAKE2b-256 checksum How to use checksums |
eb577edce9823698cc7ca0bd4db6d2a736ff58495db46f8411649fa3c6762316
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.7
|
Release files / gs-1.1.1-py2.py3-none-any.whl
| Download URL | gs-1.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 27.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1a1fcf0ea9cef5ea6348c152561bc49b078777d2df40abc40a240288148138ac
|
|
BLAKE2b-256 checksum How to use checksums |
9d0df3a4d1f94c46fe7632096bd81f372faacf6152488ca67ace54c39ac438bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.7
|
Security for gs 1.1.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.