Package: gcs-client
GCS-ClientGoogle Cloud Storage Python ClientApache 2.0 LicenseDocumentation:https://gcs-client.readthedocs.org.The idea is to create a client with similar functionality toGoogle’s
appengine-gcs-clientbut intended for applications running from outside
Google’s AppEngine.Cloud Storage documentation can be found atGoogleFeaturesFor now only basic functionality is available:Creating bucketsDeleting bucketsListing buckets in a projectGetting default bucket for a projectGetting bucket attributesListing objects in a bucketGetting objects attributesDeleting objectsReading object contentsWriting an objectConfigurable retries with Truncated Exponential BackoffInstallationTo install all you need to do is run:$pipinstall--upgradegcs-clientUsage ExampleTo use gcs-client in a project you will need to have Credentials to access intended Google Cloud Storage.Credentials are generated inGoogle Developers Consolein theCredentials sectionof the API Manager of the project. Recommended credentials file is JSON.Once you have the credentials you can start using gcs_client to access your project:importgcs_clientcredentials=gcs_client.Credentials('private_key.json')project=gcs_client.Project('project_name',credentials)# Print buckets in the projectbuckets=project.list()print'Buckets:\n\t-','\n\t- '.join(map(str,buckets))# Print some information from first bucketbucket=buckets[0]print'Bucket%sis located in%swith storage class%s'%(bucket,bucket.location,bucket.storageClass)# List the objects in the bucketobjects=bucket.list()ifnotobjects:print'There are no objects, creating one'filename='/tmp/my_file.txt'withbucket.open(filename,'w')asf:f.write('this is a test file\n'*100)objects=[gcs_client.Object(bucket.name,filename,credentials=credentials)]ifobjects:print'\t','\n\t'.join(map(lambdao:o.name+' has%sbytes'%o.size,objects))# Read the contents from the first filewithobjects[0].open()asobj:print'Contents of file%sare:\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.Reporting an issueIf you’ve found an issue with gcs-client here’s how you can report the problem:Preferred method is filing a bug on GitHub:Go to project’sissue tracker on GitHubSearch for existing issues using the search field at the top of the pageFile a new issue with information on the problemThanks for helping make gcs-client betterIf you don’t have a GitHub account and don’t wish to create one you can just
drop me an email.History0.2.2 (2016-11-26)Fix #1 - Media upload not working0.2.1 (2016-03-26)Fix requirements issue0.2.0 (2015-11-25)Add support for delimiter in listings using Prefix objectRemove dependency from google-api-python-clientReturn descriptive error message on AttributeError0.1.4 (2015-11-16)No changes, version bump to reload in pypi0.1.3 (2015-11-16)Reading an object will return data as bytes, not a bytearray.Read specific versions of an object.Can specify chunksize on Bucket’s open and Object init.Add exists to buckets and project.Fix opening files with names that needed encoding.0.1.2 (2015-11-10)Fix seek method.0.1.1 (2015-11-09)Fix Pypi package.0.1.0 (2015-11-09)First release on PyPI.