簡體   English   中英

App Engine到GCS | 上載問題

[英]App Engine to GCS | Uploading Issue

我有一些文件是從Evernote API(通過getResource )接收的,並使用以下代碼寫入Google Cloud Storage:

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

Got exception while contacting GCS. Will retry in 0.11 seconds.

這些錯誤似乎沒有任何模式。 它發生在文檔,聲音,圖片等任何東西上-其中一些文檔類型有效,而有些則無效。 這不是由於大小(因為有些小工作而有些大的)。

有任何想法嗎?


這是完整的堆棧跟蹤,盡管我不確定它會有所幫助。

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()將它們從那里urllib2.quote() ,它的工作就像一個魅力。

這是gcs客戶端代碼中的錯誤。 它應該正確處理文件名。 它使用對GCS的http請求的事實應該被“隱藏”。 這將很快修復。 謝謝!

請注意,如果您自己引用文件名來解決此錯誤,則修復后文件名將被雙引號引起來。 抱歉。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM