Google Cloud Storage Python client
Google Cloud Storage Python Client
- Apache 2.0 License
- Documentation: https://gcs-client.readthedocs.org.
The idea is to create a client with similar functionality to Google’s appengine-gcs-client but intended for applications running from outside Google’s AppEngine.
Cloud Storage documentation can be found at Google
For now only basic functionality is available:
- Creating buckets
- Deleting buckets
- Listing buckets in a project
- Getting default bucket for a project
- Getting bucket attributes
- Listing objects in a bucket
- Getting objects attributes
- Deleting objects
- Reading object contents
- Writing an object
- Configurable retries with Truncated Exponential Backoff
To use gcs-client in a project you will need to have Credentials to access intended Google Cloud Storage.
Once you have the credentials you can start using gcs_client to access your project:
import gcs_client credentials = gcs_client.Credentials('private_key.json') project = gcs_client.Project('project_name', credentials) # Print buckets in the project buckets = project.list() print 'Buckets:\n\t- ','\n\t- '.join(map(str, buckets)) # Print some information from first bucket bucket = buckets print 'Bucket %s is located in %s with storage class %s' % (bucket, bucket.location, bucket.storageClass) # List the objects in the bucket objects = bucket.list() if objects: print '\t','\n\t'.join(map(lambda o: o.name + ' has %s bytes' % o.size, objects)) # Read the contents from the first file with objects.open() as obj: print 'Contents of file %s are:\n' % obj.name, obj.read() else: print 'There are no objects, nothing to do'
More examples can be found in the documentation, in the Usage section.
- First release on PyPI.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|File Name & Checksum SHA256 Checksum Help||Version||File Type||Upload Date|
|gcs_client-0.1.0-py2.py3-none-any.whl (17.5 kB) Copy SHA256 Checksum SHA256||2.7||Wheel||Nov 9, 2015|
|gcs-client-0.1.0.tar.gz (34.3 kB) Copy SHA256 Checksum SHA256||–||Source||Nov 9, 2015|