Skip to main content

Python Client for Google Cloud Storage

Project description

This is a shared codebase for gcloud-rest-storage and gcloud-rest-storage

Latest PyPI Version (gcloud-rest-storage) Python Version Support (gcloud-rest-storage) Python Version Support (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


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.3.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

gcloud_rest_storage-5.3.0-py2.py3-none-any.whl (15.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file gcloud-rest-storage-5.3.0.tar.gz.

File metadata

  • Download URL: gcloud-rest-storage-5.3.0.tar.gz
  • Upload date:
  • Size: 12.3 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

Hashes for gcloud-rest-storage-5.3.0.tar.gz
Algorithm Hash digest
SHA256 65a867355ca203b365c5db430cb584275f6617010eb67103b779f08810f30fb9
MD5 6378b3848dd6427d2a1a50eb19e12a8c
BLAKE2b-256 282d6a6ef84ed78a1c6279bc04a20dedd85c6921c85077172f3311b8bef50aca

See more details on using hashes here.

File details

Details for the file gcloud_rest_storage-5.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: gcloud_rest_storage-5.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.5 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

Hashes for gcloud_rest_storage-5.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1d96d002f4eee38cca48e1538b96efb1265f076e0fd800705a4771e2b2f4e2d4
MD5 3d9e8f37bddb8c4bec2d3e05e5a6deb0
BLAKE2b-256 48868d6da0c17dc436a2f932ad1a8248b6dfa5dad586da760cd80b3c94ab9286

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page