我尝试在我的appengine项目中使用google远程api将本地文件上传到我的应用程序的默认云存储桶中。在
我已经配置了应用程序yaml打开远程api。我可以访问我的bucket并从中上传/访问文件。我运行本地python控制台并尝试使用以下代码写入bucket:
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.api import app_identity
import cloudstorage
def auth_func():
return ('user@gmail.com', '*******')
remote_api_stub.ConfigureRemoteApi('my-app-id', '/_ah/remote_api', auth_func,'my-app-id.appspot.com')
filename = "/"+app_identity.get_default_gcs_bucket_name()+ "/myfile.txt"
gcs_file = cloudstorage.open(filename,'w',content_type='text/plain',options={'x-goog-meta-foo': 'foo','x-goog-meta-bar': 'bar'})
我看到以下回应:
^{pr2}$注意
http://None/_ah/gcs.....
我不认为无应该是url的一部分。GoogleAppEngineCloudStorageClient v1.9.0.0是否有问题?我也在用谷歌应用引擎1.9.1。在
有什么想法吗?在
在 Google云存储客户端不尊重remote_api_存根,认为您正在本地运行脚本
甚至是
^{pr2}$会有帮助的。在
函数,从
common.py
检查环境如果我理解正确,你想上传一个本地文本文件到一个特定的bucket。我认为你所做的不会奏效。在
另一种方法是丢弃RemoteAPI并使用Cloud Storage API将其上载。在
相关问题 更多 >
编程相关推荐