Python 应用程序引擎到地面军事系统|上传问题

Python 应用程序引擎到地面军事系统|上传问题,python,google-app-engine,google-cloud-storage,Python,Google App Engine,Google Cloud Storage,我从Evernote API(通过getResource)收到了一些文件,并使用以下代码将其写入Google云存储: gcs_file = gcs.open(filename, 'w', content_type=res.mime, retry_params=write_retry_params) # Retrieve the binary data and write to GCS resource_file = note_store.getResou

我从Evernote API(通过
getResource
)收到了一些文件,并使用以下代码将其写入Google云存储:

gcs_file = gcs.open(filename, 'w', content_type=res.mime,
                    retry_params=write_retry_params)

# Retrieve the binary data and write to GCS
resource_file = note_store.getResource(res.guid, True, False, False, False)
gcs_file.write(resource_file.data.body)

gcs_file.close()
即使对于某些类型的文档,它仍然有效。但GCS在日志中记录了某些文件:

Unable to fetch URL: https://storage.googleapis.com/evernoteresources/5db799f1-c03c-4056-812a-6d77bad55261/Sleep Away.mp3

这些错误似乎没有任何模式。它发生在文档、声音、图片等方面——这些文档类型中有些有效,有些无效。这不是因为尺寸(因为一些小的工作和一些大的工作)

有什么想法吗


这是完整的堆栈跟踪,尽管我不确定它是否有用

Encountered unexpected error from ProtoRPC method implementation: TimeoutError (('Request to Google Cloud Storage timed out.', DownloadError('Unable to fetch URL: https://storage.googleapis.com/evernoteresources/78413585-2266-4426-b08c-71d6c224f266/Evernote Snapshot 20130512 124546.jpg',)))
Traceback (most recent call last):
  File "/python27_runtime/python27_lib/versions/1/protorpc/wsgi/service.py", line 181, in protorpc_service_app
    response = method(instance, request)
  File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/endpoints/api_config.py", line 972, in invoke_remote
    return remote_method(service_instance, request)
  File "/python27_runtime/python27_lib/versions/1/protorpc/remote.py", line 412, in invoke_remote_method
    response = method(service_instance, request)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/endpoints.py", line 61, in get_note_details
    url = tools.registerResource(note_store, req.note_guid, r)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/GlobalUtilities.py", line 109, in registerResource
    retry_params=write_retry_params)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/cloudstorage/cloudstorage_api.py", line 69, in open
    return storage_api.StreamingBuffer(api, filename, content_type, options)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/cloudstorage/storage_api.py", line 526, in __init__
    status, headers, _ = self._api.post_object(path, headers=headers)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/cloudstorage/rest_api.py", line 41, in sync_wrapper
    return future.get_result()
  File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 325, in get_result
    self.check_success()
  File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 368, in _help_tasklet_along
    value = gen.throw(exc.__class__, exc, tb)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/cloudstorage/storage_api.py", line 84, in do_request_async
    'Request to Google Cloud Storage timed out.', e)
TimeoutError: ('Request to Google Cloud Storage timed out.', DownloadError('Unable to fetch URL: https://storage.googleapis.com/evernoteresources/78413585-2266-4426-b08c-71d6c224f266/Evernote Snapshot 20130512 124546.jpg',))

谢谢你,布莱恩!问题是文件名中的空格。我刚刚用了
urllib2.quote()
把它们弄出来,它就像一个符咒。

这是gcs客户端代码中的一个bug。它应该正确处理文件名。它使用http请求GCS的事实应该是“隐藏的”。这个问题很快就会解决。谢谢


注意:如果您自己引用文件名来解决此错误,则在修复后文件名将被双引号引用。抱歉。

您发布的两个错误的路径中都有空格。对于您看到错误的所有情况都是这样吗?
Encountered unexpected error from ProtoRPC method implementation: TimeoutError (('Request to Google Cloud Storage timed out.', DownloadError('Unable to fetch URL: https://storage.googleapis.com/evernoteresources/78413585-2266-4426-b08c-71d6c224f266/Evernote Snapshot 20130512 124546.jpg',)))
Traceback (most recent call last):
  File "/python27_runtime/python27_lib/versions/1/protorpc/wsgi/service.py", line 181, in protorpc_service_app
    response = method(instance, request)
  File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/endpoints/api_config.py", line 972, in invoke_remote
    return remote_method(service_instance, request)
  File "/python27_runtime/python27_lib/versions/1/protorpc/remote.py", line 412, in invoke_remote_method
    response = method(service_instance, request)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/endpoints.py", line 61, in get_note_details
    url = tools.registerResource(note_store, req.note_guid, r)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/GlobalUtilities.py", line 109, in registerResource
    retry_params=write_retry_params)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/cloudstorage/cloudstorage_api.py", line 69, in open
    return storage_api.StreamingBuffer(api, filename, content_type, options)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/cloudstorage/storage_api.py", line 526, in __init__
    status, headers, _ = self._api.post_object(path, headers=headers)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/cloudstorage/rest_api.py", line 41, in sync_wrapper
    return future.get_result()
  File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 325, in get_result
    self.check_success()
  File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 368, in _help_tasklet_along
    value = gen.throw(exc.__class__, exc, tb)
  File "/base/data/home/apps/s~quinector/2a.368528733040360018/cloudstorage/storage_api.py", line 84, in do_request_async
    'Request to Google Cloud Storage timed out.', e)
TimeoutError: ('Request to Google Cloud Storage timed out.', DownloadError('Unable to fetch URL: https://storage.googleapis.com/evernoteresources/78413585-2266-4426-b08c-71d6c224f266/Evernote Snapshot 20130512 124546.jpg',))