Skip to content
Myr

Updated proxies documentation

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

authored by Sylvain MARIE · committed by Sylvain MARIE · parent 4b66260 · Browse files · 2 files+35 added−1 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+35 added−1 removed

  • other:+35 added−1 removed

2 files+35 added−1 removed

modified:docs/user/advanced.rst+34 added-1 removed
587 unmodified lines
588 }589590 requests.get('http://example.org', proxies=proxies)591592Alternatively you can configure it once for an entire593:class:`Session <requests.Session>`, either manually::594595 import requests596597 proxies = {598 'http': 'http://10.10.1.10:3128',599 'https': 'http://10.10.1.10:1080',600 }601 session = request.Session()602 session.proxies.update(proxies)603604 session.get('http://example.org')605606or with the helper method :func:`set_http_proxy <requests.Session.set_http_proxy>`::607608 import requests609610 session = request.Session()611 session.set_http_proxy(http_url='http://10.10.1.10:3128', https_url='http://10.10.1.10:1080')612613 session.get('http://example.org')614615You can also configure proxies by setting the environment variables593``HTTP_PROXY`` and ``HTTPS_PROXY``.616``HTTP_PROXY``, ``HTTPS_PROXY``, ``NO_PROXY`` and ``CURL_CA_BUNDLE``.617618::619620 $ export HTTP_PROXY="http://10.10.1.10:3128"
16 unmodified lines
637 proxies = {'http://10.20.1.128': 'http://10.10.1.10:5323'}638639Note that proxy URLs must include the scheme.640641Finally, note that using a proxy for https connections typically requires your local machine to trust the642proxy's root certificate. By default the list of certificates trusted by Requests can be found with::643644 from requests.utils import DEFAULT_CA_BUNDLE_PATH645 print(DEFAULT_CA_BUNDLE_PATH)646647You override this default certificate bundle by setting the standard ``CURL_CA_BUNDLE`` environment variable648to another file path.649650651SOCKS652^^^^^653654.. versionadded:: 2.10.0
416 unmodified lines
modified:AUTHORS.rst+1 added
188 unmodified lines
189- Rajiv Mayani (`@mayani <https://github.com/mayani>`_)190- Antti Kaihola (`@akaihola <https://github.com/akaihola>`_)191- "Dull Bananas" <dull.bananas0@gmail.com> (`@dullbananas <https://github.com/dullbananas>`_)192- Alessio Izzo (`@aless10 <https://github.com/aless10>`_)193- Sylvain Marié (`@smarie <https://github.com/smarie>`_)