Python Client for Google Cloud Storage
Project description
This is a shared codebase for gcloud-aio-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.aio.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-aio-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
gcloud-aio-storage-5.4.0.tar.gz
(11.9 kB
view hashes)
Built Distribution
Close
Hashes for gcloud_aio_storage-5.4.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab587d1a07ce539a5cc08060e4c4e13fc0388743d2a19d701e97ff3a9cc32c26 |
|
MD5 | d10236c8f80e28f217f42d7ce4f93742 |
|
BLAKE2b-256 | c358dea747193db2b37761cd0722e5bcac20f7beb8e36c587f3d5740d22b6d9e |