Python 2.7 已終止支援,並將於 2026 年 1 月 31 日
淘汰。淘汰後,您將無法部署 Python 2.7 應用程式,即使貴機構先前曾使用機構政策重新啟用舊版執行階段的部署作業,也無法部署。現有的 Python 2.7 應用程式在
淘汰日期過後,仍會繼續執行並接收流量。建議您
改用系統支援的最新 Python 版本。
Cloud Storage 錯誤與錯誤處理機制
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Google Cloud Storage 可透過 App Engine UrlFetch
功能來存取,因此可能會出現下列三種錯誤來源:
- App Engine UrlFetch 暫時性錯誤。
- Google Cloud Storage 暫時性錯誤。
- 與值區和物件授權相關的 Google Cloud Storage 錯誤。
Cloud Storage 適用的 App Engine 用戶端程式庫可處理 App Engine 與 Google Cloud Storage 兩端的逾時錯誤,並會自動執行重試,因此您的應用程式不需要新增邏輯來處理這種錯誤。逾時與重試機制的設定會透過 RetryParams 類別發布,您也可以用此類別變更任何一項預設設定,或全數更改。您可以將變更套用至所有函式呼叫,也可以使用函式的 retry_params
參數,指定特定呼叫的變更。
錯誤
Cloud Storage 適用的 App Engine 用戶端程式庫定義了下列錯誤例外狀況類別:
- cloudstorage.Error
-
本套件中所有例外狀況的基本類別。錯誤可能會產生自 App Engine 或 Google Cloud Storage。如需 Google Cloud Storage 的 HTTP 錯誤代碼詳細資訊,請參閱 Google Cloud Storage 說明文件中的 HTTP 狀態和錯誤代碼 。
- cloudstorage.AuthorizationError
- Google Cloud Storage 收到未經授權的要求。如果授權應用程式所使用的存取憑證過期,就可能產生此錯誤。通常 Cloud Storage 適用的 App Engine 用戶端程式庫會自動處理此類錯誤,程式庫會取得新存取憑證並重試要求。
- cloudstorage.ForbiddenError
此類錯誤 (403) 表示 Google Cloud Storage 並未授權該使用者發出要求。
- cloudstorage.NotFoundError
-
HTTP 錯誤 404。您在呼叫
cloudstorage.delete()
、cloudstorage.listbucket()
、cloudstorage.open()
或 cloudstorage.stat()
時指定的資料夾或物件不存在。
- cloudstorage.TimeoutError
-
多次試圖重試後,系統與 Google Cloud Storage 伺服器聯絡仍逾時,就會產生此錯誤。(如需變更預設逾時處理和重試設定的相關資訊,請參閱 RetryParams。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-04 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-04 (世界標準時間)。"],[[["The App Engine client library for Cloud Storage handles timeout errors and retries automatically, eliminating the need for manual handling in your app."],["The `RetryParams` class allows customization of timeout and retry settings, which can be applied globally or to specific function calls."],["Errors related to Google Cloud Storage access can stem from transient issues, or from bucket and object authorization, in addition to transient errors coming from App Engine `UrlFetch`."],["The `cloudstorage` library defines exception classes like `Error`, `AuthorizationError`, `ForbiddenError`, `NotFoundError`, and `TimeoutError` to handle various error scenarios."],["`ForbiddenError` (403) is common when the bucket permissions (bucket ACL) are not configured properly to allow access from the application."]]],[]]