Stay organized with collections
Save and categorize content based on your preferences.
Source code for google.appengine.api.urlfetch_errors
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Errors used in the urlfetch API."""
[docs]class Error(Exception):
"""Base URL fetcher error type."""
[docs]class DownloadError(Error):
"""The URL could not be retrieved.
This exception is only raised when we cannot contact the server. HTTP errors
(such as 404) are returned in the `status_code` field in the return value of
`fetch`, and no exception is raised.
"""
[docs]class TooManyRedirectsError(DownloadError):
"""`follow_redirects` was set to True, and the redirect limit was hit."""
[docs]class InternalTransientError(Error):
"""An internal transient error occurred."""
[docs]class ConnectionClosedError(DownloadError):
"""The target server prematurely closed the connection."""
[docs]class InvalidURLError(Error):
"""The URL given was empty or invalid.
Only HTTP and HTTPS URLs are allowed. The maximum URL length is 2048
characters. The login and password portion is not allowed. In deployed
applications, only ports 80 and 443 for HTTP and HTTPS respectively are
allowed.
"""
[docs]class DNSLookupFailedError(DownloadError):
"""The DNS lookup for a URL failed."""
[docs]class DeadlineExceededError(DownloadError):
"""The URL was not fetched because the deadline was exceeded.
This can occur with either the client-supplied `deadline`, or the system
default if the client does not supply a `deadline` parameter.
"""
[docs]class InvalidMethodError(Error):
"""An invalid value was provided for `method`."""
[docs]class SSLCertificateError(Error):
"""An invalid server certificate was presented."""
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-04-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-04-04 UTC."],[[["This document details the various error types that can occur when using the `urlfetch` API in Google App Engine."],["`Error` is the base class for all URL fetch errors, with specific subclasses like `DownloadError`, `InvalidURLError`, and `InternalTransientError` handling different failure scenarios."],["`DownloadError` and its subclasses, such as `MalformedReplyError`, `TooManyRedirectsError`, `ConnectionClosedError`, `DNSLookupFailedError`, and `DeadlineExceededError`, represent issues encountered while attempting to contact or communicate with a server."],["`InvalidURLError` and `PayloadTooLargeError` indicate problems with the provided URL or the request payload, including issues with URL format, length, or allowed ports."],["Other error types like `ResponseTooLargeError`, `InvalidMethodError`, and `SSLCertificateError` cover issues related to the response size, request method, and SSL certificate validity, respectively."]]],[]]