python and google cloud storage

2019-06-17 07:37发布

I can't find an example of how to use the google cloud storage WITHOUT running it on google appengine.

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

So what I want to archive is that my frontend asks my python backend which then asks the cloud storage. I can't seam to find any examples that doesn't use appengine to authenticate, but it cant be impossible.

I've looked at both a couple of examples on https://github.com/GoogleCloudPlatform/ but i can't find one without dependencies on appengine.

It also has to run on python3.

3条回答
干净又极端
2楼-- · 2019-06-17 07:57

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

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

Python 3.3+ is also now supported! However, this library has not yet been used as thoroughly with Python 3, so we'd recommend testing before deploying with Python 3 in production.

查看更多
仙女界的扛把子
3楼-- · 2019-06-17 08:00

You can use gsutil to access Google Cloud Storage from the command line. There is a getting started tutorial here.

There is a Python example using gsutil here:

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

查看更多
时光不老,我们不散
4楼-- · 2019-06-17 08:16

I think this is a good question as there are a lot of python libraries floating around in addition to the gsutil cli. This seems to be the latest supported python client by google

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

and the github is here

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

查看更多
登录 后发表回答