Coverage for requests/__init__.py : 87%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
# __ # /__) _ _ _ _ _/ _ # / ( (- (/ (/ (- _) / _) # /
Requests HTTP Library ~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings. Basic GET usage:
>>> import requests >>> r = requests.get('https://www.python.org') >>> r.status_code 200 >>> 'Python is a programming language' in r.content True
... or POST:
>>> payload = dict(key1='value1', key2='value2') >>> r = requests.post('http://httpbin.org/post', data=payload) >>> print(r.text) { ... "form": { "key2": "value2", "key1": "value1" }, ... }
The other HTTP methods are supported - see `requests.api`. Full documentation is at <http://python-requests.org>.
:copyright: (c) 2017 by Kenneth Reitz. :license: Apache 2.0, see LICENSE for more details. """
# Sometimes, urllib3 only reports its version as 16.1.
# Check urllib3 for compatibility. # urllib3 >= 1.21.1, <= 1.22
# Check chardet for compatibility. # chardet >= 3.0.2, < 3.1.0
# Check imported dependencies for compatibility. except (AssertionError, ValueError): warnings.warn("urllib3 ({0}) or chardet ({1}) doesn't match a supported " "version!".format(urllib3.__version__, chardet.__version__), RequestsDependencyWarning)
# urllib3's DependencyWarnings should be silenced.
RequestException, Timeout, URLRequired, TooManyRedirects, HTTPError, ConnectionError, FileModeWarning, ConnectTimeout, ReadTimeout )
# Set default logging handler to avoid "No handler found" warnings. except ImportError: class NullHandler(logging.Handler): def emit(self, record): pass
# FileModeWarnings go off per the default. |