@@ -1,21 +1,21 @@
.PHONY: docs
init:
pip install pipenv --upgrade
pipenv install --dev
pip install -e .[socks]
pip install -r requirements-dev.txt
test:
# This runs all of the tests, on both Python 2 and Python 3.
detox
ci:
pipenv run py.test -n 8 --boxed --junitxml=report.xml
pytest tests --junitxml=report.xml

test-readme:
@pipenv run python setup.py check --restructuredtext --strict && ([ $$? -eq 0 ] && echo "README.rst and HISTORY.rst ok") || echo "Invalid markup in README.rst or HISTORY.rst!"
python setup.py check --restructuredtext --strict && ([ $$? -eq 0 ] && echo "README.rst and HISTORY.rst ok") || echo "Invalid markup in README.rst or HISTORY.rst!"

flake8:
pipenv run flake8 --ignore=E501,F401,E128,E402,E731,F821 requests
flake8 --ignore=E501,F401,E128,E402,E731,F821 requests

coverage:
pipenv run py.test --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=requests tests
pytest --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=requests tests

publish:
pip install 'twine>=1.5.0'
@@ -25,4 +25,4 @@ publish:

docs:
cd docs && make html
@echo "\033[95m\n\nBuild successful! View the docs homepage at docs/_build/html/index.html.\n\033[0m"
@echo "\033[95m\n\nBuild successful! View the docs homepage at docs/_build/html/index.html.\n\033[0m"
2 NOTICE
@@ -0,0 +1,2 @@
Requests
Copyright 2019 Kenneth Reitz
25 Pipfile

This file was deleted.

This file was deleted.

118 README.md
@@ -1,32 +1,6 @@
# Requests


<span align="center">

<pre>
<a href="https://requests.readthedocs.io/"><img src="https://raw.githubusercontent.com/psf/requests/master/ext/requests-logo.png" align="center" /></a>

<div align="left">
<p></p>
<code> Python 3.7.4 (default, Sep 7 2019, 18:27:02)</code>
<code> >>> <strong>import requests</strong></code>
<code> >>> r = requests.get('https://api.github.com/repos/psf/requests')</code>
<code> >>> r.json()["description"]</code>
<code> 'A simple, yet elegant HTTP library.'</code>
</div>

<p align="center">
This software has been designed for you, with much joy,
by <a href="https://kennethreitz.org/">Kenneth Reitz</a> & is protected by The <a href="https://www.python.org/psf/">Python Software Foundation</a>.
</p>
</pre>

</span>

<p>&nbsp;</p><p>&nbsp;</p>

<p align="center"><strong>Requests</strong> is an elegant and simple HTTP library for Python, built with ♥.</p>

<p>&nbsp;</p>
**Requests** is a simple, yet elegant HTTP library.

```python
>>> import requests
@@ -43,84 +17,46 @@ by <a href="https://kennethreitz.org/">Kenneth Reitz</a> & is protected by The <
{'disk_usage': 368627, 'private_gists': 484, ...}
```



---------------------------------------------------------------------

<p>&nbsp;</p>

Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs, or to form-encode your `PUT` & `POST` data — but nowadays, just use the `json` method!


Requests is one of the most downloaded Python package today, pulling in around `14M downloads / week`— according to GitHub, Requests is currently [depended upon](https://github.com/psf/requests/network/dependents?package_id=UGFja2FnZS01NzA4OTExNg%3D%3D) by `500,000+` repositories. You may certainly put your trust in this code.

[![Downloads](https://pepy.tech/badge/requests/month)](https://pepy.tech/project/requests/month)
[![Supported Versions](https://img.shields.io/pypi/pyversions/requests.svg)](https://pypi.org/project/requests)
[![Contributors](https://img.shields.io/github/contributors/psf/requests.svg)](https://github.com/psf/requests/graphs/contributors)

<p>&nbsp;</p>
<p align="center"><a href="https://pepy.tech/project/requests" rel="nofollow"><img src="https://camo.githubusercontent.com/e1dedc9f5ce5cd6b6c699f33d2e812daadcf3645/68747470733a2f2f706570792e746563682f62616467652f7265717565737473" alt="Downloads" data-canonical-src="https://pepy.tech/badge/requests" style="max-width:100%;"></a>
<a href="https://pypi.org/project/requests/" rel="nofollow"><img src="https://camo.githubusercontent.com/6d78aeec0a9a1cfe147ad064bfb99069e298e29b/68747470733a2f2f696d672e736869656c64732e696f2f707970692f707976657273696f6e732f72657175657374732e737667" alt="image" data-canonical-src="https://img.shields.io/pypi/pyversions/requests.svg" style="max-width:100%;"></a>
<a href="https://github.com/psf/requests/graphs/contributors"><img src="https://camo.githubusercontent.com/a70ea15870b38bba9203b969f6a6b7e7845fbb8a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f7073662f72657175657374732e737667" alt="image" data-canonical-src="https://img.shields.io/github/contributors/psf/requests.svg" style="max-width:100%;"></a></p>
## Installing Requests and Supported Versions

<p>&nbsp;</p>

<h2 align="center">Supported Features & Best–Practices</h2>

Requests is ready for the demands of building robust and reliable HTTP–speak applications, for the needs of today.

<pre class="test">
+ International Domains and URLs + Keep-Alive & Connection Pooling
+ Sessions with Cookie Persistence + Browser-style SSL Verification
+ Basic & Digest Authentication + Familiar `dict`–like Cookies
+ Automatic Decompression of Content + Automatic Content Decoding
+ Automatic Connection Pooling + Unicode Response Bodies<super>*</super>
+ Multi-part File Uploads + SOCKS Proxy Support
+ Connection Timeouts + Streaming Downloads
+ Automatic honoring of `.netrc` + Chunked HTTP Requests

&, of course, rock–solid stability!
</pre>
</div>

<p align="center">
✨ 🍰 ✨&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</p>

<p>&nbsp;</p>

Requests Module Installation
----------------------------

The recommended way to install the `requests` module is to simply use [`pipenv`](https://pipenv.kennethreitz.org) (or `pip`, of
course):
Requests is available on PyPI:

```console
$ pipenv install requests
Adding requests to Pipfile's [packages]…
âś” Installation Succeeded
…
$ python -m pip install requests
```

Requests officially supports Python 2.7 & 3.5+.

-------------------------------------

## P.S. — Documentation is available at [`requests.readthedocs.io`](https://requests.readthedocs.io/en/latest/).

<p align="center">
<a href="https://requests.readthedocs.io/"><img src="https://raw.githubusercontent.com/psf/requests/master/ext/ss.png" align="center" /></a>
</p>

## Supported Features & Best–Practices

------------------
Requests is ready for the demands of building robust and reliable HTTP–speaking applications, for the needs of today.

- Keep-Alive & Connection Pooling
- International Domains and URLs
- Sessions with Cookie Persistence
- Browser-style TLS/SSL Verification
- Basic & Digest Authentication
- Familiar `dict`–like Cookies
- Automatic Content Decompression and Decoding
- Multi-part File Uploads
- SOCKS Proxy Support
- Connection Timeouts
- Streaming Downloads
- Automatic honoring of `.netrc`
- Chunked HTTP Requests

<p>&nbsp;</p>
## API Reference and User Guide available on [Read the Docs](https://requests.readthedocs.io)

<p align="center">
<a href="https://kennethreitz.org/"><img src="https://raw.githubusercontent.com/psf/requests/master/ext/kr.png" align="center" /></a>
</p>
[![Read the Docs](https://raw.githubusercontent.com/psf/requests/master/ext/ss.png)](https://requests.readthedocs.io)

<p>&nbsp;</p>
---

<p align="center">
<a href="https://www.python.org/psf/"><img src="https://raw.githubusercontent.com/psf/requests/master/ext/psf.png" align="center" /></a>
</p>
[![Kenneth Reitz](https://raw.githubusercontent.com/psf/requests/master/ext/kr.png)](https://kennethreitz.org) [![Python Software Foundation](https://raw.githubusercontent.com/psf/requests/master/ext/psf.png)](https://www.python.org/psf)

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
@@ -23,38 +23,8 @@
/* Have code blocks escape the document right-margin. */
div.highlight pre {margin-right: -30px;}
}

</style>


<!-- Analytics tracking for Kenneth. -->
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', '56ca7a57c88d9011080024dd');
t.setAttribute('data-track-path', 'https://track.gaug.es/track.gif');
t.src = 'https://d36ee2fcip1434.cloudfront.net/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
</script>


<!-- There are no more hacks. -->
<!-- இڿڰۣ-ڰۣ— -->
<!-- Love, Kenneth Reitz -->

<script src="{{ pathto('_static/', 1) }}/konami.js"></script>
<script>
var easter_egg = new Konami('http://fortunes.herokuapp.com/random/raw');
</script>

<!-- That was not a hack. That was art. -->

<!-- Native CPC by BuySellAds -->

<script type="text/javascript" src="//m.servedby-buysellads.com/monetization.js"></script>
@@ -1,9 +1,3 @@
<p class="logo">
<a href="{{ pathto(master_doc) }}">
<img class="logo" src="{{ pathto('_static/requests-sidebar.jpg', 1) }}" title="https://kennethreitz.org/tattoos" />
</a>
</p>

<p>
<iframe src="https://ghbtns.com/github-btn.html?user=psf&repo=requests&type=watch&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
@@ -42,23 +36,23 @@
src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=CKYI5K3E&placement=pythonrequestsorg"
id="_carbonads_js"></script>

<h3>Stay Informed</h3>
<p>Receive updates on new releases and upcoming projects.</p>

<p><iframe src="https://ghbtns.com/github-btn.html?user=kennethreitz&type=follow&count=false" allowtransparency="true"
frameborder="0" scrolling="0" width="200" height="20"></iframe></p>

<h3>Useful Links</h3>
<ul>
<li><a href="https://requests.readthedocs.io/en/latest/community/recommended/">Recommended Packages and Extensions</a>
</li>
<li><a href="https://requests.readthedocs.io/en/latest/user/quickstart/">Quickstart</a></li>
<li><a href="https://requests.readthedocs.io/en/latest/user/advanced/">Advanced Usage</a></li>
<li><a href="https://requests.readthedocs.io/en/latest/api/">API Reference</a></li>
<li><a href="https://requests.readthedocs.io/en/latest/community/updates/#release-history">Release History</a></li>
<li><a href="https://requests.readthedocs.io/en/latest/dev/contributing/">Contributors Guide</a></li>

<p></p>

<li><a href="https://requests.readthedocs.io/en/latest/community/recommended/">Recommended Packages and Extensions</a></li>

<p></p>

<li><a href="https://github.com/psf/requests">Requests @ GitHub</a></li>
<li><a href="https://pypi.org/project/requests/">Requests @ PyPI</a></li>
<li><a href="https://github.com/psf/requests/issues">Issue Tracker</a></li>
<li><a href="https://requests.readthedocs.io/en/latest/community/updates/#software-updates">Release History</a></li>
</ul>


@@ -1,8 +1,3 @@
<p class="logo">
<a href="{{ pathto(master_doc) }}">
<img class="logo" src="{{ pathto('_static/requests-sidebar.jpg', 1) }}" title="https://kennethreitz.org/tattoos" />
</a>
</p>
<p>
<iframe src="https://ghbtns.com/github-btn.html?user=psf&repo=requests&type=watch&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
@@ -37,19 +32,30 @@
development release.
</p>

<p<p>Sponsored by <strong><a href="https://www.govcert.lu">CERT Gouvernemental - GOVCERT.LU</a></strong>.</p>

<h3>Stay Informed</h3>
<p>Receive updates on new releases and upcoming projects.</p>

<p><a href="https://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>

<hr />
<p>Sponsored by <strong><a href="https://www.govcert.lu">CERT Gouvernemental - GOVCERT.LU</a></strong>.</p>

<script async type="text/javascript"
src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=pythonrequestsorg"
id="_carbonads_js"></script>

<h3>Useful Links</h3>
<ul>
<li><a href="https://requests.readthedocs.io/en/latest/user/quickstart/">Quickstart</a></li>
<li><a href="https://requests.readthedocs.io/en/latest/user/advanced/">Advanced Usage</a></li>
<li><a href="https://requests.readthedocs.io/en/latest/api/">API Reference</a></li>
<li><a href="https://requests.readthedocs.io/en/latest/community/updates/#release-history">Release History</a></li>
<li><a href="https://requests.readthedocs.io/en/latest/dev/contributing/">Contributors Guide</a></li>

<p></p>

<li><a href="https://requests.readthedocs.io/en/latest/community/recommended/">Recommended Packages and Extensions</a></li>

<p></p>

<li><a href="https://github.com/psf/requests">Requests @ GitHub</a></li>
<li><a href="https://pypi.org/project/requests/">Requests @ PyPI</a></li>
<li><a href="https://github.com/psf/requests/issues">Issue Tracker</a></li>
</ul>

<h3>Translations</h3>

@@ -3,8 +3,6 @@
Frequently Asked Questions
==========================

.. image:: https://farm5.staticflickr.com/4290/35294660055_42c02b2316_k_d.jpg

This part of the documentation answers common questions about Requests.

Encoded Data?
@@ -66,7 +64,8 @@ and intend to maintain Python 2.7 support within Requests until `pip
stops supporting Python 2.7 (there's no estimated date on that yet)
<https://pip.pypa.io/en/latest/development/release-process/#python-2-support>`_.

That said, it is *highly* recommended users migrate to Python 3.5+ since Python 2.7 will no longer be receiving bug fixes or security updates after January 1, 2020.
That said, it is *highly* recommended users migrate to Python 3.6+ since Python
2.7 is no longer receiving bug fixes or security updates as of January 1, 2020.

What are "hostname doesn't match" errors?
-----------------------------------------
@@ -1,8 +1,6 @@
Integrations
============

.. image:: https://farm5.staticflickr.com/4239/34450900674_15863ddea0_k_d.jpg

Python for iOS
--------------

@@ -3,8 +3,6 @@
Recommended Packages and Extensions
===================================

.. image:: https://farm5.staticflickr.com/4218/35224319272_cfc0e621fb_k_d.jpg

Requests has a great variety of powerful and useful third-party extensions.
This page provides an overview of some of the best of them.

@@ -1,8 +1,6 @@
Release Process and Rules
=========================

.. image:: https://farm5.staticflickr.com/4215/34450901614_b74ae720db_k_d.jpg

.. versionadded:: v2.6.2

Starting with the version to be released after ``v2.6.2``, the following rules
@@ -3,26 +3,16 @@
Support
=======

.. image:: https://farm5.staticflickr.com/4198/34080352913_5c13ffb336_k_d.jpg

If you have questions or issues about Requests, there are several options:

Stack Overflow
-------------
--------------

If your question does not contain sensitive (possibly proprietary)
information or can be properly anonymized, please ask a question on
`Stack Overflow <https://stackoverflow.com/questions/tagged/python-requests>`_
and use the tag ``python-requests``.

Send a Tweet
------------

If your question is less than 280 characters, feel free to send a tweet to
`@kennethreitz <https://twitter.com/kennethreitz>`_,
`@sigmavirus24 <https://twitter.com/sigmavirus24>`_,
`@lukasaoz <https://twitter.com/lukasaoz>`_, or
`@nateprewitt <https://twitter.com/nateprewitt>`_.

File an Issue
-------------
@@ -32,23 +22,10 @@ for a new feature,
`file an issue on GitHub <https://github.com/psf/requests/issues>`_.


E-mail
------

I'm more than happy to answer any personal or in-depth questions about
Requests. Feel free to email
`requests@kennethreitz.com <mailto:requests@kennethreitz.com>`_.


IRC
---

The official Freenode channel for Requests is
`#python-requests <irc://irc.freenode.net/python-requests>`_

The core developers of requests are on IRC throughout the day.
You can find them in ``#python-requests`` as:
Send a Tweet
------------

- kennethreitz
- lukasa
- sigmavirus24
If your question is less than 280 characters, feel free to send a tweet to
`@nateprewitt <https://twitter.com/nateprewitt>`_,
`@sethmlarson <https://twitter.com/sethmlarson>`_, or
`@sigmavirus24 <https://twitter.com/sigmavirus24>`_.
@@ -4,8 +4,6 @@
Community Updates
=================

.. image:: https://farm5.staticflickr.com/4244/34080354873_516c283ad0_k_d.jpg

If you'd like to stay up to date on the community and development of Requests,
there are several options:

@@ -16,16 +14,5 @@ GitHub
The best way to track the development of Requests is through
`the GitHub repo <https://github.com/psf/requests>`_.

Twitter
-------

The author, Kenneth Reitz, often tweets about new features and releases of Requests.

Follow `@kennethreitz <https://twitter.com/kennethreitz>`_ for updates.



Release and Version History
===========================

.. include:: ../../HISTORY.md
@@ -1,8 +1,6 @@
Vulnerability Disclosure
========================

.. image:: https://farm5.staticflickr.com/4211/34709353644_b041e9e1c2_k_d.jpg

If you think you have found a potential security vulnerability in requests,
please email `Nate <mailto:nate.prewitt@gmail.com>`_ and `Seth <mailto:@sethmichaellarson@gmail.com>`_ directly. **Do not file a public issue.**

@@ -58,7 +58,7 @@

# General information about the project.
project = u"Requests"
copyright = u'MMXVIX. A <a href="http://kennethreitz.com/pages/open-projects.html">Kenneth Reitz</a> Project'
copyright = u'MMXVIX. A <a href="https://kenreitz.org/projects">Kenneth Reitz</a> Project'
author = u"Kenneth Reitz"

# The version info for the project you're documenting, acts as replacement for
@@ -1,6 +1,4 @@
Authors
=======

.. image:: https://static1.squarespace.com/static/533ad9bde4b098d084a846b1/t/534f6e1ce4b09b70f38ee6c1/1432265542589/DSCF3147.jpg?format=2500w

.. include:: ../../AUTHORS.rst
@@ -3,8 +3,6 @@
Contributor's Guide
===================

.. image:: https://farm5.staticflickr.com/4237/35550408335_7671fde302_k_d.jpg

If you're reading this, you're probably interested in contributing to Requests.
Thank you very much! Open source projects live-and-die based on the support
they receive from others, and the fact that you're even considering
@@ -13,23 +11,17 @@ contributing to the Requests project is *very* generous of you.
This document lays out guidelines and advice for contributing to this project.
If you're thinking of contributing, please start by reading this document and
getting a feel for how contributing to this project works. If you have any
questions, feel free to reach out to either `Ian Cordasco`_, `Cory Benfield`_,
or `Nate Prewitt`_, the primary maintainers.
questions, feel free to reach out to either `Nate Prewitt`_, `Ian Cordasco`_,
or `Seth Michael Larson`_, the primary maintainers.

.. _Ian Cordasco: http://www.coglib.com/~icordasc/
.. _Cory Benfield: https://lukasa.co.uk/about
.. _Nate Prewitt: https://www.nateprewitt.com/

If you have non-technical feedback, philosophical ponderings, crazy ideas, or
other general thoughts about Requests or its position within the Python
ecosystem, the BDFL, `Kenneth Reitz`_, would love to hear from you.
.. _Seth Michael Larson: https://sethmlarson.dev/

The guide is split into sections based on the type of contribution you're
thinking of making, with a section that covers general guidelines for all
contributors.

.. _Kenneth Reitz: mailto:me@kennethreitz.org

Be Cordial
----------

This file was deleted.

This file was deleted.

@@ -45,7 +45,7 @@ See `similar code, sans Requests <https://gist.github.com/973705>`_.
**Requests** allows you to send HTTP/1.1 requests extremely easily.
There's no need to manually add query strings to your
URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling
are 100% automatic, thanks to `urllib3 <https://github.com/shazow/urllib3>`_.
are 100% automatic, thanks to `urllib3 <https://github.com/urllib3/urllib3>`_.

Beloved Features
----------------
@@ -68,7 +68,7 @@ Requests is ready for today's web.
- Chunked Requests
- ``.netrc`` Support

Requests officially supports Python 2.7 & 3.4–3.7, and runs great on PyPy.
Requests officially supports Python 2.7 & 3.5+, and runs great on PyPy.


The User Guide
@@ -81,7 +81,6 @@ instructions for getting the most out of Requests.
.. toctree::
:maxdepth: 2

user/intro
user/install
user/quickstart
user/advanced
@@ -97,15 +96,18 @@ Requests ecosystem and community.
.. toctree::
:maxdepth: 2

community/sponsors
community/recommended
community/faq
community/out-there
community/support
community/vulnerabilities
community/updates
community/release-process

.. toctree::
:maxdepth: 1

community/updates

The API Documentation / Guide
-----------------------------

@@ -128,8 +130,6 @@ you.
:maxdepth: 3

dev/contributing
dev/philosophy
dev/todo
dev/authors

There are no more guides. You are now guideless.
@@ -3,8 +3,6 @@
Advanced Usage
==============

.. image:: https://farm5.staticflickr.com/4263/35163665790_d182d84f5e_k_d.jpg

This document covers some of Requests more advanced features.

.. _session-objects:
@@ -238,12 +236,19 @@ or persistent::
the c_rehash utility supplied with OpenSSL.

This list of trusted CAs can also be specified through the ``REQUESTS_CA_BUNDLE`` environment variable.
If ``REQUESTS_CA_BUNDLE`` is not set, ``CURL_CA_BUNDLE`` will be used as fallback.

Requests can also ignore verifying the SSL certificate if you set ``verify`` to False::

>>> requests.get('https://kennethreitz.org', verify=False)
<Response [200]>

Note that when ``verify`` is set to ``False``, requests will accept any TLS
certificate presented by the server, and will ignore hostname mismatches
and/or expired certificates, which will make your application vulnerable to
man-in-the-middle (MitM) attacks. Setting verify to ``False`` may be useful
during local development or testing.

By default, ``verify`` is set to True. Option ``verify`` only applies to host certs.

Client Side Certificates
@@ -482,7 +487,7 @@ they are added.
Custom Authentication
---------------------

Requests allows you to use specify your own authentication mechanism.
Requests allows you to specify your own authentication mechanism.

Any callable which is passed as the ``auth`` argument to a request method will
have the opportunity to modify the request before it is dispatched.
@@ -584,10 +589,26 @@ If you need to use a proxy, you can configure individual requests with the

requests.get('http://example.org', proxies=proxies)

You can also configure proxies by setting the environment variables
``HTTP_PROXY`` and ``HTTPS_PROXY``.
Alternatively you can configure it once for an entire
:class:`Session <requests.Session>`::

::
import requests

proxies = {
'http': 'http://10.10.1.10:3128',
'https': 'http://10.10.1.10:1080',
}
session = request.Session()
session.proxies.update(proxies)

session.get('http://example.org')

When the proxies configuration is not overridden in python as shown above,
by default Requests relies on the proxy configuration defined by standard
environment variables ``http_proxy``, ``https_proxy``, ``no_proxy`` and
``curl_ca_bundle``. Uppercase variants of these variables are also supported.
You can therefore set them to configure Requests (only set the ones relevant
to your needs)::

$ export HTTP_PROXY="http://10.10.1.10:3128"
$ export HTTPS_PROXY="http://10.10.1.10:1080"
@@ -596,9 +617,17 @@ You can also configure proxies by setting the environment variables
>>> import requests
>>> requests.get('http://example.org')

To use HTTP Basic Auth with your proxy, use the `http://user:password@host/` syntax::
To use HTTP Basic Auth with your proxy, use the `http://user:password@host/`
syntax in any of the above configuration entries::

proxies = {'http': 'http://user:pass@10.10.1.10:3128/'}
$ export HTTPS_PROXY="http://user:pass@10.10.1.10:1080"

$ python
>>> proxies = {'http': 'http://user:pass@10.10.1.10:3128/'}

.. warning:: Storing sensitive username and password information in an
environment variable or a version-controled file is a security risk and is
highly discouraged.

To give a proxy for a specific scheme and host, use the
`scheme://hostname` form for the key. This will match for
@@ -610,6 +639,23 @@ any request to the given scheme and exact hostname.

Note that proxy URLs must include the scheme.

Finally, note that using a proxy for https connections typically requires your
local machine to trust the proxy's root certificate. By default the list of
certificates trusted by Requests can be found with::

from requests.utils import DEFAULT_CA_BUNDLE_PATH
print(DEFAULT_CA_BUNDLE_PATH)

You override this default certificate bundle by setting the standard
``curl_ca_bundle`` environment variable to another file path::

$ export curl_ca_bundle="/usr/local/myproxy_info/cacert.pem"
$ export https_proxy="http://10.10.1.10:1080"

$ python
>>> import requests
>>> requests.get('https://example.org')

SOCKS
^^^^^

@@ -623,7 +669,7 @@ You can get the dependencies for this feature from ``pip``:

.. code-block:: bash
$ pip install requests[socks]
$ python -m pip install requests[socks]
Once you've installed those dependencies, using a SOCKS proxy is just as easy
as using a HTTP one::
@@ -976,12 +1022,12 @@ response at a time. However, these calls will still block.

If you are concerned about the use of blocking IO, there are lots of projects
out there that combine Requests with one of Python's asynchronicity frameworks.
Some excellent examples are `requests-threads`_, `grequests`_, `requests-futures`_, and `requests-async`_.
Some excellent examples are `requests-threads`_, `grequests`_, `requests-futures`_, and `httpx`_.

.. _`requests-threads`: https://github.com/requests/requests-threads
.. _`grequests`: https://github.com/kennethreitz/grequests
.. _`requests-futures`: https://github.com/ross/requests-futures
.. _`requests-async`: https://github.com/encode/requests-async
.. _`httpx`: https://github.com/encode/httpx

Header Ordering
---------------
@@ -3,8 +3,6 @@
Authentication
==============

.. image:: https://farm5.staticflickr.com/4258/35550409215_3b08d49d22_k_d.jpg

This document discusses using various kinds of authentication with Requests.

Many web services require authentication, and there are many different types.
@@ -3,23 +3,16 @@
Installation of Requests
========================

.. image:: https://farm5.staticflickr.com/4230/35550376215_da1bf77a8c_k_d.jpg


This part of the documentation covers the installation of Requests.
The first step to using any software package is getting it properly installed.


$ pipenv install requests
-------------------------
$ python -m pip install requests
--------------------------------

To install Requests, simply run this simple command in your terminal of choice::

$ pipenv install requests

If you don't have `pipenv <https://pipenv.kennethreitz.org>`_ installed (tisk tisk!), head over to the Pipenv website for installation instructions. Or, if you prefer to just use pip and don't have it installed,
`this Python installation guide <https://docs.python-guide.org/starting/installation/>`_
can guide you through the process.
$ python -m pip install requests

Get the Source Code
-------------------
@@ -40,4 +33,4 @@ Once you have a copy of the source, you can embed it in your own Python
package, or install it into your site-packages easily::

$ cd requests
$ pip install .
$ python -m pip install .

This file was deleted.

@@ -3,8 +3,6 @@
Quickstart
==========

.. image:: https://farm5.staticflickr.com/4259/35163667010_8bfcaef274_k_d.jpg

.. module:: requests.models

Eager to get started? This page gives a good introduction in how to get started
@@ -215,7 +213,8 @@ Note: Custom headers are given less precedence than more specific sources of inf

* Authorization headers set with `headers=` will be overridden if credentials
are specified in ``.netrc``, which in turn will be overridden by the ``auth=``
parameter.
parameter. Requests will search for the netrc file at `~/.netrc`, `~/_netrc`,
or at the path specified by the `NETRC` environment variable.
* Authorization headers will be removed if you get redirected off-host.
* Proxy-Authorization headers will be overridden by proxy credentials provided in the URL.
* Content-Length headers will be overridden when we can determine the length of the content.
@@ -57,18 +57,16 @@ def check_compatibility(urllib3_version, chardet_version):
# Check urllib3 for compatibility.
major, minor, patch = urllib3_version # noqa: F811
major, minor, patch = int(major), int(minor), int(patch)
# urllib3 >= 1.21.1, <= 1.25
# urllib3 >= 1.21.1, <= 1.26
assert major == 1
assert minor >= 21
assert minor <= 25
assert minor <= 26

# Check chardet for compatibility.
major, minor, patch = chardet_version.split('.')[:3]
major, minor, patch = int(major), int(minor), int(patch)
# chardet >= 3.0.2, < 3.1.0
assert major == 3
assert minor < 1
assert patch >= 2
# chardet >= 3.0.2, < 5.0.0
assert (3, 0, 2) <= (major, minor, patch) < (5, 0, 0)


def _check_cryptography(cryptography_version):
@@ -5,8 +5,8 @@
__title__ = 'requests'
__description__ = 'Python HTTP for Humans.'
__url__ = 'https://requests.readthedocs.io'
__version__ = '2.24.0'
__build__ = 0x022400
__version__ = '2.25.1'
__build__ = 0x022501
__author__ = 'Kenneth Reitz'
__author_email__ = 'me@kennethreitz.org'
__license__ = 'Apache 2.0'
@@ -273,7 +273,9 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
"""The fully mutable :class:`PreparedRequest <PreparedRequest>` object,
containing the exact bytes that will be sent to the server.
Generated from either a :class:`Request <Request>` object or manually.
Instances are generated from a :class:`Request <Request>` object, and
should not be instantiated manually; doing so may produce undesirable
effects.
Usage::
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-

"""
requests.session
~~~~~~~~~~~~~~~~
requests.sessions
~~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
@@ -387,6 +387,13 @@ def __init__(self):
self.stream = False

#: SSL Verification default.
#: Defaults to `True`, requiring requests to verify the TLS certificate at the
#: remote end.
#: If verify is set to `False`, requests will accept any TLS certificate
#: presented by the server, and will ignore hostname mismatches and/or
#: expired certificates, which will make your application vulnerable to
#: man-in-the-middle (MitM) attacks.
#: Only set this to `False` for testing.
self.verify = True

#: SSL client certificate default, if String, path to ssl client
@@ -495,7 +502,12 @@ def request(self, method, url,
content. Defaults to ``False``.
:param verify: (optional) Either a boolean, in which case it controls whether we verify
the server's TLS certificate, or a string, in which case it must be a path
to a CA bundle to use. Defaults to ``True``.
to a CA bundle to use. Defaults to ``True``. When set to
``False``, requests will accept any TLS certificate presented by
the server, and will ignore hostname mismatches and/or expired
certificates, which will make your application vulnerable to
man-in-the-middle (MitM) attacks. Setting verify to ``False``
may be useful during local development or testing.
:param cert: (optional) if String, path to ssl client cert file (.pem).
If Tuple, ('cert', 'key') pair.
:rtype: requests.Response
@@ -169,14 +169,20 @@ def super_len(o):
def get_netrc_auth(url, raise_errors=False):
"""Returns the Requests tuple auth for a given url from netrc."""

netrc_file = os.environ.get('NETRC')
if netrc_file is not None:
netrc_locations = (netrc_file,)
else:
netrc_locations = ('~/{}'.format(f) for f in NETRC_FILES)

try:
from netrc import netrc, NetrcParseError

netrc_path = None

for f in NETRC_FILES:
for f in netrc_locations:
try:
loc = os.path.expanduser('~/{}'.format(f))
loc = os.path.expanduser(f)
except KeyError:
# os.path.expanduser can fail when $HOME is undefined and
# getpwuid fails. See https://bugs.python.org/issue20164 &
@@ -212,7 +218,7 @@ def get_netrc_auth(url, raise_errors=False):
if raise_errors:
raise

# AppEngine hackiness.
# App Engine hackiness.
except (ImportError, AttributeError):
pass

@@ -497,6 +503,10 @@ def get_encoding_from_headers(headers):
if 'text' in content_type:
return 'ISO-8859-1'

if 'application/json' in content_type:
# Assume UTF-8 based on RFC 4627: https://www.ietf.org/rfc/rfc4627.txt since the charset was unset
return 'utf-8'


def stream_decode_response_unicode(iterator, r):
"""Stream decodes a iterator."""
@@ -0,0 +1,6 @@
pytest>=2.8.0,<=3.10.1
pytest-cov
pytest-httpbin<1.0
pytest-mock==2.0.0
httpbin==0.7.0
wheel
@@ -42,9 +42,9 @@ def run_tests(self):
packages = ['requests']

requires = [
'chardet>=3.0.2,<4',
'chardet>=3.0.2,<5',
'idna>=2.5,<3',
'urllib3>=1.21.1,<1.26,!=1.25.0,!=1.25.1',
'urllib3>=1.21.1,<1.27',
'certifi>=2017.4.17'

]
@@ -63,8 +63,6 @@ def run_tests(self):

with open('README.md', 'r', 'utf-8') as f:
readme = f.read()
with open('HISTORY.md', 'r', 'utf-8') as f:
history = f.read()

setup(
name=about['__title__'],
@@ -76,7 +74,7 @@ def run_tests(self):
author_email=about['__author_email__'],
url=about['__url__'],
packages=packages,
package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},
package_data={'': ['LICENSE', 'NOTICE']},
package_dir={'requests': 'requests'},
include_package_data=True,
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
@@ -96,6 +94,7 @@ def run_tests(self):
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy'
],
@@ -668,7 +668,7 @@ def test_POSTBIN_GET_POST_FILES(self, httpbin):
post1 = requests.post(url, data={'some': 'data'})
assert post1.status_code == 200

with open('Pipfile') as f:
with open('requirements-dev.txt') as f:
post2 = requests.post(url, files={'some': f})
assert post2.status_code == 200

@@ -736,7 +736,7 @@ def test_POSTBIN_GET_POST_FILES_WITH_DATA(self, httpbin):
post1 = requests.post(url, data={'some': 'data'})
assert post1.status_code == 200

with open('Pipfile') as f:
with open('requirements-dev.txt') as f:
post2 = requests.post(url, data={'some': 'data'}, files={'some': f})
assert post2.status_code == 200

@@ -773,7 +773,7 @@ def __len__(self):

def test_conflicting_post_params(self, httpbin):
url = httpbin('post')
with open('Pipfile') as f:
with open('requirements-dev.txt') as f:
with pytest.raises(ValueError):
requests.post(url, data='[{"some": "data"}]', files={'some': f})
with pytest.raises(ValueError):