Python Client for Google Cloud Storage
Project description
This is a shared codebase for gcloud-rest-storage and gcloud-rest-storage
Installation
$ pip install --upgrade gcloud-{aio,rest}-storage
Usage
To upload a file, you might do something like the following:
import aiohttp
from gcloud.rest.storage import Storage
async with aiohttp.ClientSession() as session:
client = Storage(session=session)
async with open('/path/to/my/file', mode='r') as f:
status = await client.upload('my-bucket-name',
'path/to/gcs/folder',
f.read())
print(status)
Note that there are multiple ways to accomplish the above, ie,. by making use of the Bucket and Blob convenience classes if that better fits your use-case.
You can also refer smoke test for more info and examples.
Note that you can also let gcloud-rest-storage do its own session management, so long as you give us a hint when to close that session:
async with Storage() as client:
# closes the client.session on leaving the context manager
# OR
client = Storage()
# do stuff
await client.close() # close the session explicitly
Contributing
Please see our contributing guide.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gcloud-rest-storage-5.4.0.tar.gz
.
File metadata
- Download URL: gcloud-rest-storage-5.4.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53f0b438c5a9999ec0a1196f22b89d5579a221dc384cb3c323cf381072483fcc |
|
MD5 | 0a5dfacdbe89994e52a7df22696e90ca |
|
BLAKE2b-256 | 6f0488988d6b6184ba9b6ae823f56cca8785387a2f6d234238fe249278cfa49d |
File details
Details for the file gcloud_rest_storage-5.4.0-py2.py3-none-any.whl
.
File metadata
- Download URL: gcloud_rest_storage-5.4.0-py2.py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a1fd616d4358910afeb3ae452cb2804839fe89d68f3c7b4121515d91d82a458 |
|
MD5 | 4ec6af0ad64af752594cdf164d9e5862 |
|
BLAKE2b-256 | 91e332e892ec380f3f420fff19b4a08be0aa791a3244c766061bc8713dfec7fb |