Add google appengine to repo
[frozenviper.git] / google_appengine / google / appengine / api / urlfetch_errors.py
blob13bfac0175438726666bad5606e254230d424eb9
1 #!/usr/bin/env python
3 # Copyright 2007 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 """Errors used in the urlfetch API
18 developers.
19 """
26 class Error(Exception):
27 """Base URL fetcher error type."""
30 class InvalidURLError(Error):
31 """Raised when the URL given is empty or invalid.
33 Only http: and https: URLs are allowed. The maximum URL length
34 allowed is 2048 characters. The login/pass portion is not
35 allowed. In deployed applications, only ports 80 and 443 for http
36 and https respectively are allowed.
37 """
40 class DownloadError(Error):
41 """Raised when the we could not fetch the URL for any reason.
43 Note that this exception is only raised when we could not contact the
44 server. HTTP errors (e.g., 404) are returned in as the status_code field
45 in the return value of Fetch, and no exception is raised.
46 """
49 class ResponseTooLargeError(Error):
50 """Raised when the response was too large and was truncated."""
51 def __init__(self, response):
52 self.response = response
55 class InvalidMethodError(Error):
56 """Raised when an invalid value for 'method' is provided"""