mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Relocate exceptions
This commit is contained in:
@@ -22,3 +22,4 @@ __copyright__ = 'Copyright 2011 Kenneth Reitz'
|
||||
|
||||
from models import HTTPError, auth_manager
|
||||
from api import *
|
||||
from exceptions import *
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.models
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
"""
|
||||
|
||||
class RequestException(Exception):
|
||||
"""There was an ambiguous exception that occured while handling your
|
||||
request."""
|
||||
|
||||
class AuthenticationError(RequestException):
|
||||
"""The authentication credentials provided were invalid."""
|
||||
|
||||
class Timeout(RequestException):
|
||||
"""The request timed out."""
|
||||
|
||||
class URLRequired(RequestException):
|
||||
"""A valid URL is required to make a request."""
|
||||
|
||||
class InvalidMethod(RequestException):
|
||||
"""An inappropriate method was attempted."""
|
||||
+1
-22
@@ -19,6 +19,7 @@ from .monkeys import Request as _Request, HTTPBasicAuthHandler, HTTPDigestAuthHa
|
||||
from .structures import CaseInsensitiveDict
|
||||
from .packages.poster.encode import multipart_encode
|
||||
from .packages.poster.streaminghttp import register_openers, get_handlers
|
||||
from .exceptions import RequestException, AuthenticationError, Timeout, URLRequired, InvalidMethod
|
||||
|
||||
|
||||
|
||||
@@ -480,25 +481,3 @@ class AuthObject(object):
|
||||
self.handler = self._handlers.get(handler.lower(), urllib2.HTTPBasicAuthHandler)
|
||||
else:
|
||||
self.handler = handler
|
||||
|
||||
|
||||
# ----------
|
||||
# Exceptions
|
||||
# ----------
|
||||
|
||||
|
||||
class RequestException(Exception):
|
||||
"""There was an ambiguous exception that occured while handling your
|
||||
request."""
|
||||
|
||||
class AuthenticationError(RequestException):
|
||||
"""The authentication credentials provided were invalid."""
|
||||
|
||||
class Timeout(RequestException):
|
||||
"""The request timed out."""
|
||||
|
||||
class URLRequired(RequestException):
|
||||
"""A valid URL is required to make a request."""
|
||||
|
||||
class InvalidMethod(RequestException):
|
||||
"""An inappropriate method was attempted."""
|
||||
|
||||
Reference in New Issue
Block a user