Skip to content
Myr

HTTPError

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 4673d3d · Browse files · 1 file+14 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−5 removed

  • other:+14 added−5 removed

1 file+14 added−5 removed

modified:requests/models.py+14 added-5 removed
10 unmodified lines
11import socket12import zlib13from Cookie import SimpleCookie1415from urllib2 import HTTPError15from urlparse import urlparse, urlunparse, urljoin16from datetime import datetime1718from .hooks import dispatch_hook
1 unmodified line
20from .packages.poster.encode import multipart_encode21from .packages.poster.streaminghttp import register_openers, get_handlers22from .utils import (dict_from_cookiejar, get_unicode_from_response, stream_decode_response_unicode, decode_gzip, stream_decode_gzip)23from .status_codes import codes25from .exceptions import Timeout, URLRequired, TooManyRedirects, RequestException24from .exceptions import Timeout, URLRequired, TooManyRedirects, RequestException, HTTPError2526from .auth import dispatch as auth_dispatch2728REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved)
232 unmodified lines
261262 r.history = history263264 self.response = r265266 try:267 r.raise_for_status()266 self.response.ok = True268 self.response.ok = True269 except HTTPError:270 self.response.ok = False271272 self.response.request = self273274275 @staticmethod
203 unmodified lines
479480 def __repr__(self):481 return '<Response [%s]>' % (self.status_code)482478483 def __nonzero__(self):484 """Returns true if :attr:`status_code` is 'OK'."""485482 return not self.error486 try:487 self.raise_for_status()488 except HTTPError:489 return False490 finally:491 return True492493 def iter_content(self, chunk_size=10 * 1024, decode_unicode=None):494 """Iterates over the response data. This avoids reading the content495 at once into memory for large responses. The chunk size is the number
70 unmodified lines