Skip to content
Myr

Fixes #711!

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 0841940 · Browse files · 1 file+21 added−3 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+21 added−3 removed

  • other:+21 added−3 removed

1 file+21 added−3 removed

modified:requests/models.py+21 added-3 removed
11 unmodified lines
12from datetime import datetime13from io import BytesIO1415from .hooks import dispatch_hook, HOOKS16from .structures import CaseInsensitiveDict16from .structures import CaseInsensitiveDict, MultiDict17from .status_codes import codes1819from .auth import HTTPBasicAuth, HTTPProxyAuth20from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header
9 unmodified lines
30 URLRequired, SSLError, MissingSchema, InvalidSchema, InvalidURL)31from .utils import (32 get_encoding_from_headers, stream_untransfer, guess_filename, requote_uri,33 stream_decode_response_unicode, get_netrc_auth, get_environ_proxies,34 to_key_val_list, DEFAULT_CA_BUNDLE_PATH)34 to_key_val_list, DEFAULT_CA_BUNDLE_PATH, parse_header_links)35from .compat import (36 cookielib, urlparse, urlunparse, urljoin, urlsplit, urlencode, str, bytes,37 StringIO, is_py2, chardet, json, builtin_str, numeric_types)38
793 unmodified lines
832 return content833834 @property835 def json(self):836 """Returns the json-encoded content of a request, if any."""836 """Returns the json-encoded content of a response, if any."""837 try:838 return json.loads(self.text or self.content)839 except ValueError:840 return None841842 @property843 def links(self):844 """Returns the parsed header links of the response, if any."""845846 header = self.headers['link']847848 # l = MultiDict()849 l = {}850851 if header:852 links = parse_header_links(header)853854 for link in links:855 key = link.get('rel') or link.get('url')856 l[key] = link857858 return l859860 @property861 def reason(self):862 """The HTTP Reason for the response."""863 return self.raw.reason864
20 unmodified lines