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
gcloud-rest-storage-5.4.0.tar.gz
(12.4 kB
view hashes)
Built Distribution
Close
Hashes for gcloud-rest-storage-5.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53f0b438c5a9999ec0a1196f22b89d5579a221dc384cb3c323cf381072483fcc |
|
MD5 | 0a5dfacdbe89994e52a7df22696e90ca |
|
BLAKE2b-256 | 6f0488988d6b6184ba9b6ae823f56cca8785387a2f6d234238fe249278cfa49d |
Close
Hashes for gcloud_rest_storage-5.4.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a1fd616d4358910afeb3ae452cb2804839fe89d68f3c7b4121515d91d82a458 |
|
MD5 | 4ec6af0ad64af752594cdf164d9e5862 |
|
BLAKE2b-256 | 91e332e892ec380f3f420fff19b4a08be0aa791a3244c766061bc8713dfec7fb |