问题描述
我试图建立一个基本的基于python的谷歌应用程序引擎网站,允许用户上传文件到谷歌云存储(主要是图片)。 我b'b我一直在浏览JSON API和GCS客户端库概述(以及blobstore等)的文档,但仍然没有很好的处理方法,哪些是最好的方法以及它们是如何相关的。如果有人能够对此进行概述或者指向我可以查看的一些资源,那么这将非常棒。另外,任何相关的示例代码都会非常有用。我已经能够在这里运行上传示例,但不确定它们是否适用于应用引擎设置:
感谢!!
Google云端存储有两个API - 和。 XML API基于XML,非常类似于Amazon S3 API。 JSON API与许多其他Google API类似,可与标准Google API客户端库一起使用(例如,)。这两种API都可以在任何地方使用,无论是否使用App Engine,都基于RESTful HTTP调用。
App Engine提供了几种访问Google的标准方式云储存。第一个内置于App Engine的API中,称为功能。这不会直接使用XML或JSON API。它已被弃用,不再推荐。
第二个App Engine库称为,并且不属于核心App Engine API。相反,它是Google推出的一个Python库,您可以像任何其他库一样下载并添加到您的应用程序中。这个库恰好使用XML API来实现。它提供了一些对App Engine用户非常有用的额外功能,例如在上载过程中序列化上载的功能。在python / demo目录下有一个使用这个库作为下载的一部分的例子。您可以。
这些工具的等价物也存在于Java和Go中。
用户不需要使用App Engine除非他们发现它们是有用的。标准的Python库或甚至只是使用urlfetch手写的HTTP调用也可以。 App Engine库仅为App Engine用户提供了一些有用的额外功能。
App Engine也有一个Blobstore Python API。这是App Engine特有的功能,与Google云端存储不同,只是它提供了一些Google云端存储挂钩,例如可以使用Blobstore API将文件存储到Google Cloud Storage中。
I'm trying to set up a basic python-based google app engine site that allows users to upload files to google cloud storage (mostly images)
I've been going through the documentation for the JSON API and the GCS client library overview (as well as blobstore etc) and still don't have a good handle on which is the best method and how they are related. Would be great if someone could give an overview of this or point me to some resources I can check out
Also, any sample code that's relevant would be really helpful. I've been able to run the upload samples here but not sure if they're useful for an app engine setup: https://github.com/GoogleCloudPlatform/storage-file-transfer-json-python
Thanks!!
Google Cloud Storage has two APIs -- the XML API and the JSON API. The XML API is XML based and very like the Amazon S3 API. The JSON API is similar to many other Google APIs, and it works with the standard Google API client libraries (for example, the Google API Python library). Both of these APIs can be used from anywhere, with or without App Engine, and are based on RESTful HTTP calls.
App Engine provides a couple of standard ways to access Google Cloud Storage. The first is built into App Engine's API as a feature called the "Google Cloud Storage Python API". This does not directly use either the XML or the JSON API. It's deprecated and no longer recommended.
The second App Engine library is called the "Google Cloud StoragePython Client Library" and is not part of the core App Engine API. Instead, it's a Python library put out by Google that you can download and add to your application like any other library. This library happens to be implemented using the XML API. It provides a few extra features that are useful for App Engine users, such as the ability to serialize an upload while it's in progress. There's an example of using this library included as part of the download, in the python/demo directory. You can also see it online.
Equivalents of these tools also exist in Java and Go.
There's no need for users to use the App Engine-specific libraries unless they find them to be useful. The standard Python library or even just hand-written HTTP calls using urlfetch will work just as well. The App Engine library merely provides some useful extras for App Engine users.
App Engine also have a "Blobstore Python API". This is a feature specific to App Engine and distinct from Google Cloud Storage, except that it provides a few hooks into Google Cloud Storage, such as the ability to store files in Google Cloud Storage using the Blobstore API.
这篇关于使用Google App Engine将文件上传到Google云端存储(Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!