Skip to content
Myr

json errors

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 7ef6b6b · Browse files · 2 files+5 added−8 removed
This commit

State

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

Diff stats

2 files+5 added−8 removed

  • other:+5 added−8 removed

2 files+5 added−8 removed

modified:requests/api.py+1 added
42 unmodified lines
43 session = kwargs.pop('session', None)44 if session is None:45 session = sessions.session(config=kwargs.get('config', None))46 adhoc_session = True47 # Todo, close sessions after?484950 return session.request(method=method, url=url, **kwargs)51
75 unmodified lines
modified:requests/models.py+4 added-8 removed
1046 unmodified lines
1047 # decoding fails, fall back to `self.text` (using chardet to make1048 # a best guess).1049 encoding = guess_json_utf(self.content)1050 if encoding is not None:1051 try:1052 return json.loads(self.content.decode(encoding))1051 return json.loads(self.content.decode(encoding))1053 except (ValueError, UnicodeDecodeError):1054 pass1055 try:1056 return json.loads(self.text or self.content)1057 except ValueError:1058 return None10521053 return json.loads(self.text or self.content)105410551056 @property1057 def links(self):1058 """Returns the parsed header links of the response, if any."""1059
29 unmodified lines