Python and google repository

I canโ€™t find an example of how to use Google Cloud Storage WITHOUT launch on Google Appengine.

I want something like this (which works well for me): https://github.com/GoogleCloudPlatform/storage-getting-started-javascript/, but is implemented in python instead.

So what I want to archive is that my web interface requests my Python server, which then requests the cloud storage. I can not find any examples that do not use appengine for authentication, but this cannot be impossible.

I looked at both examples at https://github.com/GoogleCloudPlatform/, but cannot find one without dependency on appengine.

It should also work in Python3.

+7
source share
4 answers

You can use gsutil to access Google Cloud Storage from the command line. Here is the beginning of the textbook .

There is a Python example using gsutil here :

This tutorial shows how to write a simple Python program that performs basic Google Cloud Storage operations using the XML API.

+1
source

google-api-python-client is the official Python client for interacting with GCS.

Python 3.x support has recently been added, with the caveat:

Python 3.3+ is now supported! However, this library has not yet been carefully used with Python 3, so we recommend testing before deploying with Python 3 during production.

0
source

I think this is a good question since there are many python libraries in addition to gsutil cli. Looks like this is the last supported Python client from Google.

https://cloud.google.com/storage/docs/reference/libraries#client-libraries-install-python

and github here

https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/storage/cloud-client

0
source

Is this what you are looking for? blob has functions for loading from a file, loading to a file. With these features, you can do almost anything with GCS.

 from google.cloud import storage client = storage.Client() bucket = client.get_bucket('bucket-name') blob = bucket.get_blob('path-to-file') data = blob.download_as_string() 

some more functions, they still have

 download_to_filename upload_from_file 
0
source

All Articles