Merge pull request #4987 from aless10/master
Before adoption: this commit came in with the history the project adopted, so no landing records it.
[fix] fix failing doctests in requests/*
authored by Kenneth Reitz · committed by GitHub · parents ada5049, df918c0 · Browse files · 8 files·+18 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
8 files+18 added−9 removed
- other:+18 added−9 removed
Provenance
- Commit
3e7d0a8- Tree
d1ca3a3- Author
Kenneth Reitz <me@kennethreitz.org>- Committer
GitHub <noreply@github.com>- Parent 1
ada5049- Parent 2
df918c0
8 files changed+18 added−9 removed
modified:requests/__init__.py+5 added-5 removed
7 unmodified lines8 """9 Requests HTTP Library10 ~~~~~~~~~~~~~~~~~~~~~11 12-Requests is an HTTP library, written in Python, for human beings. Basic GET13-usage:12+Requests is an HTTP library, written in Python, for human beings.13+Basic GET usage:14 15 >>> import requests16 >>> r = requests.get('https://www.python.org')17 >>> r.status_code18 20019- >>> 'Python is a programming language' in r.content19+ >>> b'Python is a programming language' in r.content20 True21 22 ... or POST:23 2 unmodified lines26 >>> print(r.text)27 {28 ...29 "form": {30- "key2": "value2",31- "key1": "value1"30+ "key1": "value1",31+ "key2": "value2"32 },33 ...34 }35 96 unmodified linesmodified:requests/api.py+1 added
48 unmodified lines49 Usage::50 51 >>> import requests52 >>> req = requests.request('GET', 'https://httpbin.org/get')53+ >>> req54 <Response [200]>55 """56 57 # By using the 'with' statement we are sure the session is closed, thus we104 unmodified linesmodified:requests/models.py+1 added
278 unmodified lines279 280 >>> import requests281 >>> req = requests.Request('GET', 'https://httpbin.org/get')282 >>> r = req.prepare()283+ >>> r284 <PreparedRequest [GET]>285 286 >>> s = requests.Session()287 >>> s.send(r)684 unmodified linesmodified:requests/sessions.py+1 added-1 removed
352 unmodified lines353 354 Or as a context manager::355 356 >>> with requests.Session() as s:357- >>> s.get('https://httpbin.org/get')357+ ... s.get('https://httpbin.org/get')358 <Response [200]>359 """360 361 __attrs__ = [413 unmodified linesmodified:requests/status_codes.py+1 added-1 removed
2 unmodified lines3 r"""4 The ``codes`` object defines a mapping from common names for HTTP statuses5 to their numerical codes, accessible either as attributes or as dictionary6 items.7-7+>>> import requests8 >>> requests.codes['temporary_redirect']9 30710 >>> requests.codes.teapot11 418109 unmodified linesmodified:requests/utils.py+5 added-1 removed
265 unmodified lines266 267 >>> from_key_val_list([('key', 'val')])268 OrderedDict([('key', 'val')])269 >>> from_key_val_list('string')270+ Traceback (most recent call last):271+ ...272 ValueError: cannot encode objects that are not 2-tuples273 >>> from_key_val_list({'key': 'val'})274 OrderedDict([('key', 'val')])275 18 unmodified lines294 [('key', 'val')]295 >>> to_key_val_list({'key': 'val'})296 [('key', 'val')]297 >>> to_key_val_list('string')298+ Traceback (most recent call last):299+ ...296- ValueError: cannot encode objects that are not 2-tuples.300+ ValueError: cannot encode objects that are not 2-tuples301 302 :rtype: list303 """304 if value is None:678 unmodified linesmodified:AUTHORS.rst+2 added
187 unmodified lines188 - Demetrios Bairaktaris (`@DemetriosBairaktaris <https://github.com/demetriosbairaktaris>`_)189 - Darren Dormer (`@ddormer <https://github.com/ddormer>`_)190 - Rajiv Mayani (`@mayani <https://github.com/mayani>`_)191 - Antti Kaihola (`@akaihola <https://github.com/akaihola>`_)192+- "Dull Bananas" <dull.bananas0@gmail.com> (`@dullbananas <https://github.com/dullbananas>`_)193+- Alessio Izzo (`@aless10 <https://github.com/aless10>`_)194 - Belavin Denis (`@luckydenis <https://github.com/luckydenis>`_)195 - Dull Bananas <dull.bananas0@gmail.com> (`@dullbananas <https://github.com/dullbananas>`_)modified:pytest.ini+2 added-1 removed
1 [pytest]2-addopts = -p no:warnings2+addopts = -p no:warnings --doctest-modules3+doctest_optionflags= NORMALIZE_WHITESPACE ELLIPSIS