Merge pull request #1 from requests/master
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Syncing fork to the original repository
authored by Maina Nick · committed by GitHub · parents f78a579, 7c812e9 · Browse files · 66 files·+4000 added−2163 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
66 files+4000 added−2163 removed
- tests:+382 added−96 removed
- other:+3618 added−2067 removed
Provenance
- Commit
3a831be- Tree
01ddf48- Author
Maina Nick <nick.maina1@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
f78a579- Parent 2
7c812e9
66 files changed+4000 added−2163 removed
modified:_appveyor/install.ps1+1 added-1 removed
224 unmodified lines225 InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON226 InstallPip $env:PYTHON227 }228 229-main229+mainadded:.github/ISSUE_TEMPLATE/Bug_report.md+34 added
12345678910111213141516171819202122232425262728293031323334---name: Bug reportabout: Create a report to help us improve
---
Summary.
## Expected Result
What you expected.
## Actual Result
What happened instead.
## Reproduction Steps
```pythonimport requests
```
## System Information
$ python -m requests.help
```<paste here>```
This command is only available on Requests v2.16.4 and greater. Otherwise,please provide some basic information about your system (Python version,operating system, &c).added:.github/ISSUE_TEMPLATE/Custom.md+7 added
1234567---name: Request for Helpabout: Guidance on using Requests.
---
Please refer to our [Stack Overflow tag](https://stackoverflow.com/questions/tagged/python-requests) for guidance.added:.github/ISSUE_TEMPLATE/Feature_request.md+7 added
1234567---name: Feature requestabout: Suggest an idea for this project
---
Requests is not accepting feature requests at this time.modified:docs/_static/custom.css+146 added-3 removed
1234567891011121314561581617181920212219 unmodified lines42434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182body > div.document > div.sphinxsidebar > div > form > table > tbody > tr:nth-child(2) > td > select { width: 100%!important;}
#python27 > a { color: white;}
/* Carbon by BuySellAds */#carbonads { display: block; overflow: hidden; margin: 1.5em 0 2em; padding: 1em; background-color: #eeeeee; text-align: center; border: solid 1px #cccccc; margin: 1.5em 0 2em; border-radius: 2px; background-color: #eeeeee; text-align: center; line-height: 1.5;}
#carbonads a {19 unmodified lines.carbon-poweredby { display: block; text-transform: uppercase; letter-spacing: 1px; font-size: 10px; line-height: 1;}
/* Native CPC by BuySellAds */
.native-js { visibility: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif; opacity: 0; transition: all .25s ease-in-out; transform: translateY(calc(100% - 35px));
flex-flow: column nowrap;}
.native-js[data-state=visible] { position: fixed; bottom: 0; left: 0; right: 0; visibility: visible; box-shadow: 0 -1px 4px 1px hsla(0, 0%, 0%, .15); opacity: 1;}
.native-js[data-state=visible]:hover { transform: translateY(0);}
.native-img { margin-right: 20px; max-height: 50px; border-radius: 3px;}
.native-sponsor { margin: 10px 20px; text-align: center; text-transform: uppercase; letter-spacing: .5px; font-size: 12px; transition: all .3s ease-in-out; transform-origin: left;}
.native-js[data-state=visible]:hover .native-sponsor { margin: 0 20px; opacity: 0; transform: scaleY(0);}
.native-flex { display: flex; padding: 0 20px 30px; text-decoration: none;
flex-flow: row nowrap; align-items: center;}
.native-flex:hover { text-decoration: none;}
.native-main { display: flex;
flex-flow: row nowrap; align-items: center;}
.native-details { display: flex; margin-right: 30px;
flex-flow: column nowrap;}
.native-company { margin-bottom: 4px; text-transform: uppercase; letter-spacing: 2px; font-size: 10px;}
.native-desc { letter-spacing: 1px; font-weight: 300; line-height: 1.4;}
.native-cta { padding: 10px 14px; border-radius: 3px; box-shadow: 0 6px 13px 0 hsla(0, 0%, 0%, .15); text-transform: uppercase; white-space: nowrap; letter-spacing: 1px; font-weight: 400; font-size: 12px; transition: all .3s ease-in-out; transform: translateY(-1px);}
.native-cta:hover { box-shadow: none; transform: translateY(1px);}
@media only screen and (min-width: 320px) and (max-width: 759px) { .native-flex { flex-direction: column;
flex-wrap: wrap; }
.native-img { margin: 0; }
.native-details { margin: 0; }
.native-main { flex-direction: column; margin-bottom: 20px; text-align: center;
flex-wrap: wrap; align-content: center; }}added:docs/_static/native.js+131 added
1+var _native = (function () {2+ var _options = {}3+ var _construct = function (e) {4+ var defaultOptions = {5+ carbonZoneKey: '',6+ fallback: '',7+ ignore: 'false',8+ placement: '',9+ prefix: 'native',10+ targetClass: 'native-ad'11+ }12+13+ if (typeof e === 'undefined') return defaultOptions14+ Object.keys(defaultOptions).forEach((key, index) => {15+ if (typeof e[key] === 'undefined') {16+ e[key] = defaultOptions[key]17+ }18+ })19+ return e20+ }21+22+ var init = function (zone, options) {23+ _options = _construct(options)24+25+ let jsonUrl = `https://srv.buysellads.com/ads/${zone}.json?callback=_native_go`26+ if (_options['placement'] !== '') {27+ jsonUrl += '&segment=placement:' + _options['placement']28+ }29+ if (_options['ignore'] === 'true') {30+ jsonUrl += '&ignore=yes'31+ }32+33+ let srv = document.createElement('script')34+ srv.src = jsonUrl35+ document.getElementsByTagName('head')[0].appendChild(srv)36+ }37+38+ var carbon = function (e) {39+ let srv = document.createElement('script')40+ srv.src = '//cdn.carbonads.com/carbon.js?serve=' + e['carbonZoneKey'] + '&placement=' + e['placement']41+ srv.id = '_carbonads_js'42+43+ return srv44+ }45+46+ var sanitize = function (ads) {47+ return ads48+ .filter(ad => {49+ return Object.keys(ad).length > 050+ })51+ .filter(ad => {52+ return ad.hasOwnProperty('statlink')53+ })54+ }55+56+ var pixel = function (p, timestamp) {57+ let c = ''58+ if (p) {59+ p.split('||').forEach((pixel, index) => {60+ c += `<img src="${pixel.replace('[timestamp]', timestamp)}" style="display:none;" height="0" width="0" />`61+ })62+ }63+ return c64+ }65+66+ var options = function () {67+ return _options68+ }69+70+ return {71+ carbon: carbon,72+ init: init,73+ options: options,74+ pixel: pixel,75+ sanitize: sanitize76+ }77+})({})78+79+var _native_go = function (json) {80+ let options = _native.options()81+ let ads = _native.sanitize(json['ads'])82+ let selectedClass = document.querySelectorAll('.' + options['targetClass'])83+84+ if (ads.length < 1) {85+ selectedClass.forEach((className, index) => {86+ let selectedTarget = document.getElementsByClassName(options['targetClass'])[index]87+88+ if (options['fallback'] !== '' || options['carbonZoneKey'] !== '') selectedTarget.setAttribute('data-state', 'visible')89+ selectedTarget.innerHTML = options['fallback']90+ if (options['carbonZoneKey'] !== '') selectedTarget.appendChild(_native.carbon(options))91+ })92+93+ // End at this line if no ads are found, avoiding unnecessary steps94+ return95+ }96+97+ selectedClass.forEach((className, index) => {98+ let selectedTarget = document.getElementsByClassName(options['targetClass'])[index]99+ let adElement = selectedTarget.innerHTML100+ let prefix = options['prefix']101+ let ad = ads[index]102+103+ if (ad && className) {104+ let adInnerHtml = adElement105+ .replace(new RegExp('#' + prefix + '_bg_color#', 'g'), ad['backgroundColor'])106+ .replace(new RegExp('#' + prefix + '_bg_color_hover#', 'g'), ad['backgroundHoverColor'])107+ .replace(new RegExp('#' + prefix + '_company#', 'g'), ad['company'])108+ .replace(new RegExp('#' + prefix + '_cta#', 'g'), ad['callToAction'])109+ .replace(new RegExp('#' + prefix + '_cta_bg_color#', 'g'), ad['ctaBackgroundColor'])110+ .replace(new RegExp('#' + prefix + '_cta_bg_color_hover#', 'g'), ad['ctaBackgroundHoverColor'])111+ .replace(new RegExp('#' + prefix + '_cta_color#', 'g'), ad['ctaTextColor'])112+ .replace(new RegExp('#' + prefix + '_cta_color_hover#', 'g'), ad['ctaTextColorHover'])113+ .replace(new RegExp('#' + prefix + '_desc#', 'g'), ad['description'])114+ .replace(new RegExp('#' + prefix + '_index#', 'g'), prefix + '-' + ad['i'])115+ .replace(new RegExp('#' + prefix + '_img#', 'g'), ad['image'])116+ .replace(new RegExp('#' + prefix + '_small_img#', 'g'), ad['smallImage'])117+ .replace(new RegExp('#' + prefix + '_link#', 'g'), ad['statlink'])118+ .replace(new RegExp('#' + prefix + '_logo#', 'g'), ad['logo'])119+ .replace(new RegExp('#' + prefix + '_color#', 'g'), ad['textColor'])120+ .replace(new RegExp('#' + prefix + '_color_hover#', 'g'), ad['textColorHover'])121+ .replace(new RegExp('#' + prefix + '_title#', 'g'), ad['title'])122+123+ selectedTarget.innerHTML = null124+ selectedTarget.innerHTML += adInnerHtml + _native.pixel(ad['pixel'], ad['timestamp'])125+ selectedTarget.setAttribute('data-state', 'visible')126+ } else {127+ selectedTarget.innerHTML = null128+ selectedTarget.style.display = 'none'129+ }130+ })131+}modified:docs/_templates/hacks.html+50 added-1 removed
24 unmodified lines25 }26 27 </style>28 29+30 <!-- Analytics tracking for Kenneth. -->31 <script type="text/javascript">32 var _gauges = _gauges || [];33 (function() {8 unmodified lines42 s.parentNode.insertBefore(t, s);43 })();44 </script>45 46+47 <!-- There are no more hacks. -->48 <!-- இڿڰۣ-ڰۣ— -->49 <!-- Love, Kenneth Reitz -->50 1 unmodified line52 <script>53 var easter_egg = new Konami('http://fortunes.herokuapp.com/random/raw');54 </script>55 54-<!-- That was not a hack. That was art. -->56+<!-- That was not a hack. That was art. -->57+58+<!-- Native CPC by BuySellAds -->59+60+<script src="{{ pathto('_static/', 1) }}/native.js"></script>61+<script>62+ _native.init("CK7D62JU", {63+ targetClass: 'native-js'64+ });65+</script>66+67+<div class="native-js">68+ <div class="native-sponsor">Sponsored Ad by #native_company# — Learn More</div>69+ <a href="#native_link#" class="native-flex">70+ <style>71+ .native-js {72+ background: linear-gradient(-30deg, #native_bg_color#E5, #native_bg_color#E5 45%, #native_bg_color# 45%) #fff;73+ }74+75+ .native-details,76+ .native-sponsor {77+ color: #native_color# !important;78+ }79+80+ .native-details:hover {81+ color: #native_color_hover# !important;82+ }83+84+ .native-cta {85+ color: #native_cta_color#;86+ background-color: #native_cta_bg_color#;87+ }88+89+ .native-cta:hover {90+ color: #native_cta_color_hover;91+ background-color: #native_cta_bg_color_hover#;92+ }93+ </style>94+ <div class="native-main">95+ <img class="native-img" src="#native_logo#">96+ <div class="native-details">97+ <span class="native-company">#native_title#</span>98+ <span class="native-desc">#native_desc#</span>99+ </div>100+ <span class="native-cta">#native_cta#</span>101+ </div>102+ </a>103+</div>modified:docs/_templates/sidebarintro.html+53 added-15 removed
3 unmodified lines4 </a>5 </p>6 7 <p>8- <iframe src="http://ghbtns.com/github-btn.html?user=requests&repo=requests&type=watch&count=true&size=large"8+ <iframe src="https://ghbtns.com/github-btn.html?user=requests&repo=requests&type=watch&count=true&size=large"9 allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>10 </p>11 12 <p>13 Requests is an elegant and simple HTTP library for Python, built for14 human beings.15 </p>16+<p>Sponsored by <strong><a href="https://linode.com/">Linode</a></strong> and <a href="http://docs.python-requests.org/en/master/community/sponsors/#patron-sponsors">other wonderful organizations</a>.</p>17 17-<script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=pythonrequestsorg" id="_carbonads_js"></script>18 19+<script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=CKYI5K3E&placement=pythonrequestsorg" id="_carbonads_js"></script>20+21 <h3>Stay Informed</h3>22 <p>Receive updates on new releases and upcoming projects.</p>23 22-<p><iframe src="http://ghbtns.com/github-btn.html?user=kennethreitz&type=follow&count=false"24+<p><iframe src="https://ghbtns.com/github-btn.html?user=kennethreitz&type=follow&count=false"25 allowtransparency="true" frameborder="0" scrolling="0" width="200" height="20"></iframe></p>26 27 <p><a href="https://twitter.com/kennethreitz" class="twitter-follow-button" data-show-count="false">Follow @kennethreitz</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></p>26-<p><a href="https://saythanks.io/to/kennethreitz">Say Thanks!</a></p>27-<p><a href="http://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>28+<p><a href="https://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>28-29-29 <h3>Other Projects</h3>30 32-<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p>31+<p>More <a href="https://www.kennethreitz.org/">Kenneth Reitz</a> projects:</p>32 <ul>34- <li><a href="http://edmsynths.com/">edmsynths.com</a></li>33+ <li><a href="https://html.python-requests.org/">Requests-HTML</a></li>34+ <li><a href="http://howtopython.org/">howtopython.org</a></li>35 <li><a href="http://pipenv.org/">pipenv</a></li>36- <li><a href="http://pep8.org/">pep8.org</a></li>37- <li><a href="http://httpbin.org/">httpbin.org</a></li>38- <li><a href="http://python-guide.org">The Python Guide</a></li>36+ <li><a href="https://pep8.org/">pep8.org</a></li>37+ <li><a href="https://httpbin.org/">httpbin.org</a></li>38+ <li><a href="https://docs.python-guide.org/">The Python Guide</a></li>39 <li><a href="https://github.com/kennethreitz/maya">Maya: Datetimes for Humans</a></li>40 <li><a href="https://github.com/kennethreitz/records">Records: SQL for Humans</a></li>41 <li><a href="http://www.git-legit.org">Legit: Git for Humans</a></li>42 <li><a href="http://docs.python-tablib.org/en/latest/">Tablib: Tabular Datasets</a></li>5 unmodified lines48 <li><a href="http://docs.python-requests.org/en/latest/community/recommended/">Recommended Packages and Extensions</a></li>49 50 <p></p>51 52- <li><a href="http://github.com/requests/requests">Requests @ GitHub</a></li>53- <li><a href="http://pypi.python.org/pypi/requests">Requests @ PyPI</a></li>54- <li><a href="http://github.com/requests/requests/issues">Issue Tracker</a></li>52+ <li><a href="https://github.com/requests/requests">Requests @ GitHub</a></li>53+ <li><a href="https://pypi.org/project/requests/">Requests @ PyPI</a></li>54+ <li><a href="https://github.com/requests/requests/issues">Issue Tracker</a></li>55 <li><a href="http://docs.python-requests.org/en/latest/community/updates/#software-updates">Release History</a></li>56 </ul>57 58 9 unmodified lines68 <li><a href="http://it.python-requests.org/">Italian</a></li>69 <li><a href="http://es.python-requests.org/">Spanish</a></li>70 </ul>71 72+<div class="native-js">73+ <div class="native-sponsor">Sponsored by #native_company# — Learn More</div>74+ <a href="#native_link#" class="native-flex">75+ <style>76+ .native-js {77+ background: linear-gradient(-30deg, #native_bg_color#E5, #native_bg_color#E5 45%, #native_bg_color# 45%) #fff;78+ }79+80+ .native-details,81+ .native-sponsor,82+ .native-bsa {83+ color: #native_color# !important;84+ }85+86+ .native-details:hover {87+ color: #native_color_hover# !important;88+ }89+90+ .native-cta {91+ color: #native_cta_color#;92+ background-color: #native_cta_bg_color#;93+ }94+95+ .native-cta:hover {96+ color: #native_cta_color_hover;97+ background-color: #native_cta_bg_color_hover#;98+ }99+ </style>100+ <div class="native-main">101+ <img class="native-img" src="#native_logo#">102+ <div class="native-details">103+ <span class="native-company">#native_title#</span>104+ <span class="native-desc">#native_desc#</span>105+ </div>106+ </div>107+ <span class="native-cta">#native_cta#</span>108+ </a>109+</div>modified:docs/_templates/sidebarlogo.html+12 added-11 removed
2 unmodified lines3 <img class="logo" src="{{ pathto('_static/requests-sidebar.png', 1) }}" title="https://kennethreitz.org/tattoos"/>4 </a>5 </p>6 <p>7-<iframe src="http://ghbtns.com/github-btn.html?user=requests&repo=requests&type=watch&count=true&size=large"7+<iframe src="https://ghbtns.com/github-btn.html?user=requests&repo=requests&type=watch&count=true&size=large"8 allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>9 </p>10 11+12 <p>13 Requests is an elegant and simple HTTP library for Python, built for14 human beings. You are currently looking at the documentation of the15 development release.16 </p>17 18+<p>Sponsored by <strong><a href="https://linode.com/">Linode</a></strong> and <a href="http://docs.python-requests.org/en/master/community/sponsors/#patron-sponsors">other wonderful organizations</a>.</p>19+20 <h3>Stay Informed</h3>21 <p>Receive updates on new releases and upcoming projects.</p>22 20-<p><a href="http://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>23+<p><a href="https://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>24 25 <hr/>26 27 <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=pythonrequestsorg" id="_carbonads_js"></script>28 26-<p>If you enjoy using this project, <a href="https://saythanks.io/to/kennethreitz">Say Thanks!</a></p>27-28-<p><iframe src="http://ghbtns.com/github-btn.html?user=kennethreitz&type=follow&count=false"29+<p><iframe src="https://ghbtns.com/github-btn.html?user=kennethreitz&type=follow&count=false"30 allowtransparency="true" frameborder="0" scrolling="0" width="200" height="20"></iframe></p>31 32 <p><a href="https://twitter.com/kennethreitz" class="twitter-follow-button" data-show-count="false">Follow @kennethreitz</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></p>33 34 35 <h3>Other Projects</h3>36 36-<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p>37+<p>More <a href="https://www.kennethreitz.org/">Kenneth Reitz</a> projects:</p>38 <ul>38- <li><a href="http://edmsynths.com/">edmsynths.com</a></li>39+ <li><a href="https://html.python-requests.org/">Requests-HTML</a></li>40+ <li><a href="http://howtopython.org/">howtopython.org</a></li>41 <li><a href="http://pipenv.org/">pipenv</a></li>40- <li><a href="http://pep8.org/">pep8.org</a></li>41- <li><a href="http://httpbin.org/">httpbin.org</a></li>42- <li><a href="http://python-guide.org">The Python Guide</a></li>42+ <li><a href="https://pep8.org/">pep8.org</a></li>43+ <li><a href="https://httpbin.org/">httpbin.org</a></li>44+ <li><a href="https://docs.python-guide.org/">The Python Guide</a></li>45 <li><a href="https://github.com/kennethreitz/maya">Maya: Datetimes for Humans</a></li>46 <li><a href="https://github.com/kennethreitz/records">Records: SQL for Humans</a></li>47 <li><a href="http://www.git-legit.org">Legit: Git for Humans</a></li>48 <li><a href="http://docs.python-tablib.org/en/latest/">Tablib: Tabular Datasets</a></li>11 unmodified lines60 <li><a href="http://pt.python-requests.org/">Portuguese</a></li>61 <li><a href="http://it.python-requests.org/">Italian</a></li>62 <li><a href="http://es.python-requests.org/">Spanish</a></li>63 </ul>62-modified:docs/community/faq.rst+4 added-3 removed
1 unmodified line2 3 Frequently Asked Questions4 ==========================5 6+.. image:: https://farm5.staticflickr.com/4290/35294660055_42c02b2316_k_d.jpg7+8 This part of the documentation answers common questions about Requests.9 10 Encoded Data?11 -------------43 unmodified lines55 56 Yes! Here's a list of Python platforms that are officially57 supported:58 57-* Python 2.659 * Python 2.759-* Python 3.360 * Python 3.461 * Python 3.562 * Python 3.663+* Python 3.764 * PyPy65 66 What are "hostname doesn't match" errors?67 -----------------------------------------1 unmodified line69 These errors occur when :ref:`SSL certificate verification <verification>`70 fails to match the certificate the server responds with to the hostname71 Requests thinks it's contacting. If you're certain the server's SSL setup is72 correct (for example, because you can visit the site with your browser) and72-you're using Python 2.6 or 2.7, a possible explanation is that you need73+you're using Python 2.7, a possible explanation is that you need74 Server-Name-Indication.75 76 `Server-Name-Indication`_, or SNI, is an official extension to SSL where the77 client tells the server what hostname it is contacting. This is important11 unmodified linesmodified:docs/community/out-there.rst+8 added-6 removed
1 Integrations2 ============3 4+.. image:: https://farm5.staticflickr.com/4239/34450900674_15863ddea0_k_d.jpg5+6 Python for iOS7 --------------8 9 Requests is built into the wonderful `Python for iOS <https://itunes.apple.com/us/app/python-2.7-for-ios/id485729872?mt=Python8>`_ runtime!4 unmodified lines14 15 16 Articles & Talks17 ================16-- `Python for the Web <http://gun.io/blog/python-for-the-web/>`_ teaches how to use Python to interact with the web, using Requests.17-- `Daniel Greenfeld's Review of Requests <http://pydanny.blogspot.com/2011/05/python-http-requests-for-humans.html>`_18-- `My 'Python for Humans' talk <http://python-for-humans.heroku.com>`_ ( `audio <http://codeconf.s3.amazonaws.com/2011/pycodeconf/talks/PyCodeConf2011%20-%20Kenneth%20Reitz.m4a>`_ )19-- `Issac Kelly's 'Consuming Web APIs' talk <http://issackelly.github.com/Consuming-Web-APIs-with-Python-Talk/slides/slides.html>`_20-- `Blog post about Requests via Yum <http://arunsag.wordpress.com/2011/08/17/new-package-python-requests-http-for-humans/>`_21-- `Russian blog post introducing Requests <http://habrahabr.ru/blogs/python/126262/>`_18+- `Python for the Web <https://www.gun.io/blog/python-for-the-web>`_ teaches how to use Python to interact with the web, using Requests.19+- `Daniel Greenfeld's Review of Requests <https://pydanny.blogspot.com/2011/05/python-http-requests-for-humans.html>`_20+- `My 'Python for Humans' talk <http://python-for-humans.heroku.com>`_ ( `audio <https://codeconf.s3.amazonaws.com/2011/pycodeconf/talks/PyCodeConf2011%20-%20Kenneth%20Reitz.m4a>`_ )21+- `Issac Kelly's 'Consuming Web APIs' talk <https://issackelly.github.com/Consuming-Web-APIs-with-Python-Talk/slides/slides.html>`_22+- `Blog post about Requests via Yum <https://arunsag.wordpress.com/2011/08/17/new-package-python-requests-http-for-humans/>`_23+- `Russian blog post introducing Requests <https://habr.com/post/126262/>`_24 - `Sending JSON in Requests <http://www.coglib.com/~icordasc/blog/2014/11/sending-json-in-requests.html>`_modified:docs/community/recommended.rst+12 added-5 removed
1 unmodified line2 3 Recommended Packages and Extensions4 ===================================5 6+.. image:: https://farm5.staticflickr.com/4218/35224319272_cfc0e621fb_k_d.jpg7+8 Requests has a great variety of powerful and useful third-party extensions.9 This page provides an overview of some of the best of them.10 11 Certifi CA Bundle2 unmodified lines14 `Certifi`_ is a carefully curated collection of Root Certificates for15 validating the trustworthiness of SSL certificates while verifying the16 identity of TLS hosts. It has been extracted from the Requests project.17 16-.. _Certifi: http://certifi.io/en/latest/18+.. _Certifi: https://github.com/certifi/python-certifi19 20 CacheControl21 ------------22 10 unmodified lines33 but do not belong in Requests proper. This library is actively maintained34 by members of the Requests core team, and reflects the functionality most35 requested by users within the community.36 35-.. _Requests-Toolbelt: http://toolbelt.readthedocs.io/en/latest/index.html37+.. _Requests-Toolbelt: https://toolbelt.readthedocs.io/en/latest/index.html38 39+40+Requests-Threads41+----------------42+43+`Requests-Threads` is a Requests session that returns the amazing Twisted's awaitable Deferreds instead of Response objects. This allows the use of ``async``/``await`` keyword usage on Python 3, or Twisted's style of programming, if desired.44+45+.. _Requests-Threads: https://github.com/requests/requests-threads46+47 Requests-OAuthlib48 -----------------49 50 `requests-oauthlib`_ makes it possible to do the OAuth dance from Requests10 unmodified lines61 `Betamax`_ records your HTTP interactions so the NSA does not have to.62 A VCR imitation designed only for Python-Requests.63 64 .. _betamax: https://github.com/sigmavirus24/betamax55-56-57-modified:docs/community/release-process.rst+10 added-9 removed
1 Release Process and Rules2 =========================3 4+.. image:: https://farm5.staticflickr.com/4215/34450901614_b74ae720db_k_d.jpg5+6 .. versionadded:: v2.6.27 8 Starting with the version to be released after ``v2.6.2``, the following rules9 will govern and describe how the Requests core team produces a new release.8 unmodified lines18 Breaking changes are changes that break backwards compatibility with prior19 versions. If the project were to change the ``text`` attribute on a20 ``Response`` object to a method, that would only happen in a Major release.21 20-Major releases may also include miscellaneous bug fixes and upgrades to21-vendored packages. The core developers of Requests are committed to providing22-a good user experience. This means we're also committed to preserving23-backwards compatibility as much as possible. Major releases will be infrequent24-and will need strong justifications before they are considered.22+Major releases may also include miscellaneous bug fixes. The core developers of23+Requests are committed to providing a good user experience. This means we're24+also committed to preserving backwards compatibility as much as possible. Major25+releases will be infrequent and will need strong justifications before they are26+considered.27 28 Minor Releases29 --------------30 29-A minor release will not include breaking changes but may include30-miscellaneous bug fixes and upgrades to vendored packages. If the previous31-version of Requests released was ``v10.2.7`` a minor release would be32-versioned as ``v10.3.0``.31+A minor release will not include breaking changes but may include miscellaneous32+bug fixes. If the previous version of Requests released was ``v10.2.7`` a minor33+release would be versioned as ``v10.3.0``.34 35 Minor releases will be backwards compatible with releases that have the same36 major version number. In other words, all versions that would start with37 ``v10.`` should be compatible with each other.18 unmodified linesadded:docs/community/sponsors.rst+96 added
1+Community Sponsors2+==================3+4+**tl;dr**: Requests development is currently `funded by the Python community <https://www.kennethreitz.org/requests3>`_, and5+some wonderful organizations that utilize the software in their businesses.6+7+8+-------------------9+10+11+Requests is one of the most heavily–utilized Python packages in the world.12+13+It is used by major corporations worldwide for all tasks, both small and large — from writing one–off scripts to orchestrating millions of dollars of critical infrastructure.14+15+It's even embedded within pip, that tool that you use to install packages and deploy with every day!16+17+After losing our primary open source maintainer (who was sponsored by a company to work on Requests, and other projects, full–time), we are seeking community financial contributions towards the development of Requests 3.0.18+19+Patron Sponsors20+----------------21+22+23+`Linode — SSD Cloud Hosting & Linux Servers <https://www.linode.com>`_24+//////////////////////////////////////////////////////////////////////25+26+Whether you’re just getting started or deploying a complex system, launching a Linode cloud server has never been easier. They offer the fastest hardware and network in the industry with scalable environments, and their 24x7 customer support team is always standing by to help with any questions.27+28+✨🍰✨29+//////30+31+----------------------------------32+33+This slot is reserved for ethical organizations willing to invest $10,000 or more in Requests per year.34+35+By becoming a patron–level sponsor, your organization will receive the following benefits:36+37+- Prominent placement on the Requests documentation sidebar (~11,000 uniques / day).38+- Honorable mention here, with logo.39+- Peace of mind knowing that the infrastructure you rely on is being actively maintained.40+41+Organizations that sign up will be listed in order — first come first serve!42+43+Major Sponsors44+--------------45+46+The following organizations have significantly contributed towards Requests' sustainability:47+48+`Slack — Bring your team together <https://slack.com>`_49+///////////////////////////////////////////////////////50+51+Slack was extremely kind to be the first organization to generously donate a large sum towards the `2018 Requests 3.0 fundraiser <https://www.kennethreitz.org/requests3>`_, surpassing our entire fundraising goal immediately! They are helping the world become a better place through connectiveness, and reducing the amount of email we all have52+to deal with on a daily basis.53+54+P.S. They're `hiring <https://slack.com/careers#openings>`_!55+56+57+`Twilio — Voice, SMS, and Video for Humans <https://www.twilio.com>`_58+/////////////////////////////////////////////////////////////////////59+60+Twilio was the second organization to generously donate a large sum towards the `2018 Requests 3.0 fundraiser <https://www.kennethreitz.org/requests3>`_, matching the donation of Slack! They are helping the world become a better place through interconnectivity,61+providing easy–to–use APIs, and empowering developers world-over to help humans communicate in meaningful and effictive ways.62+63+64+`Azure Cloud Developer Advocates <https://developer.microsoft.com/en-us/advocates/>`_65+/////////////////////////////////////////////////////////////////////////////////////66+67+Azure was the third organization to generously donate a large sum towards the `2018 Requests 3.0 fundraiser <https://www.kennethreitz.org/requests3>`_, matching the donation of Twilio! Awesome group of generous folks :)68+69+70+`Niteo — Web Systems Development <https://www.niteoweb.com>`_71+/////////////////////////////////////////////////////////////72+73+Niteo was the fourth company to generously donate towards the `2018 Requests 3.0 fundraiser <https://www.kennethreitz.org/requests3>`_. Niteo is a company employing tech enthusiasts from all over the world74+who love to build great stuff.75+76+77+`Heroku <https://heroku.com/python>`_78+/////////////////////////////////////79+80+Heroku has allowed Kenneth Reitz to work on some open source projects during work hours,81+including Requests (but mostly Pipenv), from time–to–time, so they are listed82+here as an honorable mention.83+84+----------------85+86+If your organization is interested in becoming either a sponsor or a patron, please `send us an email <mailto:me@kennethreitz.org>`_.87+88+89+Individual Sponsors90+-------------------91+92+Countless individuals, too many to list here, have individually contributed towards the sustainability of the Requests93+project over the years. Some, financially, others, with code. Contributions (from humans) of all kinds are greatly94+appreciated.95+96+✨🍰✨modified:docs/community/support.rst+8 added-5 removed
1 unmodified line2 3 Support4 =======5 6+.. image:: https://farm5.staticflickr.com/4198/34080352913_5c13ffb336_k_d.jpg7+8 If you have questions or issues about Requests, there are several options:9 8-StackOverflow10+Stack Overflow11 -------------12 13 If your question does not contain sensitive (possibly proprietary)14 information or can be properly anonymized, please ask a question on13-`StackOverflow <https://stackoverflow.com/questions/tagged/python-requests>`_15+`Stack Overflow <https://stackoverflow.com/questions/tagged/python-requests>`_16 and use the tag ``python-requests``.17 18 Send a Tweet19 ------------20 19-If your question is less than 140 characters, feel free to send a tweet to21+If your question is less than 280 characters, feel free to send a tweet to22 `@kennethreitz <https://twitter.com/kennethreitz>`_,21-`@sigmavirus24 <https://twitter.com/sigmavirus24>`_, or22-`@lukasaoz <https://twitter.com/lukasaoz>`_.23+`@sigmavirus24 <https://twitter.com/sigmavirus24>`_,24+`@lukasaoz <https://twitter.com/lukasaoz>`_, or25+`@nateprewitt <https://twitter.com/nateprewitt>`_.26 27 File an Issue28 -------------29 25 unmodified linesmodified:docs/community/updates.rst+3 added-2 removed
2 unmodified lines3 4 Community Updates5 =================6 7+.. image:: https://farm5.staticflickr.com/4244/34080354873_516c283ad0_k_d.jpg8+9 If you'd like to stay up to date on the community and development of Requests,10 there are several options:11 12 14 unmodified lines27 28 Release and Version History29 ===========================30 29-.. include:: ../../HISTORY.rst30-31+.. include:: ../../HISTORY.mdmodified:docs/community/vulnerabilities.rst+10 added-5 removed
1 Vulnerability Disclosure2 ========================3 4+.. image:: https://farm5.staticflickr.com/4211/34709353644_b041e9e1c2_k_d.jpg5+6 If you think you have found a potential security vulnerability in requests,7 please email `sigmavirus24 <mailto:graffatcolmingov@gmail.com>`_ and6-`Lukasa <mailto:cory@lukasa.co.uk>`_ directly. **Do not file a public issue.**8+`Nate <mailto:nate.prewitt@gmail.com>`_ directly. **Do not file a public issue.**9 10 Our PGP Key fingerprints are:11 12 - 0161 BB7E B208 B5E0 4FDC 9F81 D9DA 0A04 9113 F853 (@sigmavirus24)13 12-- 90DC AE40 FEA7 4B14 9B70 662D F25F 2144 EEC1 373D (@lukasa)14+- 8722 7E29 AD9C FF5C FAC3 EA6A 44D3 FF97 B80D C864 (@nateprewitt)15 16 If English is not your first language, please try to describe the problem and17 its impact to the best of your ability. For greater detail, please use your18 native language and we will try our best to translate it using online services.75 unmodified lines94 95 Previous CVEs96 -------------97 98+- Fixed in 2.20.099+ - `CVE 2018-18074 <https://cve.mitre.org/cgi-bin/cvename.cgi?name=2018-18074>`_100+101 - Fixed in 2.6.0102 98- - `CVE 2015-2296 <http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2015-2296>`_,103+ - `CVE 2015-2296 <https://cve.mitre.org/cgi-bin/cvename.cgi?name=2015-2296>`_,104 reported by Matthew Daley of `BugFuzz <https://bugfuzz.com/>`_.105 106 - Fixed in 2.3.0107 103- - `CVE 2014-1829 <http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2014-1829>`_108+ - `CVE 2014-1829 <https://cve.mitre.org/cgi-bin/cvename.cgi?name=2014-1829>`_109 105- - `CVE 2014-1830 <http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2014-1830>`_110+ - `CVE 2014-1830 <https://cve.mitre.org/cgi-bin/cvename.cgi?name=2014-1830>`_modified:docs/dev/authors.rst+1 added
1 Authors2 =======3 4+.. image:: https://static1.squarespace.com/static/533ad9bde4b098d084a846b1/t/534f6e1ce4b09b70f38ee6c1/1432265542589/DSCF3147.jpg?format=2500w5 6 .. include:: ../../AUTHORS.rstmodified:docs/dev/contributing.rst+8 added-5 removed
1 unmodified line2 3 Contributor's Guide4 ===================5 6+.. image:: https://farm5.staticflickr.com/4237/35550408335_7671fde302_k_d.jpg7+8 If you're reading this, you're probably interested in contributing to Requests.9 Thank you very much! Open source projects live-and-die based on the support10 they receive from others, and the fact that you're even considering11 contributing to the Requests project is *very* generous of you.12 13 This document lays out guidelines and advice for contributing to this project.14 If you're thinking of contributing, please start by reading this document and15 getting a feel for how contributing to this project works. If you have any14-questions, feel free to reach out to either `Ian Cordasco`_ or `Cory Benfield`_,15-the primary maintainers.16+questions, feel free to reach out to either `Ian Cordasco`_, `Cory Benfield`_,17+or `Nate Prewitt`_, the primary maintainers.18 19 .. _Ian Cordasco: http://www.coglib.com/~icordasc/20 .. _Cory Benfield: https://lukasa.co.uk/about21+.. _Nate Prewitt: https://www.nateprewitt.com/22 23 If you have non-technical feedback, philosophical ponderings, crazy ideas, or24 other general thoughts about Requests or its position within the Python25 ecosystem, the BDFL, `Kenneth Reitz`_, would love to hear from you.15 unmodified lines41 42 **All contributions are welcome**, as long as43 everyone involved is treated with respect.44 42-.. _be cordial or be on your way: http://kennethreitz.org/be-cordial-or-be-on-your-way/45+.. _be cordial or be on your way: https://www.kennethreitz.org/essays/be-cordial-or-be-on-your-way46 47 .. _early-feedback:48 49 Get Early Feedback107 unmodified lines157 model methods (e.g. ``__repr__``) are typically the exception to this rule.158 159 Thanks for helping to make the world a better place!160 158-.. _PEP 8: http://pep8.org161+.. _PEP 8: https://pep8.org/162 .. _line continuations: https://www.python.org/dev/peps/pep-0008/#indentation163 164 Documentation Contributions165 ---------------------------39 unmodified lines205 while keeping an open ear and mind.206 207 If you believe there is a feature missing, feel free to raise a feature208 request, but please do be aware that the overwhelming likelihood is that your206-feature request will not be accepted.209+feature request will not be accepted.modified:docs/dev/philosophy.rst+9 added-3 removed
1 Development Philosophy2 ======================3 4+.. image:: https://farm5.staticflickr.com/4231/34484831073_636008a23d_k_d.jpg5+6 Requests is an open but opinionated library, created by an open but opinionated developer.7 8 9 Management Style10 ~~~~~~~~~~~~~~~~11 10-`Kenneth Reitz <http://kennethreitz.org>`_ is the BDFL. He has final say in any decision related to the Requests project. Kenneth is responsible for the direction and form of the library, as well as its presentation. In addition to making decisions based on technical merit, he is responsible for making decisions based on the development philosophy of Requests.12+`Kenneth Reitz <https://www.kennethreitz.org/>`_ is the BDFL. He has final say in any decision related to the Requests project. Kenneth is responsible for the direction and form of the library, as well as its presentation. In addition to making decisions based on technical merit, he is responsible for making decisions based on the development philosophy of Requests.13 12-`Ian Cordasco <http://www.coglib.com/~icordasc/>`_ and `Cory Benfield <https://lukasa.co.uk/about/>`_ are the core contributors. They are responsible for triaging bug reports, reviewing pull requests and ensuring that Kenneth is kept up to speed with developments around the library. The day-to-day managing of the project is done by the core contributors. They are responsible for making judgements about whether or not a feature request is likely to be accepted by Kenneth. Their word is, in some ways, more final than Kenneth's.14+`Ian Cordasco <http://www.coglib.com/~icordasc/>`_, `Cory Benfield <https://lukasa.co.uk/about/>`_, and `Nate Prewitt <https://www.nateprewitt.com/>`_ are the core contributors. They are responsible for triaging bug reports, reviewing pull requests and ensuring that Kenneth is kept up to speed with developments around the library. The day-to-day managing of the project is done by the core contributors. They are responsible for making judgements about whether or not a feature request is likely to be accepted by Kenneth. Their word is, in some ways, more final than Kenneth's.15 16 Values17 ~~~~~~18 6 unmodified lines25 ~~~~~~~~~~~~~~~~~~~26 27 For many years, the open source community has been plagued with version number dystonia. Numbers vary so greatly from project to project, they are practically meaningless.28 27-Requests uses `Semantic Versioning <http://semver.org>`_. This specification seeks to put an end to this madness with a small set of practical guidelines for you and your colleagues to use in your next project.29+Requests uses `Semantic Versioning <https://semver.org/>`_. This specification seeks to put an end to this madness with a small set of practical guidelines for you and your colleagues to use in your next project.30 31 Standard Library?32 ~~~~~~~~~~~~~~~~~33 34 Requests has no *active* plans to be included in the standard library. This decision has been discussed at length with Guido as well as numerous core developers.35 36+.. raw:: html37+38+ <script async class="speakerdeck-embed" data-id="68f22f0841734d848315c618111b13ea" data-ratio="1.33333333333333" src="//speakerdeck.com/assets/embed.js"></script>39+40 Essentially, the standard library is where a library goes to die. It is appropriate for a module to be included when active development is no longer necessary.41 42 Linux Distro Packages43 ~~~~~~~~~~~~~~~~~~~~~4 unmodified linesmodified:docs/dev/todo.rst+4 added-4 removed
1 How to Help2 ===========3 4+.. image:: https://farm5.staticflickr.com/4290/34450900104_bc1d424213_k_d.jpg5+6 Requests is under active development, and contributions are more than welcome!7 8 #. Check for open issues or open a fresh issue to start a discussion around a bug.9 There is a Contributor Friendly tag for issues that should be ideal for people who are not very40 unmodified lines50 --------------------51 52 Requests currently supports the following versions of Python:53 52-- Python 2.654 - Python 2.754-- Python 3.355 - Python 3.456 - Python 3.557 - Python 3.658+- Python 3.759 - PyPy60 61 Google AppEngine is not officially supported although support is available62 with the `Requests-Toolbelt`_.63 63-.. _Requests-Toolbelt: http://toolbelt.readthedocs.io/64-64+.. _Requests-Toolbelt: https://toolbelt.readthedocs.io/modified:docs/user/advanced.rst+89 added-48 removed
1 unmodified line2 3 Advanced Usage4 ==============5 6+.. image:: https://farm5.staticflickr.com/4263/35163665790_d182d84f5e_k_d.jpg7+8 This document covers some of Requests more advanced features.9 10 .. _session-objects:11 12 unmodified lines24 Let's persist some cookies across requests::25 26 s = requests.Session()27 26- s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')27- r = s.get('http://httpbin.org/cookies')28+ s.get('https://httpbin.org/cookies/set/sessioncookie/123456789')29+ r = s.get('https://httpbin.org/cookies')30 31 print(r.text)32 # '{"cookies": {"sessioncookie": "123456789"}}'33 5 unmodified lines39 s.auth = ('user', 'pass')40 s.headers.update({'x-test': 'true'})41 42 # both 'x-test' and 'x-test2' are sent41- s.get('http://httpbin.org/headers', headers={'x-test2': 'true'})43+ s.get('https://httpbin.org/headers', headers={'x-test2': 'true'})44 45 46 Any dictionaries that you pass to a request method will be merged with the47 session-level values that are set. The method-level parameters override session4 unmodified lines52 with the first request, but not the second::53 54 s = requests.Session()55 54- r = s.get('http://httpbin.org/cookies', cookies={'from-my': 'browser'})56+ r = s.get('https://httpbin.org/cookies', cookies={'from-my': 'browser'})57 print(r.text)58 # '{"cookies": {"from-my": "browser"}}'59 58- r = s.get('http://httpbin.org/cookies')60+ r = s.get('https://httpbin.org/cookies')61 print(r.text)62 # '{"cookies": {}}'63 64 3 unmodified lines68 69 Sessions can also be used as context managers::70 71 with requests.Session() as s:70- s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')72+ s.get('https://httpbin.org/cookies/set/sessioncookie/123456789')73 74 This will make sure the session is closed as soon as the ``with`` block is75 exited, even if unhandled exceptions occurred.76 19 unmodified lines96 The ``Response`` object contains all of the information returned by the server and97 also contains the ``Request`` object you created originally. Here is a simple98 request to get some very important information from Wikipedia's servers::99 98- >>> r = requests.get('http://en.wikipedia.org/wiki/Monty_Python')100+ >>> r = requests.get('https://en.wikipedia.org/wiki/Monty_Python')101 102 If we want to access the headers the server sent back to us, we do this::103 104 >>> r.headers83 unmodified lines188 )189 190 print(resp.status_code)191 192+When you are using the prepared request flow, keep in mind that it does not take into account the environment.193+This can cause problems if you are using environment variables to change the behaviour of requests.194+For example: Self-signed SSL certificates specified in ``REQUESTS_CA_BUNDLE`` will not be taken into account.195+As a result an ``SSL: CERTIFICATE_VERIFY_FAILED`` is thrown.196+You can get around this behaviour by explicity merging the environment settings into your session::197+198+ from requests import Request, Session199+200+ s = Session()201+ req = Request('GET', url)202+203+ prepped = s.prepare_request(req)204+205+ # Merge environment settings into session206+ settings = s.merge_environment_settings(prepped.url, None, None, None, None)207+ resp = s.send(prepped, **settings)208+209+ print(resp.status_code)210+211 .. _verification:212 213 SSL Cert Verification214 ---------------------58 unmodified lines273 274 CA Certificates275 ---------------276 256-By default, Requests bundles a set of root CAs that it trusts, sourced from the257-`Mozilla trust store`_. However, these are only updated once for each Requests258-version. This means that if you pin a Requests version your certificates can259-become extremely out of date.277+Requests uses certificates from the package `certifi`_. This allows for users278+to update their trusted certificates without changing the version of Requests.279 261-From Requests version 2.4.0 onwards, Requests will attempt to use certificates262-from `certifi`_ if it is present on the system. This allows for users to update263-their trusted certificates without having to change the code that runs on their264-system.280+Before version 2.16, Requests bundled a set of root CAs that it trusted,281+sourced from the `Mozilla trust store`_. The certificates were only updated282+once for each Requests version. When ``certifi`` was not installed, this led to283+extremely out-of-date certificate bundles when using significantly older284+versions of Requests.285 286 For the sake of security we recommend upgrading certifi frequently!287 288 .. _HTTP persistent connection: https://en.wikipedia.org/wiki/HTTP_persistent_connection269-.. _connection pooling: http://urllib3.readthedocs.io/en/latest/reference/index.html#module-urllib3.connectionpool270-.. _certifi: http://certifi.io/289+.. _connection pooling: https://urllib3.readthedocs.io/en/latest/reference/index.html#module-urllib3.connectionpool290+.. _certifi: https://certifiio.readthedocs.io/291 .. _Mozilla trust store: https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt292 293 .. _body-content-workflow:294 27 unmodified lines322 inefficiency with connections. If you find yourself partially reading request323 bodies (or not reading them at all) while using ``stream=True``, you should324 make the request within a ``with`` statement to ensure it's always closed::325 306- with requests.get('http://httpbin.org/get', stream=True) as r:326+ with requests.get('https://httpbin.org/get', stream=True) as r:327 # Do things with the response here.328 329 .. _keep-alive:330 19 unmodified lines350 351 with open('massive-body', 'rb') as f:352 requests.post('http://some.url/streamed', data=f)353 334-.. warning:: It is strongly recommended that you open files in `binary mode`_.335- This is because Requests may attempt to provide the336- ``Content-Length`` header for you, and if it does this value will337- be set to the number of *bytes* in the file. Errors may occur if338- you open the file in *text mode*.354+.. warning:: It is strongly recommended that you open files in :ref:`binary355+ mode <tut-files>`. This is because Requests may attempt to provide356+ the ``Content-Length`` header for you, and if it does this value357+ will be set to the number of *bytes* in the file. Errors may occur358+ if you open the file in *text mode*.359 340-.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files360 342-361 .. _chunk-encoding:362 363 Chunk-Encoded Requests364 ----------------------27 unmodified lines392 <input type="file" name="images" multiple="true" required="true"/>393 394 To do that, just set files to a list of tuples of ``(form_field_name, file_info)``::395 378- >>> url = 'http://httpbin.org/post'396+ >>> url = 'https://httpbin.org/post'397 >>> multiple_files = [398 ('images', ('foo.png', open('foo.png', 'rb'), 'image/png')),399 ('images', ('bar.png', open('bar.png', 'rb'), 'image/png'))]400 >>> r = requests.post(url, files=multiple_files)4 unmodified lines405 'Content-Type': 'multipart/form-data; boundary=3131623adb2043caaeb5538cc7aa0b3a',406 ...407 }408 391-.. warning:: It is strongly recommended that you open files in `binary mode`_.392- This is because Requests may attempt to provide the393- ``Content-Length`` header for you, and if it does this value will394- be set to the number of *bytes* in the file. Errors may occur if395- you open the file in *text mode*.409+.. warning:: It is strongly recommended that you open files in :ref:`binary410+ mode <tut-files>`. This is because Requests may attempt to provide411+ the ``Content-Length`` header for you, and if it does this value412+ will be set to the number of *bytes* in the file. Errors may occur413+ if you open the file in *text mode*.414 397-.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files415 399-416 .. _event-hooks:417 418 Event Hooks419 -----------10 unmodified lines430 You can assign a hook function on a per-request basis by passing a431 ``{hook_name: callback_function}`` dictionary to the ``hooks`` request432 parameter::433 418- hooks=dict(response=print_url)434+ hooks={'response': print_url}435 436 That ``callback_function`` will receive a chunk of data as its first437 argument.438 5 unmodified lines444 If an error occurs while executing your callback, a warning is given.445 446 If the callback function returns a value, it is assumed that it is to447 replace the data that was passed in. If the function doesn't return432-anything, nothing else is effected.448+anything, nothing else is affected.449 450+::451+452+ def record_hook(r, *args, **kwargs):453+ r.hook_called = True454+ return r455+456 Let's print some request method arguments at runtime::457 436- >>> requests.get('http://httpbin.org', hooks=dict(response=print_url))437- http://httpbin.org458+ >>> requests.get('https://httpbin.org/', hooks={'response': print_url})459+ https://httpbin.org/460 <Response [200]>461 462+You can add multiple hooks to a single request. Let's call two hooks at once::463+464+ >>> r = requests.get('https://httpbin.org/', hooks={'response': [print_url, record_hook]})465+ >>> r.hook_called466+ True467+468+You can also add hooks to a ``Session`` instance. Any hooks you add will then469+be called on every request made to the session. For example::470+471+ >>> s = requests.Session()472+ >>> s.hooks['response'].append(print_url)473+ >>> s.get('https://httpbin.org/')474+ https://httpbin.org/475+ <Response [200]>476+477+A ``Session`` can have multiple hooks, which will be called in the order478+they are added.479+480 .. _custom-auth:481 482 Custom Authentication483 ---------------------44 unmodified lines528 529 import json530 import requests531 492- r = requests.get('http://httpbin.org/stream/20', stream=True)532+ r = requests.get('https://httpbin.org/stream/20', stream=True)533 534 for line in r.iter_lines():535 536 # filter out keep-alive new lines5 unmodified lines542 :meth:`Response.iter_lines() <requests.Response.iter_lines>` or543 :meth:`Response.iter_content() <requests.Response.iter_content>`, you'll want544 to provide a fallback encoding in the event the server doesn't provide one::545 506- r = requests.get('http://httpbin.org/stream/20', stream=True)546+ r = requests.get('https://httpbin.org/stream/20', stream=True)547 548 if r.encoding is None:549 r.encoding = 'utf-8'550 100 unmodified lines651 When you receive a response, Requests makes a guess at the encoding to652 use for decoding the response when you access the :attr:`Response.text653 <requests.Response.text>` attribute. Requests will first check for an654 encoding in the HTTP header, and if none is present, will use `chardet615-<http://pypi.python.org/pypi/chardet>`_ to attempt to guess the encoding.655+<https://pypi.org/project/chardet/>`_ to attempt to guess the encoding.656 657 The only time Requests will not do this is if no explicit charset658 is present in the HTTP headers **and** the ``Content-Type``659 header contains ``text``. In this situation, `RFC 2616620-<http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1>`_ specifies660+<https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1>`_ specifies661 that the default charset must be ``ISO-8859-1``. Requests follows the662 specification in this case. If you require a different encoding, you can663 manually set the :attr:`Response.encoding <requests.Response.encoding>`664 property, or use the raw :attr:`Response.content <requests.Response.content>`.213 unmodified lines878 879 Many HTTP APIs feature Link headers. They make APIs more self describing and880 discoverable.881 842-GitHub uses these for `pagination <http://developer.github.com/v3/#pagination>`_882+GitHub uses these for `pagination <https://developer.github.com/v3/#pagination>`_883 in their API, for example::884 885 >>> url = 'https://api.github.com/users/kennethreitz/repos?page=1&per_page=10'886 >>> r = requests.head(url=url)33 unmodified lines920 921 ::922 923 >>> s = requests.Session()884- >>> s.mount('http://www.github.com', MyAdapter())924+ >>> s.mount('https://github.com/', MyAdapter())925 926 The mount call registers a specific instance of a Transport Adapter to a927 prefix. Once mounted, any HTTP request made using that session whose URL starts928 with the given prefix will use the given Transport Adapter.16 unmodified lines945 passed-through to `urllib3`. We'll make a Transport Adapter that instructs the946 library to use SSLv3::947 948 import ssl949+ from urllib3.poolmanager import PoolManager950 951 from requests.adapters import HTTPAdapter911- from requests.packages.urllib3.poolmanager import PoolManager952 953 954 class Ssl3HttpAdapter(HTTPAdapter):955 """"Transport adapter" that allows us to use SSLv3."""2 unmodified lines958 self.poolmanager = PoolManager(959 num_pools=connections, maxsize=maxsize,960 block=block, ssl_version=ssl.PROTOCOL_SSLv3)961 922-.. _`described here`: http://www.kennethreitz.org/essays/the-future-of-python-http962+.. _`described here`: https://www.kennethreitz.org/essays/the-future-of-python-http963 .. _`urllib3`: https://github.com/shazow/urllib3964 965 .. _blocking-or-nonblocking:966 8 unmodified lines975 response at a time. However, these calls will still block.976 977 If you are concerned about the use of blocking IO, there are lots of projects978 out there that combine Requests with one of Python's asynchronicity frameworks.939-Two excellent examples are `grequests`_ and `requests-futures`_.979+Some excellent examples are `requests-threads`_, `grequests`_, and `requests-futures`_.980 981+.. _`requests-threads`: https://github.com/requests/requests-threads982 .. _`grequests`: https://github.com/kennethreitz/grequests983 .. _`requests-futures`: https://github.com/ross/requests-futures984 985 Header Ordering16 unmodified lines1002 The **connect** timeout is the number of seconds Requests will wait for your1003 client to establish a connection to a remote machine (corresponding to the1004 `connect()`_) call on the socket. It's a good practice to set connect timeouts1005 to slightly larger than a multiple of 3, which is the default `TCP packet965-retransmission window <http://www.hjp.at/doc/rfc/rfc2988.txt>`_.1006+retransmission window <https://www.hjp.at/doc/rfc/rfc2988.txt>`_.1007 1008 Once your client has connected to the server and sent the HTTP request, the1009 **read** timeout is the number of seconds the client will wait for the server1010 to send a response. (Specifically, it's the number of seconds that the client16 unmodified lines1027 ::1028 1029 r = requests.get('https://github.com', timeout=None)1030 990-.. _`connect()`: http://linux.die.net/man/2/connect1031+.. _`connect()`: https://linux.die.net/man/2/connectmodified:docs/user/authentication.rst+10 added-8 removed
1 unmodified line2 3 Authentication4 ==============5 6+.. image:: https://farm5.staticflickr.com/4258/35550409215_3b08d49d22_k_d.jpg7+8 This document discusses using various kinds of authentication with Requests.9 10 Many web services require authentication, and there are many different types.11 Below, we outline various forms of authentication available in Requests, from40 unmodified lines52 Another very popular form of HTTP Authentication is Digest Authentication,53 and Requests supports this out of the box as well::54 55 >>> from requests.auth import HTTPDigestAuth54- >>> url = 'http://httpbin.org/digest-auth/auth/user/pass'56+ >>> url = 'https://httpbin.org/digest-auth/auth/user/pass'57 >>> requests.get(url, auth=HTTPDigestAuth('user', 'pass'))58 <Response [200]>59 60 60 unmodified lines121 ... def __call__(self, r):122 ... # Implement my authentication123 ... return r124 ...123- >>> url = 'http://httpbin.org/get'125+ >>> url = 'https://httpbin.org/get'126 >>> requests.get(url, auth=MyAuth())127 <Response [200]>128 129 When an authentication handler is attached to a request,3 unmodified lines133 134 Further examples can be found under the `Requests organization`_ and in the135 ``auth.py`` file.136 135-.. _OAuth: http://oauth.net/137+.. _OAuth: https://oauth.net/138 .. _requests_oauthlib: https://github.com/requests/requests-oauthlib137-.. _requests-oauthlib OAuth2 documentation: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html138-.. _Web Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#web-application-flow139-.. _Mobile Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#mobile-application-flow140-.. _Legacy Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#legacy-application-flow141-.. _Backend Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#backend-application-flow139+.. _requests-oauthlib OAuth2 documentation: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html140+.. _Web Application Flow: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#web-application-flow141+.. _Mobile Application Flow: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#mobile-application-flow142+.. _Legacy Application Flow: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#legacy-application-flow143+.. _Backend Application Flow: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#backend-application-flow144 .. _Kerberos: https://github.com/requests/requests-kerberos145 .. _NTLM: https://github.com/requests/requests-ntlm146 .. _Requests organization: https://github.com/requestsmodified:docs/user/install.rst+8 added-5 removed
1 unmodified line2 3 Installation of Requests4 ========================5 6+.. image:: https://farm5.staticflickr.com/4230/35550376215_da1bf77a8c_k_d.jpg7+8+9 This part of the documentation covers the installation of Requests.10 The first step to using any software package is getting it properly installed.11 12 10-$ pip install requests11-----------------------13+$ pipenv install requests14+-------------------------15 16 To install Requests, simply run this simple command in your terminal of choice::17 15- $ pip install requests18+ $ pipenv install requests19 17-If you don't have `pip <https://pip.pypa.io>`_ installed (tisk tisk!),18-`this Python installation guide <http://docs.python-guide.org/en/latest/starting/installation/>`_20+If you don't have `pipenv <http://pipenv.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,21+`this Python installation guide <https://docs.python-guide.org/starting/installation/>`_22 can guide you through the process.23 24 Get the Source Code25 -------------------18 unmodified linesmodified:docs/user/intro.rst+4 added-2 removed
1 unmodified line2 3 Introduction4 ============5 6+.. image:: https://farm5.staticflickr.com/4317/35198386374_1939af3de6_k_d.jpg7+8 Philosophy9 ----------10 11 Requests was developed with a few :pep:`20` idioms in mind.24 unmodified lines36 closed-source software.37 38 Requests is released under terms of `Apache2 License`_.39 38-.. _`GPL Licensed`: http://www.opensource.org/licenses/gpl-license.php39-.. _`Apache2 License`: http://opensource.org/licenses/Apache-2.040+.. _`GPL Licensed`: https://opensource.org/licenses/gpl-license.php41+.. _`Apache2 License`: https://opensource.org/licenses/Apache-2.042 43 44 Requests License45 ----------------2 unmodified linesmodified:docs/user/quickstart.rst+54 added-37 removed
1 unmodified line2 3 Quickstart4 ==========5 6+.. image:: https://farm5.staticflickr.com/4259/35163667010_8bfcaef274_k_d.jpg7+8 .. module:: requests.models9 10 Eager to get started? This page gives a good introduction in how to get started11 with Requests.26 unmodified lines38 39 Requests' simple API means that all forms of HTTP request are as obvious. For40 example, this is how you make an HTTP POST request::41 40- >>> r = requests.post('http://httpbin.org/post', data = {'key':'value'})42+ >>> r = requests.post('https://httpbin.org/post', data = {'key':'value'})43 44 Nice, right? What about the other HTTP request types: PUT, DELETE, HEAD and45 OPTIONS? These are all just as simple::46 45- >>> r = requests.put('http://httpbin.org/put', data = {'key':'value'})46- >>> r = requests.delete('http://httpbin.org/delete')47- >>> r = requests.head('http://httpbin.org/get')48- >>> r = requests.options('http://httpbin.org/get')47+ >>> r = requests.put('https://httpbin.org/put', data = {'key':'value'})48+ >>> r = requests.delete('https://httpbin.org/delete')49+ >>> r = requests.head('https://httpbin.org/get')50+ >>> r = requests.options('https://httpbin.org/get')51 52 That's all well and good, but it's also only the start of what Requests can53 do.54 9 unmodified lines64 ``key1=value1`` and ``key2=value2`` to ``httpbin.org/get``, you would use the65 following code::66 67 >>> payload = {'key1': 'value1', 'key2': 'value2'}66- >>> r = requests.get('http://httpbin.org/get', params=payload)68+ >>> r = requests.get('https://httpbin.org/get', params=payload)69 70 You can see that the URL has been correctly encoded by printing the URL::71 72 >>> print(r.url)71- http://httpbin.org/get?key2=value2&key1=value173+ https://httpbin.org/get?key2=value2&key1=value174 75 Note that any dictionary key whose value is ``None`` will not be added to the76 URL's query string.77 78 You can also pass a list of items as a value::79 80 >>> payload = {'key1': 'value1', 'key2': ['value2', 'value3']}81 80- >>> r = requests.get('http://httpbin.org/get', params=payload)82+ >>> r = requests.get('https://httpbin.org/get', params=payload)83 >>> print(r.url)82- http://httpbin.org/get?key1=value1&key2=value2&key2=value384+ https://httpbin.org/get?key1=value1&key2=value2&key2=value385 86 Response Content87 ----------------88 20 unmodified lines109 110 If you change the encoding, Requests will use the new value of ``r.encoding``111 whenever you call ``r.text``. You might want to do this in any situation where112 you can apply special logic to work out what the encoding of the content will111-be. For example, HTTP and XML have the ability to specify their encoding in113+be. For example, HTML and XML have the ability to specify their encoding in114 their body. In situations like this, you should use ``r.content`` to find the115 encoding, and then set ``r.encoding``. This will let you use ``r.text`` with116 the correct encoding.117 52 unmodified lines170 171 >>> r = requests.get('https://api.github.com/events', stream=True)172 173 >>> r.raw172- <requests.packages.urllib3.response.HTTPResponse object at 0x101194810>174+ <urllib3.response.HTTPResponse object at 0x101194810>175 176 >>> r.raw.read(10)177 '\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03'178 9 unmodified lines188 download, the above is the preferred and recommended way to retrieve the189 content. Note that ``chunk_size`` can be freely adjusted to a number that190 may better fit your use cases.191 192+.. note::193 194+ An important note about using ``Response.iter_content`` versus ``Response.raw``.195+ ``Response.iter_content`` will automatically decode the ``gzip`` and ``deflate``196+ transfer-encodings. ``Response.raw`` is a raw stream of bytes -- it does not197+ transform the response content. If you really need access to the bytes as they198+ were returned, use ``Response.raw``.199+200+201 Custom Headers202 --------------203 204 If you'd like to add HTTP headers to a request, simply pass in a ``dict`` to the27 unmodified lines232 dictionary of data will automatically be form-encoded when the request is made::233 234 >>> payload = {'key1': 'value1', 'key2': 'value2'}235 226- >>> r = requests.post("http://httpbin.org/post", data=payload)236+ >>> r = requests.post("https://httpbin.org/post", data=payload)237 >>> print(r.text)238 {239 ...240 "form": {2 unmodified lines243 },244 ...245 }246 237-You can also pass a list of tuples to the ``data`` argument. This is particularly238-useful when the form has multiple elements that use the same key::247+The ``data`` argument can also have multiple values for each key. This can be248+done by making ``data`` either a list of tuples or a dictionary with lists249+as values. This is particularly useful when the form has multiple elements that250+use the same key::251 240- >>> payload = (('key1', 'value1'), ('key1', 'value2'))241- >>> r = requests.post('http://httpbin.org/post', data=payload)242- >>> print(r.text)252+ >>> payload_tuples = [('key1', 'value1'), ('key1', 'value2')]253+ >>> r1 = requests.post('https://httpbin.org/post', data=payload_tuples)254+ >>> payload_dict = {'key1': ['value1', 'value2']}255+ >>> r2 = requests.post('https://httpbin.org/post', data=payload_dict)256+ >>> print(r1.text)257 {258 ...259 "form": {260 "key1": [2 unmodified lines263 ]264 },265 ...266 }267+ >>> r1.text == r2.text268+ True269 270 There are times that you may want to send data that is not form-encoded. If271 you pass in a ``string`` instead of a ``dict``, that data will be posted directly.272 13 unmodified lines286 >>> payload = {'some': 'data'}287 288 >>> r = requests.post(url, json=payload)289 290+Note, the ``json`` parameter is ignored if either ``data`` or ``files`` is passed.291 292+Using the ``json`` parameter in the request will change the ``Content-Type`` in the header to ``application/json``.293+294 POST a Multipart-Encoded File295 -----------------------------296 297 Requests makes it simple to upload Multipart-encoded files::298 280- >>> url = 'http://httpbin.org/post'299+ >>> url = 'https://httpbin.org/post'300 >>> files = {'file': open('report.xls', 'rb')}301 302 >>> r = requests.post(url, files=files)303 >>> r.text6 unmodified lines310 }311 312 You can set the filename, content_type and headers explicitly::313 295- >>> url = 'http://httpbin.org/post'314+ >>> url = 'https://httpbin.org/post'315 >>> files = {'file': ('report.xls', open('report.xls', 'rb'), 'application/vnd.ms-excel', {'Expires': '0'})}316 317 >>> r = requests.post(url, files=files)318 >>> r.text6 unmodified lines325 }326 327 If you want, you can send strings to be received as files::328 310- >>> url = 'http://httpbin.org/post'329+ >>> url = 'https://httpbin.org/post'330 >>> files = {'file': ('report.csv', 'some,data,to,send\nanother,row,to,send\n')}331 332 >>> r = requests.post(url, files=files)333 >>> r.text13 unmodified lines347 348 For sending multiple files in one request refer to the :ref:`advanced <advanced>`349 section.350 332-.. warning:: It is strongly recommended that you open files in `binary mode`_.333- This is because Requests may attempt to provide the334- ``Content-Length`` header for you, and if it does this value will335- be set to the number of *bytes* in the file. Errors may occur if336- you open the file in *text mode*.351+.. warning:: It is strongly recommended that you open files in :ref:`binary352+ mode <tut-files>`. This is because Requests may attempt to provide353+ the ``Content-Length`` header for you, and if it does this value354+ will be set to the number of *bytes* in the file. Errors may occur355+ if you open the file in *text mode*.356 338-.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files357 340-358 Response Status Codes359 ---------------------360 361 We can check the response status code::362 346- >>> r = requests.get('http://httpbin.org/get')363+ >>> r = requests.get('https://httpbin.org/get')364 >>> r.status_code365 200366 367 Requests also comes with a built-in status code lookup object for easy5 unmodified lines373 If we made a bad request (a 4XX client error or 5XX server error response), we374 can raise it with375 :meth:`Response.raise_for_status() <requests.Response.raise_for_status>`::376 360- >>> bad_r = requests.get('http://httpbin.org/status/404')377+ >>> bad_r = requests.get('https://httpbin.org/status/404')378 >>> bad_r.status_code379 404380 381 >>> bad_r.raise_for_status()27 unmodified lines409 'content-type': 'application/json'410 }411 412 The dictionary is special, though: it's made just for HTTP headers. According to396-`RFC 7230 <http://tools.ietf.org/html/rfc7230#section-3.2>`_, HTTP Header names413+`RFC 7230 <https://tools.ietf.org/html/rfc7230#section-3.2>`_, HTTP Header names414 are case-insensitive.415 416 So, we can access the headers using any capitalization we want::417 5 unmodified lines423 424 It is also special in that the server could have sent the same header multiple425 times with different values, but requests combines them so they can be426 represented in the dictionary within a single mapping, as per410-`RFC 7230 <http://tools.ietf.org/html/rfc7230#section-3.2>`_:427+`RFC 7230 <https://tools.ietf.org/html/rfc7230#section-3.2>`_:428 429 A recipient MAY combine multiple header fields with the same field name430 into one "field-name: field-value" pair, without changing the semantics431 of the message, by appending each subsequent field value to the combined12 unmodified lines444 445 To send your own cookies to the server, you can use the ``cookies``446 parameter::447 431- >>> url = 'http://httpbin.org/cookies'448+ >>> url = 'https://httpbin.org/cookies'449 >>> cookies = dict(cookies_are='working')450 451 >>> r = requests.get(url, cookies=cookies)452 >>> r.text6 unmodified lines459 460 >>> jar = requests.cookies.RequestsCookieJar()461 >>> jar.set('tasty_cookie', 'yum', domain='httpbin.org', path='/cookies')462 >>> jar.set('gross_cookie', 'blech', domain='httpbin.org', path='/elsewhere')446- >>> url = 'http://httpbin.org/cookies'463+ >>> url = 'https://httpbin.org/cookies'464 >>> r = requests.get(url, cookies=jar)465 >>> r.text466 '{"cookies": {"tasty_cookie": "yum"}}'467 12 unmodified lines480 response.481 482 For example, GitHub redirects all HTTP requests to HTTPS::483 467- >>> r = requests.get('http://github.com')484+ >>> r = requests.get('http://github.com/')485 486 >>> r.url487 'https://github.com/'488 6 unmodified lines495 496 If you're using GET, OPTIONS, POST, PUT, PATCH or DELETE, you can disable497 redirection handling with the ``allow_redirects`` parameter::498 482- >>> r = requests.get('http://github.com', allow_redirects=False)499+ >>> r = requests.get('http://github.com/', allow_redirects=False)500 501 >>> r.status_code502 301503 1 unmodified line505 []506 507 If you're using HEAD, you can enable redirection as well::508 492- >>> r = requests.head('http://github.com', allow_redirects=True)509+ >>> r = requests.head('http://github.com/', allow_redirects=True)510 511 >>> r.url512 'https://github.com/'513 8 unmodified lines522 seconds with the ``timeout`` parameter. Nearly all production code should use523 this parameter in nearly all requests. Failure to do so can cause your program524 to hang indefinitely::525 509- >>> requests.get('http://github.com', timeout=0.001)526+ >>> requests.get('https://github.com/', timeout=0.001)527 Traceback (most recent call last):528 File "<stdin>", line 1, in <module>529 requests.exceptions.Timeout: HTTPConnectionPool(host='github.com', port=80): Request timed out. (timeout=0.001)530 32 unmodified linesmodified:docs/api.rst+7 added-17 removed
107 unmodified lines108 ------------------109 110 .. autoclass:: requests.codes111 112-::112+.. automodule:: requests.status_codes113 114- >>> requests.codes['temporary_redirect']115- 307114 117- >>> requests.codes.teapot118- 418119-120- >>> requests.codes['\o/']121- 200122-123-124-115 Migrating to 1.x116 ----------------117 118 This section details the main differences between 0.x and 1.x and is meant19 unmodified lines138 139 s = requests.Session() # formerly, session took parameters140 s.auth = auth141 s.headers.update(headers)152- r = s.get('http://httpbin.org/headers')142+ r = s.get('https://httpbin.org/headers')143 144 * All request hooks have been removed except 'response'.145 146 * Authentication helpers have been broken out into separate modules. See33 unmodified lines180 HTTPConnection.debuglevel = 1181 182 logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests183 logging.getLogger().setLevel(logging.DEBUG)194- requests_log = logging.getLogger("requests.packages.urllib3")184+ requests_log = logging.getLogger("urllib3")185 requests_log.setLevel(logging.DEBUG)186 requests_log.propagate = True187 198- requests.get('http://httpbin.org/headers')188+ requests.get('https://httpbin.org/headers')189 190 191 192 Licensing3 unmodified lines196 license from the ISC_ license to the `Apache 2.0`_ license. The Apache 2.0197 license ensures that contributions to Requests are also covered by the Apache198 2.0 license.199 210-.. _ISC: http://opensource.org/licenses/ISC211-.. _Apache 2.0: http://opensource.org/licenses/Apache-2.0200+.. _ISC: https://opensource.org/licenses/ISC201+.. _Apache 2.0: https://opensource.org/licenses/Apache-2.0202 203 204 Migrating to 2.x205 ----------------6 unmodified lines212 For more details on the changes in this release including new APIs, links213 to the relevant GitHub issues and some of the bug fixes, read Cory's blog_214 on the subject.215 226-.. _blog: http://lukasa.co.uk/2013/09/Requests_20/216+.. _blog: https://lukasa.co.uk/2013/09/Requests_20/217 218 219 API Changes220 ~~~~~~~~~~~40 unmodified linesmodified:docs/conf.py+7 added-3 removed
56 unmodified lines57 master_doc = 'index'58 59 # General information about the project.60 project = u'Requests'61-copyright = u'MMXVII. A <a href="http://kennethreitz.com/pages/open-projects.html">Kenneth Reitz</a> Project'61+copyright = u'MMXVIII. A <a href="http://kennethreitz.com/pages/open-projects.html">Kenneth Reitz</a> Project'62 author = u'Kenneth Reitz'63 64 # The version info for the project you're documenting, acts as replacement for65 # |version| and |release|, also used in various other places throughout the62 unmodified lines128 'show_powered_by': False,129 'github_user': 'requests',130 'github_repo': 'requests',131 'github_banner': True,132- 'show_related': False132+ 'show_related': False,133+ 'note_bg': '#FFF59C'134 }135 136 # Add any paths that contain custom themes here, relative to this directory.137 #html_theme_path = []237 unmodified lines375 376 # If false, no index is generated.377 #epub_use_index = True378 378-intersphinx_mapping = {'urllib3': ('http://urllib3.readthedocs.io/en/latest', None)}379+intersphinx_mapping = {380+ 'python': ('https://docs.python.org/3/', None),381+ 'urllib3': ('https://urllib3.readthedocs.io/en/latest', None),382+}modified:docs/index.rst+23 added-15 removed
1 unmodified line2 sphinx-quickstart on Sun Feb 13 23:54:25 2011.3 You can adapt this file completely to your liking, but it should at least4 contain the root `toctree` directive.5 6-Requests: HTTP for Humans7-=========================6+Requests: HTTP for Humans™7+==========================8 9 Release v\ |version|. (:ref:`Installation <install>`)10 11 .. image:: https://img.shields.io/pypi/l/requests.svg12- :target: https://pypi.python.org/pypi/requests12+ :target: https://pypi.org/project/requests/13 14 .. image:: https://img.shields.io/pypi/wheel/requests.svg15- :target: https://pypi.python.org/pypi/requests15+ :target: https://pypi.org/project/requests/16 17 .. image:: https://img.shields.io/pypi/pyversions/requests.svg18- :target: https://pypi.python.org/pypi/requests18+ :target: https://pypi.org/project/requests/19 20 .. image:: https://codecov.io/github/requests/requests/coverage.svg?branch=master21 :target: https://codecov.io/github/requests/requests22 :alt: codecov.io4 unmodified lines27 28 **Requests** is the only *Non-GMO* HTTP library for Python, safe for human29 consumption.30 31-*Warning: Recreational use of the Python standard library for HTTP may result in dangerous side-effects,32-including: security vulnerabilities, verbose code, reinventing the wheel,33-constantly reading documentation, depression, headaches, or even death.*31+.. note:: The use of **Python 3** is *highly* preferred over Python 2. Consider upgrading your applications and infrastructure if you find yourself *still* using Python 2 in production today. If you are using Python 3, congratulations — you are indeed a person of excellent taste.32+ —*Kenneth Reitz*33+ 34+ 35+If you're interested in financially supporting Kenneth Reitz open source, consider visiting `this link <https://cash.me/kennethreitz>`_. Your support helps tremendously with sustainability of motivation, as Open Source is no longer part of my day job.36 37+38 -------------------39 40 **Behold, the power of Requests**::41 19 unmodified lines61 62 User Testimonials63 -----------------64 62-Twitter, Spotify, Microsoft, Amazon, Lyft, BuzzFeed, Reddit, The NSA, Her Majesty's Government, Google, Twilio, Runscope, Mozilla, Heroku,65+Nike, Twitter, Spotify, Microsoft, Amazon, Lyft, BuzzFeed, Reddit, The NSA, Her Majesty's Government, Google, Twilio, Runscope, Mozilla, Heroku,66 PayPal, NPR, Obama for America, Transifex, Native Instruments, The Washington67 Post, SoundCloud, Kippt, Sony, and Federal U.S.68 Institutions that prefer to be unnamed claim to use Requests internally.69 67-**Armin Ronacher**—70+**Armin Ronacher**, creator of Flask—71 *Requests is the perfect example how beautiful an API can be with the72 right level of abstraction.*73 74 **Matt DeBoard**—1 unmodified line76 on my body, somehow. The whole thing.*77 78 **Daniel Greenfeld**—79 *Nuked a 1200 LOC spaghetti code library with 10 lines of code thanks to77- Kenneth Reitz's request library. Today has been AWESOME.*80+ Kenneth Reitz's Requests library. Today has been AWESOME.*81 82 **Kenny Meyers**—83 *Python HTTP: When in doubt, or when not in doubt, use Requests. Beautiful,84 simple, Pythonic.*85 86 Requests is one of the most downloaded Python packages of all time, pulling in84-over 11,000,000 downloads every month. All the cool kids are doing it!87+over 400,000 downloads **each day**. Join the party!88 89+If your organization uses Requests internally, consider `supporting the development of 3.0 <https://www.kennethreitz.org/requests3>`_. Your90+generosity will be greatly appreciated, and help drive the project forward91+into the future.92+93 Beloved Features94 ----------------95 96 Requests is ready for today's web.13 unmodified lines110 - Connection Timeouts111 - Chunked Requests112 - ``.netrc`` Support113 107-Requests officially supports Python 2.6–2.7 & 3.3–3.7, and runs great on PyPy.114+Requests officially supports Python 2.7 & 3.4–3.7, and runs great on PyPy.115 116 117 The User Guide118 --------------18 unmodified lines137 This part of the documentation, which is mostly prose, details the138 Requests ecosystem and community.139 140 .. toctree::134- :maxdepth: 1141+ :maxdepth: 2142 136- community/faq143+ community/sponsors144 community/recommended145+ community/faq146 community/out-there147 community/support148 community/vulnerabilities149 community/updates30 unmodified linesmodified:requests/__init__.py+20 added-10 removed
20 unmodified lines21 22 ... or POST:23 24 >>> payload = dict(key1='value1', key2='value2')25- >>> r = requests.post('http://httpbin.org/post', data=payload)25+ >>> r = requests.post('https://httpbin.org/post', data=payload)26 >>> print(r.text)27 {28 ...29 "form": {26 unmodified lines56 57 # Check urllib3 for compatibility.58 major, minor, patch = urllib3_version # noqa: F81159 major, minor, patch = int(major), int(minor), int(patch)60- # urllib3 >= 1.21.1, <= 1.2260+ # urllib3 >= 1.21.1, <= 1.2461 assert major == 162 assert minor >= 2163- assert minor <= 2263+ assert minor <= 2464 65 # Check chardet for compatibility.66 major, minor, patch = chardet_version.split('.')[:3]67 major, minor, patch = int(major), int(minor), int(patch)2 unmodified lines70 assert minor < 171 assert patch >= 272 73 74+def _check_cryptography(cryptography_version):75+ # cryptography < 1.3.476+ try:77+ cryptography_version = list(map(int, cryptography_version.split('.')))78+ except ValueError:79+ return80+81+ if cryptography_version < [1, 3, 4]:82+ warning = 'Old version of cryptography ({}) may cause slowdown.'.format(cryptography_version)83+ warnings.warn(warning, RequestsDependencyWarning)84+85 # Check imported dependencies for compatibility.86 try:87 check_compatibility(urllib3.__version__, chardet.__version__)88 except (AssertionError, ValueError):78- warnings.warn("urllib3 ({0}) or chardet ({1}) doesn't match a supported "89+ warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "90 "version!".format(urllib3.__version__, chardet.__version__),91 RequestsDependencyWarning)92 93 # Attempt to enable urllib3's SNI support, if possible94 try:95 from urllib3.contrib import pyopenssl96 pyopenssl.inject_into_urllib3()97+98+ # Check cryptography version99+ from cryptography import __version__ as cryptography_version100+ _check_cryptography(cryptography_version)101 except ImportError:102 pass103 104 # urllib3's DependencyWarnings should be silenced.17 unmodified lines122 )123 124 # Set default logging handler to avoid "No handler found" warnings.125 import logging111-try: # Python 2.7+112- from logging import NullHandler126+from logging import NullHandler113-except ImportError:114- class NullHandler(logging.Handler):115- def emit(self, record):116- pass127 128 logging.getLogger(__name__).addHandler(NullHandler())129 130 # FileModeWarnings go off per the default.1 unmodified linemodified:requests/__version__.py+3 added-3 removed
3 unmodified lines4 5 __title__ = 'requests'6 __description__ = 'Python HTTP for Humans.'7 __url__ = 'http://python-requests.org'8-__version__ = '2.18.3'9-__build__ = 0x0218038+__version__ = '2.20.0'9+__build__ = 0x02200010 __author__ = 'Kenneth Reitz'11 __author_email__ = 'me@kennethreitz.org'12 __license__ = 'Apache 2.0'13-__copyright__ = 'Copyright 2017 Kenneth Reitz'13+__copyright__ = 'Copyright 2018 Kenneth Reitz'14 __cake__ = u'\u2728 \U0001f370 \u2728'modified:requests/adapters.py+25 added-17 removed
11 unmodified lines12 import socket13 14 from urllib3.poolmanager import PoolManager, proxy_from_url15 from urllib3.response import HTTPResponse16+from urllib3.util import parse_url17 from urllib3.util import Timeout as TimeoutSauce18 from urllib3.util.retry import Retry19 from urllib3.exceptions import ClosedPoolError20 from urllib3.exceptions import ConnectTimeoutError4 unmodified lines25 from urllib3.exceptions import ProtocolError26 from urllib3.exceptions import ReadTimeoutError27 from urllib3.exceptions import SSLError as _SSLError28 from urllib3.exceptions import ResponseError29+from urllib3.exceptions import LocationValueError30 31 from .models import Response32 from .compat import urlparse, basestring31-from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,32- prepend_scheme_if_needed, get_auth_from_url, urldefragauth,33- select_proxy)33+from .utils import (DEFAULT_CA_BUNDLE_PATH, extract_zipped_paths,34+ get_encoding_from_headers, prepend_scheme_if_needed,35+ get_auth_from_url, urldefragauth, select_proxy)36 from .structures import CaseInsensitiveDict37 from .cookies import extract_cookies_to_jar38 from .exceptions import (ConnectionError, ConnectTimeout, ReadTimeout, SSLError,37- ProxyError, RetryError, InvalidSchema)39+ ProxyError, RetryError, InvalidSchema, InvalidProxyURL,40+ InvalidURL)41 from .auth import _basic_auth_str42 43 try:44 from urllib3.contrib.socks import SOCKSProxyManager83 unmodified lines128 129 self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block)130 131 def __getstate__(self):129- return dict((attr, getattr(self, attr, None)) for attr in130- self.__attrs__)132+ return {attr: getattr(self, attr, None) for attr in self.__attrs__}133 134 def __setstate__(self, state):135 # Can't handle by adding 'proxy_manager' to self.__attrs__ because136 # self.poolmanager uses a lambda function, which isn't pickleable.83 unmodified lines220 if verify is not True:221 cert_loc = verify222 223 if not cert_loc:222- cert_loc = DEFAULT_CA_BUNDLE_PATH224+ cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)225 226 if not cert_loc or not os.path.exists(cert_loc):227 raise IOError("Could not find a suitable TLS CA certificate bundle, "226- "invalid path: {0}".format(cert_loc))228+ "invalid path: {}".format(cert_loc))229 230 conn.cert_reqs = 'CERT_REQUIRED'231 232 if not os.path.isdir(cert_loc):13 unmodified lines246 conn.cert_file = cert247 conn.key_file = None248 if conn.cert_file and not os.path.exists(conn.cert_file):249 raise IOError("Could not find the TLS certificate file, "248- "invalid path: {0}".format(conn.cert_file))250+ "invalid path: {}".format(conn.cert_file))251 if conn.key_file and not os.path.exists(conn.key_file):252 raise IOError("Could not find the TLS key file, "251- "invalid path: {0}".format(conn.key_file))253+ "invalid path: {}".format(conn.key_file))254 255 def build_response(self, req, resp):256 """Builds a :class:`Response <requests.Response>` object from a urllib3257 response. This should not be called from user code, and is only exposed43 unmodified lines301 proxy = select_proxy(url, proxies)302 303 if proxy:304 proxy = prepend_scheme_if_needed(proxy, 'http')305+ proxy_url = parse_url(proxy)306+ if not proxy_url.host:307+ raise InvalidProxyURL("Please check proxy URL. It is malformed"308+ " and could be missing the host.")309 proxy_manager = self.proxy_manager_for(proxy)310 conn = proxy_manager.connection_from_url(url)311 else:312 # Only scheme should be lower case65 unmodified lines378 This should not be called from user code, and is only exposed for use379 when subclassing the380 :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.381 376- :param proxies: The url of the proxy being used for this request.382+ :param proxy: The url of the proxy being used for this request.383 :rtype: dict384 """385 headers = {}386 username, password = get_auth_from_url(proxy)20 unmodified lines407 :param proxies: (optional) The proxies dictionary to apply to the request.408 :rtype: requests.Response409 """410 411+ try:405- conn = self.get_connection(request.url, proxies)412+ conn = self.get_connection(request.url, proxies)413+ except LocationValueError as e:414+ raise InvalidURL(e, request=request)415 416 self.cert_verify(conn, request.url, verify, cert)417 url = self.request_url(request, proxies)409- self.add_headers(request)418+ self.add_headers(request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)419 420 chunked = not (request.body is None or 'Content-Length' in request.headers)421 422 if isinstance(timeout, tuple):1 unmodified line424 connect, read = timeout425 timeout = TimeoutSauce(connect=connect, read=read)426 except ValueError as e:427 # this may raise a string formatting error.419- err = ("Invalid timeout {0}. Pass a (connect, read) "428+ err = ("Invalid timeout {}. Pass a (connect, read) "429 "timeout tuple, or a single float to set "430 "both timeouts to the same value".format(timeout))431 raise ValueError(err)432 elif isinstance(timeout, TimeoutSauce):41 unmodified lines474 low_conn.send(b'0\r\n\r\n')475 476 # Receive the response from the server477 try:469- # For Python 2.7+ versions, use buffering of HTTP470- # responses478+ # For Python 2.7, use buffering of HTTP responses479 r = low_conn.getresponse(buffering=True)480 except TypeError:473- # For compatibility with Python 2.6 versions and back481+ # For compatibility with Python 3.3+482 r = low_conn.getresponse()483 484 resp = HTTPResponse.from_httplib(485 r,48 unmodified linesmodified:requests/api.py+14 added-8 removed
16 unmodified lines17 """Constructs and sends a :class:`Request <Request>`.18 19 :param method: method for the new :class:`Request` object.20 :param url: URL for the new :class:`Request` object.21- :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.22- :param data: (optional) Dictionary or list of tuples ``[(key, value)]`` (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.23- :param json: (optional) json data to send in the body of the :class:`Request`.21+ :param params: (optional) Dictionary, list of tuples or bytes to send22+ in the body of the :class:`Request`.23+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like24+ object to send in the body of the :class:`Request`.25+ :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.26 :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.27 :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.28 :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload.29 ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``18 unmodified lines48 49 Usage::50 51 >>> import requests50- >>> req = requests.request('GET', 'http://httpbin.org/get')52+ >>> req = requests.request('GET', 'https://httpbin.org/get')53 <Response [200]>54 """55 56 # By using the 'with' statement we are sure the session is closed, thus we6 unmodified lines63 def get(url, params=None, **kwargs):64 r"""Sends a GET request.65 66 :param url: URL for the new :class:`Request` object.65- :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.67+ :param params: (optional) Dictionary, list of tuples or bytes to send68+ in the body of the :class:`Request`.69 :param \*\*kwargs: Optional arguments that ``request`` takes.70 :return: :class:`Response <Response>` object71 :rtype: requests.Response72 """31 unmodified lines104 def post(url, data=None, json=None, **kwargs):105 r"""Sends a POST request.106 107 :param url: URL for the new :class:`Request` object.105- :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.108+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like109+ object to send in the body of the :class:`Request`.110 :param json: (optional) json data to send in the body of the :class:`Request`.111 :param \*\*kwargs: Optional arguments that ``request`` takes.112 :return: :class:`Response <Response>` object113 :rtype: requests.Response5 unmodified lines119 def put(url, data=None, **kwargs):120 r"""Sends a PUT request.121 122 :param url: URL for the new :class:`Request` object.119- :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.123+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like124+ object to send in the body of the :class:`Request`.125 :param json: (optional) json data to send in the body of the :class:`Request`.126 :param \*\*kwargs: Optional arguments that ``request`` takes.127 :return: :class:`Response <Response>` object128 :rtype: requests.Response5 unmodified lines134 def patch(url, data=None, **kwargs):135 r"""Sends a PATCH request.136 137 :param url: URL for the new :class:`Request` object.133- :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.138+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like139+ object to send in the body of the :class:`Request`.140 :param json: (optional) json data to send in the body of the :class:`Request`.141 :param \*\*kwargs: Optional arguments that ``request`` takes.142 :return: :class:`Response <Response>` object143 :rtype: requests.Response15 unmodified linesmodified:requests/auth.py+14 added-2 removed
36 unmodified lines37 # for things like ints. This will be removed in 3.0.0.38 if not isinstance(username, basestring):39 warnings.warn(40 "Non-string usernames will no longer be supported in Requests "41- "3.0.0. Please convert the object you've passed in ({0!r}) to "41+ "3.0.0. Please convert the object you've passed in ({!r}) to "42 "a string or bytes object in the near future to avoid "43 "problems.".format(username),44 category=DeprecationWarning,45 )1 unmodified line47 48 if not isinstance(password, basestring):49 warnings.warn(50 "Non-string passwords will no longer be supported in Requests "51- "3.0.0. Please convert the object you've passed in ({0!r}) to "51+ "3.0.0. Please convert the object you've passed in ({!r}) to "52 "a string or bytes object in the near future to avoid "53 "problems.".format(password),54 category=DeprecationWarning,55 )96 unmodified lines152 if isinstance(x, str):153 x = x.encode('utf-8')154 return hashlib.sha1(x).hexdigest()155 hash_utf8 = sha_utf8156+ elif _algorithm == 'SHA-256':157+ def sha256_utf8(x):158+ if isinstance(x, str):159+ x = x.encode('utf-8')160+ return hashlib.sha256(x).hexdigest()161+ hash_utf8 = sha256_utf8162+ elif _algorithm == 'SHA-512':163+ def sha512_utf8(x):164+ if isinstance(x, str):165+ x = x.encode('utf-8')166+ return hashlib.sha512(x).hexdigest()167+ hash_utf8 = sha512_utf8168 169 KD = lambda s, d: hash_utf8("%s:%s" % (s, d))170 171 if hash_utf8 is None:134 unmodified linesmodified:requests/compat.py+2 added-1 removed
41 unmodified lines42 from urllib2 import parse_http_list43 import cookielib44 from Cookie import Morsel45 from StringIO import StringIO46+ from collections import Callable, Mapping, MutableMapping, OrderedDict47 47- from urllib3.packages.ordered_dict import OrderedDict48 49 builtin_str = str50 bytes = str51 str = unicode7 unmodified lines59 from http import cookiejar as cookielib60 from http.cookies import Morsel61 from io import StringIO62 from collections import OrderedDict63+ from collections.abc import Callable, Mapping, MutableMapping64 65 builtin_str = str66 str = str67 bytes = bytes3 unmodified linesmodified:requests/cookies.py+24 added-17 removed
10 unmodified lines11 12 import copy13 import time14 import calendar15-import collections15 16 from ._internal_utils import to_native_string18-from .compat import cookielib, urlparse, urlunparse, Morsel17+from .compat import cookielib, urlparse, urlunparse, Morsel, MutableMapping18 19 try:20 import threading21 except ImportError:145 unmodified lines167 Use .get and .set and include domain and path args in order to be more specific.168 """169 170 172-class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):171+class RequestsCookieJar(cookielib.CookieJar, MutableMapping):172 """Compatibility class; is a cookielib.CookieJar, but exposes a dict173 interface.174 175 This is the CookieJar we create by default for requests and sessions that237 unmodified lines413 414 def copy(self):415 """Return a copy of this RequestsCookieJar."""416 new_cj = RequestsCookieJar()417+ new_cj.set_policy(self.get_policy())418 new_cj.update(self)419 return new_cj420 421+ def get_policy(self):422+ """Return the CookiePolicy instance used."""423+ return self._policy424 425+426 def _copy_cookie_jar(jar):427 if jar is None:428 return None429 13 unmodified lines443 444 By default, the pair of `name` and `value` will be set for the domain ''445 and sent on every request (this is sometimes called a "supercookie").446 """443- result = dict(444- version=0,445- name=name,446- value=value,447- port=None,448- domain='',449- path='/',450- secure=False,451- expires=None,452- discard=True,453- comment=None,454- comment_url=None,455- rest={'HttpOnly': None},456- rfc2109=False,)447+ result = {448+ 'version': 0,449+ 'name': name,450+ 'value': value,451+ 'port': None,452+ 'domain': '',453+ 'path': '/',454+ 'secure': False,455+ 'expires': None,456+ 'discard': True,457+ 'comment': None,458+ 'comment_url': None,459+ 'rest': {'HttpOnly': None},460+ 'rfc2109': False,461+ }462 463 badargs = set(kwargs) - set(result)464 if badargs:465 err = 'create_cookie() got unexpected keyword arguments: %s'45 unmodified lines511 :param cookie_dict: Dict of key/values to insert into CookieJar.512 :param cookiejar: (optional) A cookiejar to add the cookies to.513 :param overwrite: (optional) If False, will not replace cookies514 already in the jar with new ones.515+ :rtype: CookieJar516 """517 if cookiejar is None:518 cookiejar = RequestsCookieJar()519 10 unmodified lines530 """Add cookies to cookiejar and returns a merged CookieJar.531 532 :param cookiejar: CookieJar object to add the cookies to.533 :param cookies: Dictionary or CookieJar object to be added.534+ :rtype: CookieJar535 """536 if not isinstance(cookiejar, cookielib.CookieJar):537 raise ValueError('You can only merge into CookieJar')538 11 unmodified linesmodified:requests/exceptions.py+4 added
83 unmodified lines84 class InvalidHeader(RequestException, ValueError):85 """The header value provided was somehow invalid."""86 87 88+class InvalidProxyURL(InvalidURL):89+ """The proxy URL provided is invalid."""90+91+92 class ChunkedEncodingError(RequestException):93 """The server declared chunked encoding but sent an invalid chunk."""94 95 31 unmodified linesmodified:requests/help.py+2 added-3 removed
11 unmodified lines12 13 from . import __version__ as requests_version14 15 try:16- from .packages.urllib3.contrib import pyopenssl16+ from urllib3.contrib import pyopenssl17 except ImportError:18 pyopenssl = None19 OpenSSL = None20 cryptography = None67 unmodified lines88 idna_info = {89 'version': getattr(idna, '__version__', ''),90 }91 92- # OPENSSL_VERSION_NUMBER doesn't exist in the Python 2.6 ssl module.93- system_ssl = getattr(ssl, 'OPENSSL_VERSION_NUMBER', None)92+ system_ssl = ssl.OPENSSL_VERSION_NUMBER93 system_ssl_info = {94 'version': '%x' % system_ssl if system_ssl is not None else ''95 }96 23 unmodified linesmodified:requests/hooks.py+2 added-2 removed
13 unmodified lines14 HOOKS = ['response']15 16 17 def default_hooks():18- return dict((event, []) for event in HOOKS)18+ return {event: [] for event in HOOKS}19 20 # TODO: response is the only one21 22 23 def dispatch_hook(key, hooks, hook_data, **kwargs):24 """Dispatches a hook dictionary on a given piece of data."""25- hooks = hooks or dict()25+ hooks = hooks or {}26 hooks = hooks.get(key)27 if hooks:28 if hasattr(hooks, '__call__'):29 hooks = [hooks]5 unmodified linesmodified:requests/models.py+21 added-16 removed
5 unmodified lines6 7 This module contains the primary objects that power Requests.8 """9 10-import collections10 import datetime11 import sys12 13 # Import encoding now, to avoid implicit import later.21 unmodified lines35 guess_filename, get_auth_from_url, requote_uri,36 stream_decode_response_unicode, to_key_val_list, parse_header_links,37 iter_slices, guess_json_utf, super_len, check_header_validity)38 from .compat import (39+ Callable, Mapping,40 cookielib, urlunparse, urlsplit, urlencode, str, bytes,41 is_py2, chardet, builtin_str, basestring)42 from .compat import json as complexjson43 from .status_codes import codes110 unmodified lines154 fp = v155 156 if isinstance(fp, (str, bytes, bytearray)):157 fdata = fp158- else:158+ elif hasattr(fp, 'read'):159 fdata = fp.read()160+ elif fp is None:161+ continue162+ else:163+ fdata = fp164 165 rf = RequestField(name=k, data=fdata, filename=fn, headers=fh)166 rf.make_multipart(content_type=ft)167 new_fields.append(rf)9 unmodified lines177 178 if event not in self.hooks:179 raise ValueError('Unsupported event specified, with event name "%s"' % (event))180 177- if isinstance(hook, collections.Callable):181+ if isinstance(hook, Callable):182 self.hooks[event].append(hook)183 elif hasattr(hook, '__iter__'):180- self.hooks[event].extend(h for h in hook if isinstance(h, collections.Callable))184+ self.hooks[event].extend(h for h in hook if isinstance(h, Callable))185 186 def deregister_hook(self, event, hook):187 """Deregister a previously registered hook.188 Returns True if the hook existed, False if not.14 unmodified lines203 :param method: HTTP method to use.204 :param url: URL to send.205 :param headers: dictionary of headers to send.206 :param files: dictionary of {filename: fileobject} files to multipart upload.203- :param data: the body to attach to the request. If a dictionary is provided, form-encoding will take place.207+ :param data: the body to attach to the request. If a dictionary or208+ list of tuples ``[(key, value)]`` is provided, form-encoding will209+ take place.210 :param json: json for the body to attach to the request (if files or data is not specified).205- :param params: dictionary of URL parameters to append to the URL.211+ :param params: URL parameters to append to the URL. If a dictionary or212+ list of tuples ``[(key, value)]`` is provided, form-encoding will213+ take place.214 :param auth: Auth handler or (user, pass) tuple.215 :param cookies: dictionary or CookieJar of cookies to attach to this request.216 :param hooks: dictionary of callback hooks, for internal usage.217 218 Usage::219 220 >>> import requests213- >>> req = requests.Request('GET', 'http://httpbin.org/get')221+ >>> req = requests.Request('GET', 'https://httpbin.org/get')222 >>> req.prepare()223 <PreparedRequest [GET]>224 """225 51 unmodified lines277 278 Usage::279 280 >>> import requests273- >>> req = requests.Request('GET', 'http://httpbin.org/get')281+ >>> req = requests.Request('GET', 'https://httpbin.org/get')282 >>> r = req.prepare()283 <PreparedRequest [GET]>284 285 >>> s = requests.Session()182 unmodified lines468 body = body.encode('utf-8')469 470 is_stream = all([471 hasattr(data, '__iter__'),464- not isinstance(data, (basestring, list, tuple, collections.Mapping))472+ not isinstance(data, (basestring, list, tuple, Mapping))473 ])474 475 try:476 length = super_len(data)174 unmodified lines651 # sure the content has been fully read.652 if not self._content_consumed:653 self.content654 647- return dict(648- (attr, getattr(self, attr, None))649- for attr in self.__attrs__650- )655+ return {attr: getattr(self, attr, None) for attr in self.__attrs__}656 657 def __setstate__(self, state):658 for name, value in state.items():659 setattr(self, name, value)30 unmodified lines690 return self.iter_content(128)691 692 @property693 def ok(self):689- """Returns True if :attr:`status_code` is less than 400.694+ """Returns True if :attr:`status_code` is less than 400, False if not.695 696 This attribute checks if the status code of the response is between697 400 and 600 to see if there was a client error or a server error. If693- the status code, is between 200 and 400, this will return True. This698+ the status code is between 200 and 400, this will return True. This699 is **not** a check to see if the response code is ``200 OK``.700 """701 try:702 self.raise_for_status()121 unmodified lines824 825 if self.status_code == 0 or self.raw is None:826 self._content = None827 else:823- self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()828+ self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''829 830 self._content_consumed = True831 # don't need to release the connection; that's been handled by urllib3832 # since we exhausted the data.121 unmodified linesmodified:requests/sessions.py+47 added-23 removed
6 unmodified lines7 This module provides a Session object to manage and persist settings across8 requests (cookies, auth, proxies).9 """10 import os11-import platform11+import sys12 import time13-from collections import Mapping13 from datetime import timedelta14 15 from .auth import _basic_auth_str17-from .compat import cookielib, is_py3, OrderedDict, urljoin, urlparse16+from .compat import cookielib, is_py3, OrderedDict, urljoin, urlparse, Mapping17 from .cookies import (18 cookiejar_from_dict, extract_cookies_to_jar, RequestsCookieJar, merge_cookies)19 from .models import Request, PreparedRequest, DEFAULT_REDIRECT_LIMIT20 from .hooks import default_hooks, dispatch_hook15 unmodified lines36 # formerly defined here, reexposed here for backward compatibility37 from .models import REDIRECT_STATI38 39 # Preferred clock, based on which one is more accurate on a given system.41-if platform.system() == 'Windows':42- try: # Python 3.3+40+if sys.platform == 'win32':41+ try: # Python 3.4+42 preferred_clock = time.perf_counter43 except AttributeError: # Earlier than Python 3.44 preferred_clock = time.clock45 else:68 unmodified lines114 location = location.encode('latin1')115 return to_native_string(location, 'utf8')116 return None117 118+ def should_strip_auth(self, old_url, new_url):119+ """Decide whether Authorization header should be removed when redirecting"""120+ old_parsed = urlparse(old_url)121+ new_parsed = urlparse(new_url)122+ if old_parsed.hostname != new_parsed.hostname:123+ return True124+ # Special case: allow http -> https redirect when using the standard125+ # ports. This isn't specified by RFC 7235, but is kept to avoid126+ # breaking backwards compatibility with older versions of requests127+ # that allowed any redirects on the same host.128+ if (old_parsed.scheme == 'http' and old_parsed.port in (80, None)129+ and new_parsed.scheme == 'https' and new_parsed.port in (443, None)):130+ return False131+ # Standard case: root URI must match132+ return old_parsed.port != new_parsed.port or old_parsed.scheme != new_parsed.scheme133+134 def resolve_redirects(self, resp, req, stream=False, timeout=None,135 verify=True, cert=None, proxies=None, yield_requests=False, **adapter_kwargs):136 """Receives a Response. Returns a generator of Responses or Requests."""137 138 hist = [] # keep track of history139 140 url = self.get_redirect_target(resp)141+ previous_fragment = urlparse(req.url).fragment142 while url:143 prepared_request = req.copy()144 145 # Update history and keep track of redirects.16 unmodified lines162 if url.startswith('//'):163 parsed_rurl = urlparse(resp.url)164 url = '%s:%s' % (to_native_string(parsed_rurl.scheme), url)165 150- # The scheme should be lower case...166+ # Normalize url case and attach previous fragment if needed (RFC 7231 7.1.2)167 parsed = urlparse(url)168+ if parsed.fragment == '' and previous_fragment:169+ parsed = parsed._replace(fragment=previous_fragment)170+ elif parsed.fragment:171+ previous_fragment = parsed.fragment172 url = parsed.geturl()173 174 # Facilitate relative 'location' headers, as allowed by RFC 7231.175 # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')75 unmodified lines251 """252 headers = prepared_request.headers253 url = prepared_request.url254 235- if 'Authorization' in headers:255+ if 'Authorization' in headers and self.should_strip_auth(response.request.url, url):256 # If we get redirected to a new host, we should strip out any257 # authentication headers.238- original_parsed = urlparse(response.request.url)239- redirect_parsed = urlparse(url)258+ del headers['Authorization']259 241- if (original_parsed.hostname != redirect_parsed.hostname):242- del headers['Authorization']243-260 # .netrc might have more auth for us on our new host.261 new_auth = get_netrc_auth(url) if self.trust_env else None262 if new_auth is not None:263 prepared_request.prepare_auth(new_auth)46 unmodified lines310 based on certain specs or browser behavior.311 """312 method = prepared_request.method313 298- # http://tools.ietf.org/html/rfc7231#section-6.4.4314+ # https://tools.ietf.org/html/rfc7231#section-6.4.4315 if response.status_code == codes.see_other and method != 'HEAD':316 method = 'GET'317 318 # Do what the browsers do, despite standards...17 unmodified lines336 Basic Usage::337 338 >>> import requests339 >>> s = requests.Session()324- >>> s.get('http://httpbin.org/get')340+ >>> s.get('https://httpbin.org/get')341 <Response [200]>342 343 Or as a context manager::344 345 >>> with requests.Session() as s:330- >>> s.get('http://httpbin.org/get')346+ >>> s.get('https://httpbin.org/get')347 <Response [200]>348 """349 350 __attrs__ = [113 unmodified lines464 :param method: method for the new :class:`Request` object.465 :param url: URL for the new :class:`Request` object.466 :param params: (optional) Dictionary or bytes to be sent in the query467 string for the :class:`Request`.452- :param data: (optional) Dictionary, bytes, or file-like object to send453- in the body of the :class:`Request`.468+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like469+ object to send in the body of the :class:`Request`.470 :param json: (optional) json to send in the body of the471 :class:`Request`.472 :param headers: (optional) Dictionary of HTTP Headers to send with the473 :class:`Request`.87 unmodified lines561 def post(self, url, data=None, json=None, **kwargs):562 r"""Sends a POST request. Returns :class:`Response` object.563 564 :param url: URL for the new :class:`Request` object.549- :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.565+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like566+ object to send in the body of the :class:`Request`.567 :param json: (optional) json to send in the body of the :class:`Request`.568 :param \*\*kwargs: Optional arguments that ``request`` takes.569 :rtype: requests.Response570 """3 unmodified lines574 def put(self, url, data=None, **kwargs):575 r"""Sends a PUT request. Returns :class:`Response` object.576 577 :param url: URL for the new :class:`Request` object.561- :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.578+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like579+ object to send in the body of the :class:`Request`.580 :param \*\*kwargs: Optional arguments that ``request`` takes.581 :rtype: requests.Response582 """583 2 unmodified lines586 def patch(self, url, data=None, **kwargs):587 r"""Sends a PATCH request. Returns :class:`Response` object.588 589 :param url: URL for the new :class:`Request` object.572- :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.590+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like591+ object to send in the body of the :class:`Request`.592 :param \*\*kwargs: Optional arguments that ``request`` takes.593 :rtype: requests.Response594 """595 118 unmodified lines714 :rtype: requests.adapters.BaseAdapter715 """716 for (prefix, adapter) in self.adapters.items():717 699- if url.lower().startswith(prefix):718+ if url.lower().startswith(prefix.lower()):719 return adapter720 721 # Nothing matches :-/722 raise InvalidSchema("No connection adapters were found for '%s'" % url)14 unmodified lines737 for key in keys_to_move:738 self.adapters[key] = self.adapters.pop(key)739 740 def __getstate__(self):722- state = dict((attr, getattr(self, attr, None)) for attr in self.__attrs__)741+ state = {attr: getattr(self, attr, None) for attr in self.__attrs__}742 return state743 744 def __setstate__(self, state):745 for attr, value in state.items():3 unmodified lines749 def session():750 """751 Returns a :class:`Session` for context-management.752 753+ .. deprecated:: 1.0.0754+755+ This method has been deprecated since version 1.0.0 and is only kept for756+ backwards compatibility. New code should use :class:`~requests.sessions.Session`757+ to create a session. This may be removed at a future date.758+759 :rtype: Session760 """736-761 return Session()modified:requests/status_codes.py+34 added-5 removed
1 # -*- coding: utf-8 -*-2 3+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+8+>>> requests.codes['temporary_redirect']9+30710+>>> requests.codes.teapot11+41812+>>> requests.codes['\o/']13+20014+15+Some codes have multiple names, and both upper- and lower-case versions of16+the names are allowed. For example, ``codes.ok``, ``codes.OK``, and17+``codes.okay`` all correspond to the HTTP status code 200.18+"""19+20 from .structures import LookupDict21 22 _codes = {23 76 unmodified lines100 }101 102 codes = LookupDict(name='status_codes')103 104+def _init():87-for code, titles in _codes.items():88- for title in titles:89- setattr(codes, title, code)90- if not title.startswith(('\\', '/')):91- setattr(codes, title.upper(), code)105+ for code, titles in _codes.items():106+ for title in titles:107+ setattr(codes, title, code)108+ if not title.startswith(('\\', '/')):109+ setattr(codes, title.upper(), code)110+111+ def doc(code):112+ names = ', '.join('``%s``' % n for n in _codes[code])113+ return '* %d: %s' % (code, names)114+115+ global __doc__116+ __doc__ = (__doc__ + '\n' +117+ '\n'.join(doc(code) for code in sorted(_codes))118+ if __doc__ is not None else None)119+120+_init()modified:requests/structures.py+4 added-6 removed
5 unmodified lines6 7 Data structures that power Requests.8 """9 10-import collections10+from .compat import OrderedDict, Mapping, MutableMapping11 12-from .compat import OrderedDict12 14-15-class CaseInsensitiveDict(collections.MutableMapping):13+class CaseInsensitiveDict(MutableMapping):14 """A case-insensitive ``dict``-like object.15 16 Implements all methods and operations of19- ``collections.MutableMapping`` as well as dict's ``copy``. Also17+ ``MutableMapping`` as well as dict's ``copy``. Also18 provides ``lower_items``.19 20 All keys are expected to be strings. The structure remembers the21 case of the last key to be set, and ``iter(instance)``,46 unmodified lines68 in self._store.items()69 )70 71 def __eq__(self, other):74- if isinstance(other, collections.Mapping):72+ if isinstance(other, Mapping):73 other = CaseInsensitiveDict(other)74 else:75 return NotImplemented76 # Compare insensitively27 unmodified linesmodified:requests/utils.py+103 added-32 removed
6 unmodified lines7 This module provides utility functions that are used within Requests8 that are also useful for external consumption.9 """10 11-import cgi11 import codecs13-import collections12 import contextlib13 import io14 import os17-import platform15 import re16 import socket17 import struct18+import sys19+import tempfile20 import warnings21+import zipfile22 23 from .__version__ import __version__24 from . import certs25 # to_native_string is unused here, but imported here for backwards compatibility1 unmodified line27 from .compat import parse_http_list as _parse_list_header28 from .compat import (29 quote, urlparse, bytes, str, OrderedDict, unquote, getproxies,30 proxy_bypass, urlunparse, basestring, integer_types, is_py3,31- proxy_bypass_environment, getproxies_environment)31+ proxy_bypass_environment, getproxies_environment, Mapping)32 from .cookies import cookiejar_from_dict33 from .structures import CaseInsensitiveDict34 from .exceptions import (35 InvalidURL, InvalidHeader, FileModeWarning, UnrewindableBodyError)2 unmodified lines38 39 DEFAULT_CA_BUNDLE_PATH = certs.where()40 41 42-if platform.system() == 'Windows':42+if sys.platform == 'win32':43 # provide a proxy_bypass version on Windows without DNS lookups44 45 def proxy_bypass_registry(host):46- if is_py3:47- import winreg48- else:49- import _winreg as winreg46 try:47+ if is_py3:48+ import winreg49+ else:50+ import _winreg as winreg51+ except ImportError:52+ return False53+54+ try:55 internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,56 r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')57+ # ProxyEnable could be REG_SZ or REG_DWORD, normalizing it53- proxyEnable = winreg.QueryValueEx(internetSettings,54- 'ProxyEnable')[0]58+ proxyEnable = int(winreg.QueryValueEx(internetSettings,59+ 'ProxyEnable')[0])60+ # ProxyOverride is almost always a string61 proxyOverride = winreg.QueryValueEx(internetSettings,62 'ProxyOverride')[0]63 except OSError:64 return False107 unmodified lines172 netrc_path = None173 174 for f in NETRC_FILES:175 try:170- loc = os.path.expanduser('~/{0}'.format(f))176+ loc = os.path.expanduser('~/{}'.format(f))177 except KeyError:178 # os.path.expanduser can fail when $HOME is undefined and173- # getpwuid fails. See http://bugs.python.org/issue20164 &179+ # getpwuid fails. See https://bugs.python.org/issue20164 &180 # https://github.com/requests/requests/issues/1846181 return182 183 if os.path.exists(loc):37 unmodified lines221 name[-1] != '>'):222 return os.path.basename(name)223 224 225+def extract_zipped_paths(path):226+ """Replace nonexistent paths that look like they refer to a member of a zip227+ archive with the location of an extracted copy of the target, or else228+ just return the provided path unchanged.229+ """230+ if os.path.exists(path):231+ # this is already a valid path, no need to do anything further232+ return path233+234+ # find the first valid part of the provided path and treat that as a zip archive235+ # assume the rest of the path is the name of a member in the archive236+ archive, member = os.path.split(path)237+ while archive and not os.path.exists(archive):238+ archive, prefix = os.path.split(archive)239+ member = '/'.join([prefix, member])240+241+ if not zipfile.is_zipfile(archive):242+ return path243+244+ zip_file = zipfile.ZipFile(archive)245+ if member not in zip_file.namelist():246+ return path247+248+ # we have a valid zip archive and a valid member of that archive249+ tmp = tempfile.gettempdir()250+ extracted_path = os.path.join(tmp, *member.split('/'))251+ if not os.path.exists(extracted_path):252+ extracted_path = zip_file.extract(member, path=tmp)253+254+ return extracted_path255+256+257 def from_key_val_list(value):258 """Take an object and test to see if it can be represented as a259 dictionary. Unless it can not be represented as such, return an260 OrderedDict, e.g.,38 unmodified lines299 300 if isinstance(value, (str, bytes, bool, int)):301 raise ValueError('cannot encode objects that are not 2-tuples')302 265- if isinstance(value, collections.Mapping):303+ if isinstance(value, Mapping):304 value = value.items()305 306 return list(value)307 136 unmodified lines444 pragma_re.findall(content) +445 xml_re.findall(content))446 447 448+def _parse_content_type_header(header):449+ """Returns content type and parameters from given header450+451+ :param header: string452+ :return: tuple containing content type and dictionary of453+ parameters454+ """455+456+ tokens = header.split(';')457+ content_type, params = tokens[0].strip(), tokens[1:]458+ params_dict = {}459+ items_to_strip = "\"' "460+461+ for param in params:462+ param = param.strip()463+ if param:464+ key, value = param, True465+ index_of_equals = param.find("=")466+ if index_of_equals != -1:467+ key = param[:index_of_equals].strip(items_to_strip)468+ value = param[index_of_equals + 1:].strip(items_to_strip)469+ params_dict[key.lower()] = value470+ return content_type, params_dict471+472+473 def get_encoding_from_headers(headers):474 """Returns encodings from given HTTP Header Dict.475 476 :param headers: dictionary to extract encoding from.4 unmodified lines481 482 if not content_type:483 return None484 422- content_type, params = cgi.parse_header(content_type)485+ content_type, params = _parse_content_type_header(content_type)486 487 if 'charset' in params:488 return params['charset'].strip("'\"")489 204 unmodified lines694 Returns whether we should bypass proxies or not.695 696 :rtype: bool697 """698+ # Prioritize lowercase environment variables over uppercase699+ # to keep a consistent behaviour with other http projects (curl, wget).700 get_proxy = lambda k: os.environ.get(k) or os.environ.get(k.upper())701 702 # First check whether no_proxy is defined. If it is, check that the URL703 # we're getting isn't in the no_proxy list.704 no_proxy_arg = no_proxy705 if no_proxy is None:706 no_proxy = get_proxy('no_proxy')642- netloc = urlparse(url).netloc707+ parsed = urlparse(url)708 709+ if parsed.hostname is None:710+ # URLs don't always have hostnames, e.g. file:/// urls.711+ return True712+713 if no_proxy:714 # We need to check whether we match here. We need to see if we match646- # the end of the netloc, both with and without the port.715+ # the end of the hostname, both with and without the port.716 no_proxy = (717 host for host in no_proxy.replace(' ', '').split(',') if host718 )719 651- ip = netloc.split(':')[0]652- if is_ipv4_address(ip):720+ if is_ipv4_address(parsed.hostname):721 for proxy_ip in no_proxy:722 if is_valid_cidr(proxy_ip):655- if address_in_network(ip, proxy_ip):723+ if address_in_network(parsed.hostname, proxy_ip):724 return True657- elif ip == proxy_ip:725+ elif parsed.hostname == proxy_ip:726 # If no_proxy ip was defined in plain IP notation instead of cidr notation &727 # matches the IP of the index728 return True729 else:730+ host_with_port = parsed.hostname731+ if parsed.port:732+ host_with_port += ':{}'.format(parsed.port)733+734 for host in no_proxy:663- if netloc.endswith(host) or netloc.split(':')[0].endswith(host):735+ if parsed.hostname.endswith(host) or host_with_port.endswith(host):736 # The URL does match something in no_proxy, so we don't want737 # to apply the proxies on this URL.738 return True739 668- # If the system proxy settings indicate that this URL should be bypassed,669- # don't proxy.670- # The proxy_bypass function is incredibly buggy on OS X in early versions671- # of Python 2.6, so allow this call to fail. Only catch the specific672- # exceptions we've seen, though: this call failing in other ways can reveal673- # legitimate problems.740 with set_environ('no_proxy', no_proxy_arg):741+ # parsed.hostname can be `None` in cases such as a file URI.742 try:676- bypass = proxy_bypass(netloc)743+ bypass = proxy_bypass(parsed.hostname)744 except (TypeError, socket.gaierror):745 bypass = False746 747 if bypass:61 unmodified lines809 })810 811 812 def parse_header_links(value):746- """Return a dict of parsed link headers proxies.813+ """Return a list of parsed link headers proxies.814 815 i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg"816 817 :rtype: list2 unmodified lines820 links = []821 822 replace_chars = ' \'"'823 824+ value = value.strip(replace_chars)825+ if not value:826+ return links827+828 for val in re.split(', *<', value):829 try:830 url, params = val.split(';', 1)831 except ValueError:106 unmodified lines938 try:939 if not pat.match(value):940 raise InvalidHeader("Invalid return character or leading space in header: %s" % name)941 except TypeError:871- raise InvalidHeader("Header value %s must be of type str or bytes, "872- "not %s" % (value, type(value)))942+ raise InvalidHeader("Value for header {%s: %s} must be of type str or "943+ "bytes, not %s" % (name, value, type(value)))944 945 946 def urldefragauth(url):947 """28 unmodified linesmodified:tests/test_help.py-9 removed
5 unmodified lines6 7 from requests.help import info8 9 10-@pytest.mark.skipif(sys.version_info[:2] != (2,6), reason="Only run on Python 2.6")11-def test_system_ssl_py26():12- """OPENSSL_VERSION_NUMBER isn't provided in Python 2.6, verify we don't13- blow up in this case.14- """15- assert info()['system_ssl'] == {'version': ''}16-17-18-@pytest.mark.skipif(sys.version_info < (2,7), reason="Only run on Python 2.7+")10 def test_system_ssl():11 """Verify we're actually setting system_ssl when it should be available."""12 assert info()['system_ssl']['version'] != ''13 18 unmodified linesmodified:tests/test_lowlevel.py+82 added-10 removed
14 unmodified lines15 server = Server.basic_response_server(wait_to_close_event=close_server)16 data = iter([b'a', b'b', b'c'])17 18 with server as (host, port):19- url = 'http://{0}:{1}/'.format(host, port)19+ url = 'http://{}:{}/'.format(host, port)20 r = requests.post(url, data=data, stream=True)21 close_server.set() # release server block22 23 assert r.status_code == 20052 unmodified lines76 close_server = threading.Event()77 server = Server(digest_response_handler, wait_to_close_event=close_server)78 79 with server as (host, port):80- url = 'http://{0}:{1}/'.format(host, port)80+ url = 'http://{}:{}/'.format(host, port)81 r = requests.get(url, auth=auth)82 # Verify server succeeded in authenticating.83 assert r.status_code == 20084 # Verify Authorization was sent in final request.41 unmodified lines126 close_server = threading.Event()127 server = Server(digest_failed_response_handler, wait_to_close_event=close_server)128 129 with server as (host, port):130- url = 'http://{0}:{1}/'.format(host, port)130+ url = 'http://{}:{}/'.format(host, port)131 r = requests.get(url, auth=auth)132 # Verify server didn't authenticate us.133 assert r.status_code == 401134 assert r.history[0].status_code == 40128 unmodified lines163 close_server = threading.Event()164 server = Server(digest_response_handler, wait_to_close_event=close_server)165 166 with server as (host, port):167- url = 'http://{0}:{1}/'.format(host, port)167+ url = 'http://{}:{}/'.format(host, port)168 r = requests.get(url, auth=auth)169 # Verify server didn't receive auth from us.170 assert r.status_code == 200171 assert len(r.history) == 08 unmodified lines180 181 _proxy_combos = []182 for prefix, schemes in _schemes_by_var_prefix:183 for scheme in schemes:184- _proxy_combos.append(("{0}_proxy".format(prefix), scheme))184+ _proxy_combos.append(("{}_proxy".format(prefix), scheme))185 186 _proxy_combos += [(var.upper(), scheme) for var, scheme in _proxy_combos]187 188 189 @pytest.mark.parametrize("var,scheme", _proxy_combos)190 def test_use_proxy_from_environment(httpbin, var, scheme):191- url = "{0}://httpbin.org".format(scheme)191+ url = "{}://httpbin.org".format(scheme)192 fake_proxy = Server() # do nothing with the requests; just close the socket193 with fake_proxy as (host, port):194- proxy_url = "socks5://{0}:{1}".format(host, port)194+ proxy_url = "socks5://{}:{}".format(host, port)195 kwargs = {var: proxy_url}196 with override_environ(**kwargs):197 # fake proxy's lack of response will cause a ConnectionError198 with pytest.raises(requests.exceptions.ConnectionError):12 unmodified lines211 redirect_request = [] # stores the second request to the server212 213 def redirect_resp_handler(sock):214 consume_socket_content(sock, timeout=0.5)215- location = u'//{0}:{1}/{2}'.format(host, port, path)215+ location = u'//{}:{}/{}'.format(host, port, path)216 sock.send(217 b'HTTP/1.1 301 Moved Permanently\r\n'218 b'Content-Length: 0\r\n'219 b'Location: ' + location.encode('utf8') + b'\r\n'5 unmodified lines225 close_server = threading.Event()226 server = Server(redirect_resp_handler, wait_to_close_event=close_server)227 228 with server as (host, port):229- url = u'http://{0}:{1}'.format(host, port)229+ url = u'http://{}:{}'.format(host, port)230 r = requests.get(url=url, allow_redirects=True)231 assert r.status_code == 200232 assert len(r.history) == 1233 assert r.history[0].status_code == 301234 assert redirect_request[0].startswith(b'GET /' + expected_path + b' HTTP/1.1')235- assert r.url == u'{0}/{1}'.format(url, expected_path.decode('ascii'))235+ assert r.url == u'{}/{}'.format(url, expected_path.decode('ascii'))236 237 close_server.set()238+239+def test_fragment_not_sent_with_request():240+ """Verify that the fragment portion of a URI isn't sent to the server."""241+ def response_handler(sock):242+ req = consume_socket_content(sock, timeout=0.5)243+ sock.send(244+ b'HTTP/1.1 200 OK\r\n'245+ b'Content-Length: '+bytes(len(req))+b'\r\n'246+ b'\r\n'+req247+ )248+249+ close_server = threading.Event()250+ server = Server(response_handler, wait_to_close_event=close_server)251+252+ with server as (host, port):253+ url = 'http://{}:{}/path/to/thing/#view=edit&token=hunter2'.format(host, port)254+ r = requests.get(url)255+ raw_request = r.content256+257+ assert r.status_code == 200258+ headers, body = raw_request.split(b'\r\n\r\n', 1)259+ status_line, headers = headers.split(b'\r\n', 1)260+261+ assert status_line == b'GET /path/to/thing/ HTTP/1.1'262+ for frag in (b'view', b'edit', b'token', b'hunter2'):263+ assert frag not in headers264+ assert frag not in body265+266+ close_server.set()267+268+def test_fragment_update_on_redirect():269+ """Verify we only append previous fragment if one doesn't exist on new270+ location. If a new fragment is encountered in a Location header, it should271+ be added to all subsequent requests.272+ """273+274+ def response_handler(sock):275+ consume_socket_content(sock, timeout=0.5)276+ sock.send(277+ b'HTTP/1.1 302 FOUND\r\n'278+ b'Content-Length: 0\r\n'279+ b'Location: /get#relevant-section\r\n\r\n'280+ )281+ consume_socket_content(sock, timeout=0.5)282+ sock.send(283+ b'HTTP/1.1 302 FOUND\r\n'284+ b'Content-Length: 0\r\n'285+ b'Location: /final-url/\r\n\r\n'286+ )287+ consume_socket_content(sock, timeout=0.5)288+ sock.send(289+ b'HTTP/1.1 200 OK\r\n\r\n'290+ )291+292+ close_server = threading.Event()293+ server = Server(response_handler, wait_to_close_event=close_server)294+295+ with server as (host, port):296+ url = 'http://{}:{}/path/to/thing/#view=edit&token=hunter2'.format(host, port)297+ r = requests.get(url)298+ raw_request = r.content299+300+ assert r.status_code == 200301+ assert len(r.history) == 2302+ assert r.history[0].request.url == url303+304+ # Verify we haven't overwritten the location with our previous fragment.305+ assert r.history[1].request.url == 'http://{}:{}/get#relevant-section'.format(host, port)306+ # Verify previous fragment is used and not the original.307+ assert r.url == 'http://{}:{}/final-url/#relevant-section'.format(host, port)308+309+ close_server.set()modified:tests/test_requests.py+189 added-68 removed
21 unmodified lines22 cookiejar_from_dict, morsel_to_cookie)23 from requests.exceptions import (24 ConnectionError, ConnectTimeout, InvalidSchema, InvalidURL,25 MissingSchema, ReadTimeout, Timeout, RetryError, TooManyRedirects,26- ProxyError, InvalidHeader, UnrewindableBodyError, SSLError)26+ ProxyError, InvalidHeader, UnrewindableBodyError, SSLError, InvalidProxyURL)27 from requests.models import PreparedRequest28 from requests.structures import CaseInsensitiveDict29 from requests.sessions import SessionRedirectMixin30 from requests.models import urlencode31 from requests.hooks import default_hooks32+from requests.compat import MutableMapping33 34 from .compat import StringIO, u35 from .utils import override_environ36 from urllib3.util import Timeout as Urllib3Timeout17 unmodified lines54 55 56 class TestRequests:57 58+ digest_auth_algo = ('MD5', 'SHA-256', 'SHA-512')59+60 def test_entry_points(self):61 62 requests.session63 requests.session().get93 unmodified lines157 parts = urlparse(httpbin('get'))158 url = scheme + parts.netloc + parts.path159 r = requests.Request('GET', url)160 r = s.send(r.prepare())158- assert r.status_code == 200, 'failed for scheme {0}'.format(scheme)161+ assert r.status_code == 200, 'failed for scheme {}'.format(scheme)162 163 def test_HTTP_200_OK_GET_ALTERNATIVE(self, httpbin):164 r = requests.Request('GET', httpbin('get'))165 s = requests.Session()130 unmodified lines296 assert next_resp.request.body is None297 for header in purged_headers:298 assert header not in next_resp.request.headers299 300+ def test_fragment_maintained_on_redirect(self, httpbin):301+ fragment = "#view=edit&token=hunter2"302+ r = requests.get(httpbin('redirect-to?url=get')+fragment)303+304+ assert len(r.history) > 0305+ assert r.history[0].request.url == httpbin('redirect-to?url=get')+fragment306+ assert r.url == httpbin('get')+fragment307+308 def test_HTTP_200_OK_GET_WITH_PARAMS(self, httpbin):309 heads = {'User-agent': 'Mozilla/5.0'}310 311 r = requests.get(httpbin('user-agent'), headers=heads)224 unmodified lines536 # any proxy related error (address resolution, no route to host, etc) should result in a ProxyError537 with pytest.raises(ProxyError):538 requests.get('http://localhost:1', proxies={'http': 'non-resolvable-address'})539 540+ def test_proxy_error_on_bad_url(self, httpbin, httpbin_secure):541+ with pytest.raises(InvalidProxyURL):542+ requests.get(httpbin_secure(), proxies={'https': 'http:/badproxyurl:3128'})543+544+ with pytest.raises(InvalidProxyURL):545+ requests.get(httpbin(), proxies={'http': 'http://:8080'})546+547+ with pytest.raises(InvalidProxyURL):548+ requests.get(httpbin_secure(), proxies={'https': 'https://'})549+550+ with pytest.raises(InvalidProxyURL):551+ requests.get(httpbin(), proxies={'http': 'http:///example.com:8080'})552+553 def test_basicauth_with_netrc(self, httpbin):554 auth = ('user', 'pass')555 wrong_auth = ('wronguser', 'wrongpass')556 url = httpbin('basic-auth', 'user', 'pass')27 unmodified lines584 requests.sessions.get_netrc_auth = old_auth585 586 def test_DIGEST_HTTP_200_OK_GET(self, httpbin):587 588+ for authtype in self.digest_auth_algo:564- auth = HTTPDigestAuth('user', 'pass')565- url = httpbin('digest-auth', 'auth', 'user', 'pass')589+ auth = HTTPDigestAuth('user', 'pass')590+ url = httpbin('digest-auth', 'auth', 'user', 'pass', authtype, 'never')591 567- r = requests.get(url, auth=auth)568- assert r.status_code == 200592+ r = requests.get(url, auth=auth)593+ assert r.status_code == 200594 570- r = requests.get(url)571- assert r.status_code == 401595+ r = requests.get(url)596+ assert r.status_code == 401597+ print(r.headers['WWW-Authenticate'])598 573- s = requests.session()574- s.auth = HTTPDigestAuth('user', 'pass')575- r = s.get(url)576- assert r.status_code == 200599+ s = requests.session()600+ s.auth = HTTPDigestAuth('user', 'pass')601+ r = s.get(url)602+ assert r.status_code == 200603 604 def test_DIGEST_AUTH_RETURNS_COOKIE(self, httpbin):579- url = httpbin('digest-auth', 'auth', 'user', 'pass')580- auth = HTTPDigestAuth('user', 'pass')581- r = requests.get(url)582- assert r.cookies['fake'] == 'fake_value'605 584- r = requests.get(url, auth=auth)585- assert r.status_code == 200606+ for authtype in self.digest_auth_algo:607+ url = httpbin('digest-auth', 'auth', 'user', 'pass', authtype)608+ auth = HTTPDigestAuth('user', 'pass')609+ r = requests.get(url)610+ assert r.cookies['fake'] == 'fake_value'611 612+ r = requests.get(url, auth=auth)613+ assert r.status_code == 200614+615 def test_DIGEST_AUTH_SETS_SESSION_COOKIES(self, httpbin):588- url = httpbin('digest-auth', 'auth', 'user', 'pass')589- auth = HTTPDigestAuth('user', 'pass')590- s = requests.Session()591- s.get(url, auth=auth)592- assert s.cookies['fake'] == 'fake_value'616 617+ for authtype in self.digest_auth_algo:618+ url = httpbin('digest-auth', 'auth', 'user', 'pass', authtype)619+ auth = HTTPDigestAuth('user', 'pass')620+ s = requests.Session()621+ s.get(url, auth=auth)622+ assert s.cookies['fake'] == 'fake_value'623+624 def test_DIGEST_STREAM(self, httpbin):625 626+ for authtype in self.digest_auth_algo:596- auth = HTTPDigestAuth('user', 'pass')597- url = httpbin('digest-auth', 'auth', 'user', 'pass')627+ auth = HTTPDigestAuth('user', 'pass')628+ url = httpbin('digest-auth', 'auth', 'user', 'pass', authtype)629 599- r = requests.get(url, auth=auth, stream=True)600- assert r.raw.read() != b''630+ r = requests.get(url, auth=auth, stream=True)631+ assert r.raw.read() != b''632 602- r = requests.get(url, auth=auth, stream=False)603- assert r.raw.read() == b''633+ r = requests.get(url, auth=auth, stream=False)634+ assert r.raw.read() == b''635 636 def test_DIGESTAUTH_WRONG_HTTP_401_GET(self, httpbin):637 638+ for authtype in self.digest_auth_algo:607- auth = HTTPDigestAuth('user', 'wrongpass')608- url = httpbin('digest-auth', 'auth', 'user', 'pass')639+ auth = HTTPDigestAuth('user', 'wrongpass')640+ url = httpbin('digest-auth', 'auth', 'user', 'pass', authtype)641 610- r = requests.get(url, auth=auth)611- assert r.status_code == 401642+ r = requests.get(url, auth=auth)643+ assert r.status_code == 401644 613- r = requests.get(url)614- assert r.status_code == 401645+ r = requests.get(url)646+ assert r.status_code == 401647 616- s = requests.session()617- s.auth = auth618- r = s.get(url)619- assert r.status_code == 401648+ s = requests.session()649+ s.auth = auth650+ r = s.get(url)651+ assert r.status_code == 401652 653 def test_DIGESTAUTH_QUOTES_QOP_VALUE(self, httpbin):654 655+ for authtype in self.digest_auth_algo:623- auth = HTTPDigestAuth('user', 'pass')624- url = httpbin('digest-auth', 'auth', 'user', 'pass')656+ auth = HTTPDigestAuth('user', 'pass')657+ url = httpbin('digest-auth', 'auth', 'user', 'pass', authtype)658 626- r = requests.get(url, auth=auth)627- assert '"auth"' in r.request.headers['Authorization']659+ r = requests.get(url, auth=auth)660+ assert '"auth"' in r.request.headers['Authorization']661 662 def test_POSTBIN_GET_POST_FILES(self, httpbin):663 664 url = httpbin('post')1 unmodified line666 667 post1 = requests.post(url, data={'some': 'data'})668 assert post1.status_code == 200669 637- with open('requirements.txt') as f:670+ with open('Pipfile') as f:671 post2 = requests.post(url, files={'some': f})672 assert post2.status_code == 200673 674 post4 = requests.post(url, data='[{"some": "json"}]')1 unmodified line676 677 with pytest.raises(ValueError):678 requests.post(url, files=['bad file data'])679 680+ def test_invalid_files_input(self, httpbin):681+682+ url = httpbin('post')683+ post = requests.post(url,684+ files={"random-file-1": None, "random-file-2": 1})685+ assert b'name="random-file-1"' not in post.request.body686+ assert b'name="random-file-2"' in post.request.body687+688 def test_POSTBIN_SEEKED_OBJECT_WITH_NO_ITER(self, httpbin):689 690 class TestStream(object):691 def __init__(self, data):42 unmodified lines734 735 post1 = requests.post(url, data={'some': 'data'})736 assert post1.status_code == 200737 697- with open('requirements.txt') as f:738+ with open('Pipfile') as f:739 post2 = requests.post(url, data={'some': 'data'}, files={'some': f})740 assert post2.status_code == 200741 742 post4 = requests.post(url, data='[{"some": "json"}]')2 unmodified lines745 with pytest.raises(ValueError):746 requests.post(url, files=['bad file data'])747 748 def test_post_with_custom_mapping(self, httpbin):708- class CustomMapping(collections.MutableMapping):749+ class CustomMapping(MutableMapping):750 def __init__(self, *args, **kwargs):751 self.data = dict(*args, **kwargs)752 753 def __delitem__(self, key):17 unmodified lines771 assert found_json == {'some': 'data'}772 773 def test_conflicting_post_params(self, httpbin):774 url = httpbin('post')734- with open('requirements.txt') as f:775+ with open('Pipfile') as f:776 pytest.raises(ValueError, "requests.post(url, data='[{\"some\": \"data\"}]', files={'some': f})")777 pytest.raises(ValueError, "requests.post(url, data=u('[{\"some\": \"data\"}]'), files={'some': f})")778 779 def test_request_ok_set(self, httpbin):35 unmodified lines815 def test_invalid_ca_certificate_path(self, httpbin_secure):816 INVALID_PATH = '/garbage'817 with pytest.raises(IOError) as e:818 requests.get(httpbin_secure(), verify=INVALID_PATH)778- assert str(e.value) == 'Could not find a suitable TLS CA certificate bundle, invalid path: {0}'.format(INVALID_PATH)819+ assert str(e.value) == 'Could not find a suitable TLS CA certificate bundle, invalid path: {}'.format(INVALID_PATH)820 821 def test_invalid_ssl_certificate_files(self, httpbin_secure):822 INVALID_PATH = '/garbage'823 with pytest.raises(IOError) as e:824 requests.get(httpbin_secure(), cert=INVALID_PATH)784- assert str(e.value) == 'Could not find the TLS certificate file, invalid path: {0}'.format(INVALID_PATH)825+ assert str(e.value) == 'Could not find the TLS certificate file, invalid path: {}'.format(INVALID_PATH)826 827 with pytest.raises(IOError) as e:828 requests.get(httpbin_secure(), cert=('.', INVALID_PATH))788- assert str(e.value) == 'Could not find the TLS key file, invalid path: {0}'.format(INVALID_PATH)829+ assert str(e.value) == 'Could not find the TLS key file, invalid path: {}'.format(INVALID_PATH)830 831 def test_http_with_certificate(self, httpbin):832 r = requests.get(httpbin(), cert='.')833 assert r.status_code == 20029 unmodified lines863 requests.get(httpbin_secure('status', '200'))864 865 def test_urlencoded_get_query_multivalued_param(self, httpbin):866 826- r = requests.get(httpbin('get'), params=dict(test=['foo', 'baz']))867+ r = requests.get(httpbin('get'), params={'test': ['foo', 'baz']})868 assert r.status_code == 200869 assert r.url == httpbin('get?test=foo&test=baz')870 871+ def test_form_encoded_post_query_multivalued_element(self, httpbin):872+ r = requests.Request(method='POST', url=httpbin('post'),873+ data=dict(test=['foo', 'baz']))874+ prep = r.prepare()875+ assert prep.body == 'test=foo&test=baz'876+877 def test_different_encodings_dont_break_post(self, httpbin):878 r = requests.post(httpbin('post'),879 data={'stuff': json.dumps({'a': 123})},880 params={'blah': 'asdf1234'},296 unmodified lines1177 jar.set(key, value)1178 with pytest.raises(requests.cookies.CookieConflictError):1179 jar.get(key)1180 1181+ def test_cookie_policy_copy(self):1182+ class MyCookiePolicy(cookielib.DefaultCookiePolicy):1183+ pass1184+1185+ jar = requests.cookies.RequestsCookieJar()1186+ jar.set_policy(MyCookiePolicy())1187+ assert isinstance(jar.copy().get_policy(), MyCookiePolicy)1188+1189 def test_time_elapsed_blank(self, httpbin):1190 r = requests.get(httpbin('get'))1191 td = r.elapsed1192 total_seconds = ((td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6)212 unmodified lines1405 s2.mount('https://', HTTPAdapter())1406 assert 'http://' in s2.adapters1407 assert 'https://' in s2.adapters1408 1409+ def test_session_get_adapter_prefix_matching(self):1410+ prefix = 'https://example.com'1411+ more_specific_prefix = prefix + '/some/path'1412+1413+ url_matching_only_prefix = prefix + '/another/path'1414+ url_matching_more_specific_prefix = more_specific_prefix + '/longer/path'1415+ url_not_matching_prefix = 'https://another.example.com/'1416+1417+ s = requests.Session()1418+ prefix_adapter = HTTPAdapter()1419+ more_specific_prefix_adapter = HTTPAdapter()1420+ s.mount(prefix, prefix_adapter)1421+ s.mount(more_specific_prefix, more_specific_prefix_adapter)1422+1423+ assert s.get_adapter(url_matching_only_prefix) is prefix_adapter1424+ assert s.get_adapter(url_matching_more_specific_prefix) is more_specific_prefix_adapter1425+ assert s.get_adapter(url_not_matching_prefix) not in (prefix_adapter, more_specific_prefix_adapter)1426+1427+ def test_session_get_adapter_prefix_matching_mixed_case(self):1428+ mixed_case_prefix = 'hTtPs://eXamPle.CoM/MixEd_CAse_PREfix'1429+ url_matching_prefix = mixed_case_prefix + '/full_url'1430+1431+ s = requests.Session()1432+ my_adapter = HTTPAdapter()1433+ s.mount(mixed_case_prefix, my_adapter)1434+1435+ assert s.get_adapter(url_matching_prefix) is my_adapter1436+1437+ def test_session_get_adapter_prefix_matching_is_case_insensitive(self):1438+ mixed_case_prefix = 'hTtPs://eXamPle.CoM/MixEd_CAse_PREfix'1439+ url_matching_prefix_with_different_case = 'HtTpS://exaMPLe.cOm/MiXeD_caSE_preFIX/another_url'1440+1441+ s = requests.Session()1442+ my_adapter = HTTPAdapter()1443+ s.mount(mixed_case_prefix, my_adapter)1444+1445+ assert s.get_adapter(url_matching_prefix_with_different_case) is my_adapter1446+1447 def test_header_remove_is_case_insensitive(self, httpbin):1448 # From issue #13211449 s = requests.Session()1450 s.headers['foo'] = 'bar'6 unmodified lines1457 r = s.get(httpbin('get'), params={'FOO': 'bar'})1458 assert r.json()['args'] == {'foo': 'bar', 'FOO': 'bar'}1459 1460 def test_long_authinfo_in_url(self):1368- url = 'http://{0}:{1}@{2}:9000/path?query#frag'.format(1461+ url = 'http://{}:{}@{}:9000/path?query#frag'.format(1462 'E8A3BE87-9E3F-4620-8858-95478E385B5B',1463 'EA770032-DA4D-4D84-8CE9-29C6D910BF1E',1464 'exactly-------------sixty-----------three------------characters',1465 )27 unmodified lines1493 headers_dict = {'bar': {'foo': 'bar'}}1494 headers_list = {'baz': ['foo', 'bar']}1495 1496 # Test for int1404- with pytest.raises(InvalidHeader):1497+ with pytest.raises(InvalidHeader) as excinfo:1498 r = requests.get(httpbin('get'), headers=headers_int)1499+ assert 'foo' in str(excinfo.value)1500 # Test for dict1407- with pytest.raises(InvalidHeader):1501+ with pytest.raises(InvalidHeader) as excinfo:1502 r = requests.get(httpbin('get'), headers=headers_dict)1503+ assert 'bar' in str(excinfo.value)1504 # Test for list1410- with pytest.raises(InvalidHeader):1505+ with pytest.raises(InvalidHeader) as excinfo:1506 r = requests.get(httpbin('get'), headers=headers_list)1507+ assert 'baz' in str(excinfo.value)1508 1509 def test_header_no_return_chars(self, httpbin):1510 """Ensure that a header containing return character sequences raise an1511 exception. Otherwise, multiple headers are created from single string.60 unmodified lines1572 req = requests.Request('GET', test_url)1573 preq = req.prepare()1574 assert test_url == preq.url1575 1480- @pytest.mark.xfail(raises=ConnectionError)1481- def test_auth_is_stripped_on_redirect_off_host(self, httpbin):1576+ def test_auth_is_stripped_on_http_downgrade(self, httpbin, httpbin_secure, httpbin_ca_bundle):1577 r = requests.get(1483- httpbin('redirect-to'),1484- params={'url': 'http://www.google.co.uk'},1578+ httpbin_secure('redirect-to'),1579+ params={'url': httpbin('get')},1580 auth=('user', 'pass'),1581+ verify=httpbin_ca_bundle1582 )1583 assert r.history[0].request.headers['Authorization']1488- assert not r.request.headers.get('Authorization', '')1584+ assert 'Authorization' not in r.request.headers1585 1586 def test_auth_is_retained_for_redirect_on_host(self, httpbin):1587 r = requests.get(httpbin('redirect/1'), auth=('user', 'pass'))1588 h1 = r.history[0].request.headers['Authorization']1589 h2 = r.request.headers['Authorization']1590 1591 assert h1 == h21592 1593+ def test_should_strip_auth_host_change(self):1594+ s = requests.Session()1595+ assert s.should_strip_auth('http://example.com/foo', 'http://another.example.com/')1596+1597+ def test_should_strip_auth_http_downgrade(self):1598+ s = requests.Session()1599+ assert s.should_strip_auth('https://example.com/foo', 'http://example.com/bar')1600+1601+ def test_should_strip_auth_https_upgrade(self):1602+ s = requests.Session()1603+ assert not s.should_strip_auth('http://example.com/foo', 'https://example.com/bar')1604+ assert not s.should_strip_auth('http://example.com:80/foo', 'https://example.com/bar')1605+ assert not s.should_strip_auth('http://example.com/foo', 'https://example.com:443/bar')1606+ # Non-standard ports should trigger stripping1607+ assert s.should_strip_auth('http://example.com:8080/foo', 'https://example.com/bar')1608+ assert s.should_strip_auth('http://example.com/foo', 'https://example.com:8443/bar')1609+1610+ def test_should_strip_auth_port_change(self):1611+ s = requests.Session()1612+ assert s.should_strip_auth('http://example.com:1234/foo', 'https://example.com:4321/bar')1613+1614 def test_manual_redirect_with_partial_body_read(self, httpbin):1615 s = requests.Session()1616 r1 = s.get(httpbin('redirect/2'), allow_redirects=False, stream=True)1617 assert r1.is_redirect13 unmodified lines1631 assert not r3.is_redirect1632 1633 def test_prepare_body_position_non_stream(self):1634 data = b'the data'1518- s = requests.Session()1635 prep = requests.Request('GET', 'http://example.com', data=data).prepare()1636 assert prep._body_position is None1637 1638 def test_rewind_body(self):1639 data = io.BytesIO(b'the data')1524- s = requests.Session()1640 prep = requests.Request('GET', 'http://example.com', data=data).prepare()1641 assert prep._body_position == 01642 assert prep.body.read() == b'the data'1643 5 unmodified lines1649 assert prep.body.read() == b'the data'1650 1651 def test_rewind_partially_read_body(self):1652 data = io.BytesIO(b'the data')1538- s = requests.Session()1653 data.read(4) # read some data1654 prep = requests.Request('GET', 'http://example.com', data=data).prepare()1655 assert prep._body_position == 41656 assert prep.body.read() == b'data'16 unmodified lines1673 def __iter__(self):1674 return1675 1676 data = BadFileObj('the data')1563- s = requests.Session()1677 prep = requests.Request('GET', 'http://example.com', data=data).prepare()1678 assert prep._body_position == 01679 1680 with pytest.raises(UnrewindableBodyError) as e:15 unmodified lines1696 def __iter__(self):1697 return1698 1699 data = BadFileObj('the data')1587- s = requests.Session()1700 prep = requests.Request('GET', 'http://example.com', data=data).prepare()1701 assert prep._body_position == 01702 1703 with pytest.raises(UnrewindableBodyError) as e:12 unmodified lines1716 def __iter__(self):1717 return1718 1719 data = BadFileObj('the data')1608- s = requests.Session()1720 prep = requests.Request('GET', 'http://example.com', data=data).prepare()1721 assert prep._body_position is not None1722 1723 with pytest.raises(UnrewindableBodyError) as e:97 unmodified lines1821 session.close()1822 proxies['one'].clear.assert_called_once_with()1823 proxies['two'].clear.assert_called_once_with()1824 1714- def test_proxy_auth(self, httpbin):1825+ def test_proxy_auth(self):1826 adapter = HTTPAdapter()1827 headers = adapter.proxy_headers("http://user:pass@httpbin.org")1828 assert headers == {'Proxy-Authorization': 'Basic dXNlcjpwYXNz'}1829 1719- def test_proxy_auth_empty_pass(self, httpbin):1830+ def test_proxy_auth_empty_pass(self):1831 adapter = HTTPAdapter()1832 headers = adapter.proxy_headers("http://user:@httpbin.org")1833 assert headers == {'Proxy-Authorization': 'Basic dXNlcjo='}1834 591 unmodified lines2426 with pytest.raises(requests.exceptions.InvalidURL):2427 r.prepare()2428 2429 @pytest.mark.parametrize(2430+ 'url, exception',2431+ (2432+ ('http://localhost:-1', InvalidURL),2433+ )2434+ )2435+ def test_redirecting_to_bad_url(self, httpbin, url, exception):2436+ with pytest.raises(exception):2437+ r = requests.get(httpbin('redirect-to'), params={'url': url})2438+2439+ @pytest.mark.parametrize(2440 'input, expected',2441 (2442 (2443 b"http+unix://%2Fvar%2Frun%2Fsocket/path%7E",64 unmodified linesmodified:tests/test_testserver.py+3 added-3 removed
48 unmodified lines49 "\r\nroflol"50 )51 52 with server as (host, port):53- r = requests.get('http://{0}:{1}'.format(host, port))53+ r = requests.get('http://{}:{}'.format(host, port))54 55 assert r.status_code == 20056 assert r.text == u'roflol'57 assert r.headers['Content-Length'] == '6'58 59 def test_basic_response(self):60 """the basic response server returns an empty http response"""61 with Server.basic_response_server() as (host, port):62- r = requests.get('http://{0}:{1}'.format(host, port))62+ r = requests.get('http://{}:{}'.format(host, port))63 assert r.status_code == 20064 assert r.text == u''65 assert r.headers['Content-Length'] == '0'66 15 unmodified lines82 83 server = Server.basic_response_server(requests_to_handle=requests_to_handle)84 85 with server as (host, port):86- server_url = 'http://{0}:{1}'.format(host, port)86+ server_url = 'http://{}:{}'.format(host, port)87 for _ in range(requests_to_handle):88 r = requests.get(server_url)89 assert r.status_code == 20090 76 unmodified linesmodified:tests/test_utils.py+108 added-6 removed
1 # -*- coding: utf-8 -*-2 3 import os4 import copy5+import filecmp6 from io import BytesIO7+import zipfile8+from collections import deque9 10 import pytest11 from requests import compat12 from requests.cookies import RequestsCookieJar13 from requests.structures import CaseInsensitiveDict14 from requests.utils import (12- address_in_network, dotted_netmask,13- get_auth_from_url, get_encoding_from_headers,15+ address_in_network, dotted_netmask, extract_zipped_paths,16+ get_auth_from_url, _parse_content_type_header, get_encoding_from_headers,17 get_encodings_from_content, get_environ_proxies,18 guess_filename, guess_json_utf, is_ipv4_address,19 is_valid_cidr, iter_slices, parse_dict_header,20 parse_header_links, prepend_scheme_if_needed,237 unmodified lines258 assert result == value259 assert isinstance(result, expected_type)260 261 262+class TestExtractZippedPaths:263+264+ @pytest.mark.parametrize(265+ 'path', (266+ '/',267+ __file__,268+ pytest.__file__,269+ '/etc/invalid/location',270+ ))271+ def test_unzipped_paths_unchanged(self, path):272+ assert path == extract_zipped_paths(path)273+274+ def test_zipped_paths_extracted(self, tmpdir):275+ zipped_py = tmpdir.join('test.zip')276+ with zipfile.ZipFile(zipped_py.strpath, 'w') as f:277+ f.write(__file__)278+279+ _, name = os.path.splitdrive(__file__)280+ zipped_path = os.path.join(zipped_py.strpath, name.lstrip(r'\/'))281+ extracted_path = extract_zipped_paths(zipped_path)282+283+ assert extracted_path != zipped_path284+ assert os.path.exists(extracted_path)285+ assert filecmp.cmp(extracted_path, __file__)286+287+288 class TestContentEncodingDetection:289 290 def test_none(self):291 encodings = get_encodings_from_content('')180 unmodified lines472 473 @pytest.mark.parametrize(474 'value, expected', (475 (476+ 'application/xml',477+ ('application/xml', {})478+ ),479+ (480+ 'application/json ; charset=utf-8',481+ ('application/json', {'charset': 'utf-8'})482+ ),483+ (484+ 'application/json ; Charset=utf-8',485+ ('application/json', {'charset': 'utf-8'})486+ ),487+ (488+ 'text/plain',489+ ('text/plain', {})490+ ),491+ (492+ 'multipart/form-data; boundary = something ; boundary2=\'something_else\' ; no_equals ',493+ ('multipart/form-data', {'boundary': 'something', 'boundary2': 'something_else', 'no_equals': True})494+ ),495+ (496+ 'multipart/form-data; boundary = something ; boundary2="something_else" ; no_equals ',497+ ('multipart/form-data', {'boundary': 'something', 'boundary2': 'something_else', 'no_equals': True})498+ ),499+ (500+ 'multipart/form-data; boundary = something ; \'boundary2=something_else\' ; no_equals ',501+ ('multipart/form-data', {'boundary': 'something', 'boundary2': 'something_else', 'no_equals': True})502+ ),503+ (504+ 'multipart/form-data; boundary = something ; "boundary2=something_else" ; no_equals ',505+ ('multipart/form-data', {'boundary': 'something', 'boundary2': 'something_else', 'no_equals': True})506+ ),507+ (508+ 'application/json ; ; ',509+ ('application/json', {})510+ )511+ ))512+def test__parse_content_type_header(value, expected):513+ assert _parse_content_type_header(value) == expected514+515+516+@pytest.mark.parametrize(517+ 'value, expected', (518+ (519 CaseInsensitiveDict(),520 None521 ),522 (46 unmodified lines569 {'url': 'http:/.../front.jpeg', 'type': 'image/jpeg'},570 {'url': 'http://.../back.jpeg'}571 ]572 ),573+ (574+ '',575+ []576+ ),577 ))578 def test_parse_header_links(value, expected):579 assert parse_header_links(value) == expected580 36 unmodified lines617 ('http://192.168.0.1/', True),618 ('http://172.16.1.1/', True),619 ('http://172.16.1.1:5000/', True),620 ('http://localhost.localdomain:5000/v1.0/', True),621+ ('http://google.com:6000/', True),622 ('http://172.16.1.12/', False),623 ('http://172.16.1.12:5000/', False),624 ('http://google.com:5000/v1.0/', False),625+ ('file:///some/path/on/disk', True),626 ))627 def test_should_bypass_proxies(url, expected, monkeypatch):628 """Tests for function should_bypass_proxies to check if proxy629 can be bypassed or not630 """553- monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')554- monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')631+ monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1, google.com:6000')632+ monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1, google.com:6000')633 assert should_bypass_proxies(url, no_proxy=None) == expected634 635 636 @pytest.mark.parametrize(637+ 'url, expected', (638+ ('http://172.16.1.1/', '172.16.1.1'),639+ ('http://172.16.1.1:5000/', '172.16.1.1'),640+ ('http://user:pass@172.16.1.1', '172.16.1.1'),641+ ('http://user:pass@172.16.1.1:5000', '172.16.1.1'),642+ ('http://hostname/', 'hostname'),643+ ('http://hostname:5000/', 'hostname'),644+ ('http://user:pass@hostname', 'hostname'),645+ ('http://user:pass@hostname:5000', 'hostname'),646+ ))647+def test_should_bypass_proxies_pass_only_hostname(url, expected, mocker):648+ """The proxy_bypass function should be called with a hostname or IP without649+ a port number or auth credentials.650+ """651+ proxy_bypass = mocker.patch('requests.utils.proxy_bypass')652+ should_bypass_proxies(url, no_proxy=None)653+ proxy_bypass.assert_called_once_with(expected)654+655+656+@pytest.mark.parametrize(657 'cookiejar', (658 compat.cookielib.CookieJar(),659 RequestsCookieJar()660 ))3 unmodified lines664 """665 cookiedict = {'test': 'cookies',666 'good': 'cookies'}667 cj = add_dict_to_cookiejar(cookiejar, cookiedict)570- cookies = dict((cookie.name, cookie.value) for cookie in cj)668+ cookies = {cookie.name: cookie.value for cookie in cj}669 assert cookiedict == cookies670 671 672 @pytest.mark.parametrize(58 unmodified lines731 def Close(self):732 pass733 734 ie_settings = RegHandle()735+ proxyEnableValues = deque([1, "1"])736 737 def OpenKey(key, subkey):738 return ie_settings739 740 def QueryValueEx(key, value_name):741 if key is ie_settings:742 if value_name == 'ProxyEnable':644- return [1]743+ # this could be a string (REG_SZ) or a 32-bit number (REG_DWORD)744+ proxyEnableValues.rotate()745+ return [proxyEnableValues[0]]746 elif value_name == 'ProxyOverride':747 return [override]748 749 monkeypatch.setenv('http_proxy', '')2 unmodified lines752 monkeypatch.setenv('no_proxy', '')753 monkeypatch.setenv('NO_PROXY', '')754 monkeypatch.setattr(winreg, 'OpenKey', OpenKey)755 monkeypatch.setattr(winreg, 'QueryValueEx', QueryValueEx)756+ assert should_bypass_proxies(url, None) == expected757 758 759 @pytest.mark.parametrize(760 'env_name, value', (22 unmodified linesmodified:.gitignore+2 added
19 unmodified lines20 t.py21 22 t2.py23 dist24+25+/.mypy_cache/modified:.travis.yml+24 added-14 removed
1 sudo: false2 language: python3-python:4- - "2.6"5- - "2.7"6- - "3.3"7- - "3.4"8- - "3.5"9- - "3.6"10- # - "3.7-dev"11- # - "pypy" -- appears to hang12- # - "pypy3"3 # command to install dependencies4 install: "make"5 # command to run tests6 script:4 unmodified lines11 jobs:12 include:13 - stage: test14 script:25- - |26- if [[ "$TRAVIS_PYTHON_VERSION" != "2.6" ]] ; then make test-readme; fi15+ - make test-readme16 - make ci17+ python: '2.7'18+ - stage: test19+ script:20+ - make test-readme21+ - make ci22+ python: '3.4'23+ - stage: test24+ script:25+ - make test-readme26+ - make ci27+ python: '3.5'28+ - stage: test29+ script:30+ - make test-readme31+ - make ci32+ python: '3.6'33+ - stage: test34+ script:35+ - make test-readme36+ - make ci37+ python: '3.7'38+ dist: xenial39+ sudo: true 40 - stage: coverage41 python: 3.642 script: codecov31-32-modified:appveyor.yml+10 added-9 removed
1 # AppVeyor.yml from https://github.com/ogrisel/python-appveyor-demo2-# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/2+# License: CC0 1.0 Universal: https://creativecommons.org/publicdomain/zero/1.0/3 4 build: off5 6 environment:2 unmodified lines9 PYTHON_VERSION: "2.7.x"10 PYTHON_ARCH: "64"11 TOXENV: "py27"12 13- - PYTHON: "C:\\Python33-x64"14- PYTHON_VERSION: "3.3.x"15- PYTHON_ARCH: "64"16- TOXENV: "py33"17-13 - PYTHON: "C:\\Python34-x64"14 PYTHON_VERSION: "3.4.x"15 PYTHON_ARCH: "64"16 TOXENV: "py34"7 unmodified lines24 PYTHON_VERSION: "3.6.x"25 PYTHON_ARCH: "64"26 TOXENV: "py36"27 28+ - PYTHON: "C:\\Python37-x64"29+ PYTHON_VERSION: "3.7.x"30+ PYTHON_ARCH: "64"31+ TOXENV: "py37"32+33 install:34- # Install Python (from the official .msi of http://python.org) and pip when34+ # Install Python (from the official .msi of https://www.python.org/) and pip when35 # not already installed.36 - ps: if (-not(Test-Path($env:PYTHON))) { & _appveyor\install.ps1 }37 38 # Prepend newly installed Python to the PATH of this build (this cannot be6 unmodified lines45 - "python -c \"import struct; print(struct.calcsize('P') * 8)\""46 47 # Upgrade to the latest version of pip to avoid it displaying warnings48 # about it being out of date.49- - "pip install --disable-pip-version-check --user --upgrade pip"49+ - "python -m pip install --upgrade pip wheel"50 - "C:\\MinGW\\bin\\mingw32-make"51+ - "pipenv install -e .[socks] --skip-lock"52 53 test_script:54 - "C:\\MinGW\\bin\\mingw32-make coverage"55 56 on_success:56- - "codecov -f coverage.xml"57+ - "pipenv run codecov -f coverage.xml"modified:AUTHORS.rst+16 added-5 removed
1 Requests is written and maintained by Kenneth Reitz and2 various contributors:3 4-Keepers of the Four Crystals5-````````````````````````````4+Keepers of the Crystals5+```````````````````````6 7 - Kenneth Reitz <me@kennethreitz.org> `@kennethreitz <https://github.com/kennethreitz>`_, Keeper of the Master Crystal.8+- Ian Cordasco <graffatcolmingov@gmail.com> `@sigmavirus24 <https://github.com/sigmavirus24>`_.9+- Nate Prewitt <nate.prewitt@gmail.com> `@nateprewitt <https://github.com/nateprewitt>`_.10+11+Previous Keepers of Crystals12+````````````````````````````13+14 - Cory Benfield <cory@lukasa.co.uk> `@lukasa <https://github.com/lukasa>`_9-- Ian Cordasco <graffatcolmingov@gmail.com> `@sigmavirus24 <https://github.com/sigmavirus24>`_10-- Nate Prewitt <nate.prewitt@gmail.com> `@nateprewitt <https://github.com/nateprewitt>`_15 16 17 Patches and Suggestions18 ```````````````````````105 unmodified lines124 - Dmitry Medvinsky <me@dmedvinsky.name>125 - Bryce Boe <bbzbryce@gmail.com> (`@bboe <https://github.com/bboe>`_)126 - Colin Dunklau <colin.dunklau@gmail.com> (`@cdunklau <https://github.com/cdunklau>`_)127 - Bob Carroll <bob.carroll@alum.rit.edu> (`@rcarz <https://github.com/rcarz>`_)124-- Hugo Osvaldo Barrera <hugo@osvaldobarrera.com.ar> (`@hobarrera <https://github.com/hobarrera>`_)128+- Hugo Osvaldo Barrera <hugo@barrera.io> (`@hobarrera <https://github.com/hobarrera>`_)129 - Łukasz Langa <lukasz@langa.pl>130 - Dave Shawley <daveshawley@gmail.com>131 - James Clarke (`@jam <https://github.com/jam>`_)132 - Kevin Burke <kev@inburke.com>48 unmodified lines181 - Gary Wu (`@garywu <https://github.com/garywu>`_)182 - Ryan Pineo (`@ryanpineo <https://github.com/ryanpineo>`_)183 - Ed Morley (`@edmorley <https://github.com/edmorley>`_)184 - Matt Liu <liumatt@gmail.com> (`@mlcrazy <https://github.com/mlcrazy>`_)185+- Taylor Hoff <primdevs@protonmail.com> (`@PrimordialHelios <https://github.com/PrimordialHelios>`_)186+- Arthur Vigil (`@ahvigil <https://github.com/ahvigil>`_)187+- Nehal J Wani (`@nehaljwani <https://github.com/nehaljwani>`_)188+- 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>`_)added:HISTORY.md+1623 added
1+Release History2+===============3+4+dev5+---6+7+**Bugfixes**8+9+- \[Short description of non-trivial change.\]10+11+2.20.0 (2018-10-18)12+-------------------13+14+**Bugfixes**15+16+- Content-Type header parsing is now case-insensitive (e.g.17+ charset=utf8 v Charset=utf8).18+- Fixed exception leak where certain redirect urls would raise19+ uncaught urllib3 exceptions.20+- Requests removes Authorization header from requests redirected21+ from https to http on the same hostname. (CVE-2018-18074)22+- `should_bypass_proxies` now handles URIs without hostnames (e.g.23+ files).24+25+**Dependencies**26+27+- Requests now supports urllib3 v1.24.28+29+**Deprecations**30+31+- Requests has officially stopped support for Python 2.6.32+33+2.19.1 (2018-06-14)34+-------------------35+36+**Bugfixes**37+38+- Fixed issue where status\_codes.py's `init` function failed trying39+ to append to a `__doc__` value of `None`.40+41+2.19.0 (2018-06-12)42+-------------------43+44+**Improvements**45+46+- Warn user about possible slowdown when using cryptography version47+ < 1.3.448+- Check for invalid host in proxy URL, before forwarding request to49+ adapter.50+- Fragments are now properly maintained across redirects. (RFC723151+ 7.1.2)52+- Removed use of cgi module to expedite library load time.53+- Added support for SHA-256 and SHA-512 digest auth algorithms.54+- Minor performance improvement to `Request.content`.55+- Migrate to using collections.abc for 3.7 compatibility.56+57+**Bugfixes**58+59+- Parsing empty `Link` headers with `parse_header_links()` no longer60+ return one bogus entry.61+- Fixed issue where loading the default certificate bundle from a zip62+ archive would raise an `IOError`.63+- Fixed issue with unexpected `ImportError` on windows system which do64+ not support `winreg` module.65+- DNS resolution in proxy bypass no longer includes the username and66+ password in the request. This also fixes the issue of DNS queries67+ failing on macOS.68+- Properly normalize adapter prefixes for url comparison.69+- Passing `None` as a file pointer to the `files` param no longer70+ raises an exception.71+- Calling `copy` on a `RequestsCookieJar` will now preserve the cookie72+ policy correctly.73+74+**Dependencies**75+76+- We now support idna v2.7.77+- We now support urllib3 v1.23.78+79+2.18.4 (2017-08-15)80+-------------------81+82+**Improvements**83+84+- Error messages for invalid headers now include the header name for85+ easier debugging86+87+**Dependencies**88+89+- We now support idna v2.6.90+91+2.18.3 (2017-08-02)92+-------------------93+94+**Improvements**95+96+- Running `$ python -m requests.help` now includes the installed97+ version of idna.98+99+**Bugfixes**100+101+- Fixed issue where Requests would raise `ConnectionError` instead of102+ `SSLError` when encountering SSL problems when using urllib3 v1.22.103+104+2.18.2 (2017-07-25)105+-------------------106+107+**Bugfixes**108+109+- `requests.help` no longer fails on Python 2.6 due to the absence of110+ `ssl.OPENSSL_VERSION_NUMBER`.111+112+**Dependencies**113+114+- We now support urllib3 v1.22.115+116+2.18.1 (2017-06-14)117+-------------------118+119+**Bugfixes**120+121+- Fix an error in the packaging whereby the `*.whl` contained122+ incorrect data that regressed the fix in v2.17.3.123+124+2.18.0 (2017-06-14)125+-------------------126+127+**Improvements**128+129+- `Response` is now a context manager, so can be used directly in a130+ `with` statement without first having to be wrapped by131+ `contextlib.closing()`.132+133+**Bugfixes**134+135+- Resolve installation failure if multiprocessing is not available136+- Resolve tests crash if multiprocessing is not able to determine the137+ number of CPU cores138+- Resolve error swallowing in utils set\_environ generator139+140+2.17.3 (2017-05-29)141+-------------------142+143+**Improvements**144+145+- Improved `packages` namespace identity support, for monkeypatching146+ libraries.147+148+2.17.2 (2017-05-29)149+-------------------150+151+**Improvements**152+153+- Improved `packages` namespace identity support, for monkeypatching154+ libraries.155+156+2.17.1 (2017-05-29)157+-------------------158+159+**Improvements**160+161+- Improved `packages` namespace identity support, for monkeypatching162+ libraries.163+164+2.17.0 (2017-05-29)165+-------------------166+167+**Improvements**168+169+- Removal of the 301 redirect cache. This improves thread-safety.170+171+2.16.5 (2017-05-28)172+-------------------173+174+- Improvements to `$ python -m requests.help`.175+176+2.16.4 (2017-05-27)177+-------------------178+179+- Introduction of the `$ python -m requests.help` command, for180+ debugging with maintainers!181+182+2.16.3 (2017-05-27)183+-------------------184+185+- Further restored the `requests.packages` namespace for compatibility186+ reasons.187+188+2.16.2 (2017-05-27)189+-------------------190+191+- Further restored the `requests.packages` namespace for compatibility192+ reasons.193+194+No code modification (noted below) should be necessary any longer.195+196+2.16.1 (2017-05-27)197+-------------------198+199+- Restored the `requests.packages` namespace for compatibility200+ reasons.201+- Bugfix for `urllib3` version parsing.202+203+**Note**: code that was written to import against the204+`requests.packages` namespace previously will have to import code that205+rests at this module-level now.206+207+For example:208+209+ from requests.packages.urllib3.poolmanager import PoolManager210+211+Will need to be re-written to be:212+213+ from requests.packages import urllib3214+ urllib3.poolmanager.PoolManager215+216+Or, even better:217+218+ from urllib3.poolmanager import PoolManager219+220+2.16.0 (2017-05-26)221+-------------------222+223+- Unvendor ALL the things!224+225+2.15.1 (2017-05-26)226+-------------------227+228+- Everyone makes mistakes.229+230+2.15.0 (2017-05-26)231+-------------------232+233+**Improvements**234+235+- Introduction of the `Response.next` property, for getting the next236+ `PreparedResponse` from a redirect chain (when237+ `allow_redirects=False`).238+- Internal refactoring of `__version__` module.239+240+**Bugfixes**241+242+- Restored once-optional parameter for243+ `requests.utils.get_environ_proxies()`.244+245+2.14.2 (2017-05-10)246+-------------------247+248+**Bugfixes**249+250+- Changed a less-than to an equal-to and an or in the dependency251+ markers to widen compatibility with older setuptools releases.252+253+2.14.1 (2017-05-09)254+-------------------255+256+**Bugfixes**257+258+- Changed the dependency markers to widen compatibility with older pip259+ releases.260+261+2.14.0 (2017-05-09)262+-------------------263+264+**Improvements**265+266+- It is now possible to pass `no_proxy` as a key to the `proxies`267+ dictionary to provide handling similar to the `NO_PROXY` environment268+ variable.269+- When users provide invalid paths to certificate bundle files or270+ directories Requests now raises `IOError`, rather than failing at271+ the time of the HTTPS request with a fairly inscrutable certificate272+ validation error.273+- The behavior of `SessionRedirectMixin` was slightly altered.274+ `resolve_redirects` will now detect a redirect by calling275+ `get_redirect_target(response)` instead of directly querying276+ `Response.is_redirect` and `Response.headers['location']`. Advanced277+ users will be able to process malformed redirects more easily.278+- Changed the internal calculation of elapsed request time to have279+ higher resolution on Windows.280+- Added `win_inet_pton` as conditional dependency for the `[socks]`281+ extra on Windows with Python 2.7.282+- Changed the proxy bypass implementation on Windows: the proxy bypass283+ check doesn't use forward and reverse DNS requests anymore284+- URLs with schemes that begin with `http` but are not `http` or285+ `https` no longer have their host parts forced to lowercase.286+287+**Bugfixes**288+289+- Much improved handling of non-ASCII `Location` header values in290+ redirects. Fewer `UnicodeDecodeErrors` are encountered on Python 2,291+ and Python 3 now correctly understands that Latin-1 is unlikely to292+ be the correct encoding.293+- If an attempt to `seek` file to find out its length fails, we now294+ appropriately handle that by aborting our content-length295+ calculations.296+- Restricted `HTTPDigestAuth` to only respond to auth challenges made297+ on 4XX responses, rather than to all auth challenges.298+- Fixed some code that was firing `DeprecationWarning` on Python 3.6.299+- The dismayed person emoticon (`/o\\`) no longer has a big head. I'm300+ sure this is what you were all worrying about most.301+302+**Miscellaneous**303+304+- Updated bundled urllib3 to v1.21.1.305+- Updated bundled chardet to v3.0.2.306+- Updated bundled idna to v2.5.307+- Updated bundled certifi to 2017.4.17.308+309+2.13.0 (2017-01-24)310+-------------------311+312+**Features**313+314+- Only load the `idna` library when we've determined we need it. This315+ will save some memory for users.316+317+**Miscellaneous**318+319+- Updated bundled urllib3 to 1.20.320+- Updated bundled idna to 2.2.321+322+2.12.5 (2017-01-18)323+-------------------324+325+**Bugfixes**326+327+- Fixed an issue with JSON encoding detection, specifically detecting328+ big-endian UTF-32 with BOM.329+330+2.12.4 (2016-12-14)331+-------------------332+333+**Bugfixes**334+335+- Fixed regression from 2.12.2 where non-string types were rejected in336+ the basic auth parameters. While support for this behaviour has been337+ readded, the behaviour is deprecated and will be removed in the338+ future.339+340+2.12.3 (2016-12-01)341+-------------------342+343+**Bugfixes**344+345+- Fixed regression from v2.12.1 for URLs with schemes that begin with346+ "http". These URLs have historically been processed as though they347+ were HTTP-schemed URLs, and so have had parameters added. This was348+ removed in v2.12.2 in an overzealous attempt to resolve problems349+ with IDNA-encoding those URLs. This change was reverted: the other350+ fixes for IDNA-encoding have been judged to be sufficient to return351+ to the behaviour Requests had before v2.12.0.352+353+2.12.2 (2016-11-30)354+-------------------355+356+**Bugfixes**357+358+- Fixed several issues with IDNA-encoding URLs that are technically359+ invalid but which are widely accepted. Requests will now attempt to360+ IDNA-encode a URL if it can but, if it fails, and the host contains361+ only ASCII characters, it will be passed through optimistically.362+ This will allow users to opt-in to using IDNA2003 themselves if they363+ want to, and will also allow technically invalid but still common364+ hostnames.365+- Fixed an issue where URLs with leading whitespace would raise366+ `InvalidSchema` errors.367+- Fixed an issue where some URLs without the HTTP or HTTPS schemes368+ would still have HTTP URL preparation applied to them.369+- Fixed an issue where Unicode strings could not be used in basic370+ auth.371+- Fixed an issue encountered by some Requests plugins where372+ constructing a Response object would cause `Response.content` to373+ raise an `AttributeError`.374+375+2.12.1 (2016-11-16)376+-------------------377+378+**Bugfixes**379+380+- Updated setuptools 'security' extra for the new PyOpenSSL backend in381+ urllib3.382+383+**Miscellaneous**384+385+- Updated bundled urllib3 to 1.19.1.386+387+2.12.0 (2016-11-15)388+-------------------389+390+**Improvements**391+392+- Updated support for internationalized domain names from IDNA2003 to393+ IDNA2008. This updated support is required for several forms of IDNs394+ and is mandatory for .de domains.395+- Much improved heuristics for guessing content lengths: Requests will396+ no longer read an entire `StringIO` into memory.397+- Much improved logic for recalculating `Content-Length` headers for398+ `PreparedRequest` objects.399+- Improved tolerance for file-like objects that have no `tell` method400+ but do have a `seek` method.401+- Anything that is a subclass of `Mapping` is now treated like a402+ dictionary by the `data=` keyword argument.403+- Requests now tolerates empty passwords in proxy credentials, rather404+ than stripping the credentials.405+- If a request is made with a file-like object as the body and that406+ request is redirected with a 307 or 308 status code, Requests will407+ now attempt to rewind the body object so it can be replayed.408+409+**Bugfixes**410+411+- When calling `response.close`, the call to `close` will be412+ propagated through to non-urllib3 backends.413+- Fixed issue where the `ALL_PROXY` environment variable would be414+ preferred over scheme-specific variables like `HTTP_PROXY`.415+- Fixed issue where non-UTF8 reason phrases got severely mangled by416+ falling back to decoding using ISO 8859-1 instead.417+- Fixed a bug where Requests would not correctly correlate cookies set418+ when using custom Host headers if those Host headers did not use the419+ native string type for the platform.420+421+**Miscellaneous**422+423+- Updated bundled urllib3 to 1.19.424+- Updated bundled certifi certs to 2016.09.26.425+426+2.11.1 (2016-08-17)427+-------------------428+429+**Bugfixes**430+431+- Fixed a bug when using `iter_content` with `decode_unicode=True` for432+ streamed bodies would raise `AttributeError`. This bug was433+ introduced in 2.11.434+- Strip Content-Type and Transfer-Encoding headers from the header435+ block when following a redirect that transforms the verb from436+ POST/PUT to GET.437+438+2.11.0 (2016-08-08)439+-------------------440+441+**Improvements**442+443+- Added support for the `ALL_PROXY` environment variable.444+- Reject header values that contain leading whitespace or newline445+ characters to reduce risk of header smuggling.446+447+**Bugfixes**448+449+- Fixed occasional `TypeError` when attempting to decode a JSON450+ response that occurred in an error case. Now correctly returns a451+ `ValueError`.452+- Requests would incorrectly ignore a non-CIDR IP address in the453+ `NO_PROXY` environment variables: Requests now treats it as a454+ specific IP.455+- Fixed a bug when sending JSON data that could cause us to encounter456+ obscure OpenSSL errors in certain network conditions (yes, really).457+- Added type checks to ensure that `iter_content` only accepts458+ integers and `None` for chunk sizes.459+- Fixed issue where responses whose body had not been fully consumed460+ would have the underlying connection closed but not returned to the461+ connection pool, which could cause Requests to hang in situations462+ where the `HTTPAdapter` had been configured to use a blocking463+ connection pool.464+465+**Miscellaneous**466+467+- Updated bundled urllib3 to 1.16.468+- Some previous releases accidentally accepted non-strings as469+ acceptable header values. This release does not.470+471+2.10.0 (2016-04-29)472+-------------------473+474+**New Features**475+476+- SOCKS Proxy Support! (requires PySocks;477+ `$ pip install requests[socks]`)478+479+**Miscellaneous**480+481+- Updated bundled urllib3 to 1.15.1.482+483+2.9.2 (2016-04-29)484+------------------485+486+**Improvements**487+488+- Change built-in CaseInsensitiveDict (used for headers) to use489+ OrderedDict as its underlying datastore.490+491+**Bugfixes**492+493+- Don't use redirect\_cache if allow\_redirects=False494+- When passed objects that throw exceptions from `tell()`, send them495+ via chunked transfer encoding instead of failing.496+- Raise a ProxyError for proxy related connection issues.497+498+2.9.1 (2015-12-21)499+------------------500+501+**Bugfixes**502+503+- Resolve regression introduced in 2.9.0 that made it impossible to504+ send binary strings as bodies in Python 3.505+- Fixed errors when calculating cookie expiration dates in certain506+ locales.507+508+**Miscellaneous**509+510+- Updated bundled urllib3 to 1.13.1.511+512+2.9.0 (2015-12-15)513+------------------514+515+**Minor Improvements** (Backwards compatible)516+517+- The `verify` keyword argument now supports being passed a path to a518+ directory of CA certificates, not just a single-file bundle.519+- Warnings are now emitted when sending files opened in text mode.520+- Added the 511 Network Authentication Required status code to the521+ status code registry.522+523+**Bugfixes**524+525+- For file-like objects that are not seeked to the very beginning, we526+ now send the content length for the number of bytes we will actually527+ read, rather than the total size of the file, allowing partial file528+ uploads.529+- When uploading file-like objects, if they are empty or have no530+ obvious content length we set `Transfer-Encoding: chunked` rather531+ than `Content-Length: 0`.532+- We correctly receive the response in buffered mode when uploading533+ chunked bodies.534+- We now handle being passed a query string as a bytestring on Python535+ 3, by decoding it as UTF-8.536+- Sessions are now closed in all cases (exceptional and not) when537+ using the functional API rather than leaking and waiting for the538+ garbage collector to clean them up.539+- Correctly handle digest auth headers with a malformed `qop`540+ directive that contains no token, by treating it the same as if no541+ `qop` directive was provided at all.542+- Minor performance improvements when removing specific cookies by543+ name.544+545+**Miscellaneous**546+547+- Updated urllib3 to 1.13.548+549+2.8.1 (2015-10-13)550+------------------551+552+**Bugfixes**553+554+- Update certificate bundle to match `certifi` 2015.9.6.2's weak555+ certificate bundle.556+- Fix a bug in 2.8.0 where requests would raise `ConnectTimeout`557+ instead of `ConnectionError`558+- When using the PreparedRequest flow, requests will now correctly559+ respect the `json` parameter. Broken in 2.8.0.560+- When using the PreparedRequest flow, requests will now correctly561+ handle a Unicode-string method name on Python 2. Broken in 2.8.0.562+563+2.8.0 (2015-10-05)564+------------------565+566+**Minor Improvements** (Backwards Compatible)567+568+- Requests now supports per-host proxies. This allows the `proxies`569+ dictionary to have entries of the form570+ `{'<scheme>://<hostname>': '<proxy>'}`. Host-specific proxies will571+ be used in preference to the previously-supported scheme-specific572+ ones, but the previous syntax will continue to work.573+- `Response.raise_for_status` now prints the URL that failed as part574+ of the exception message.575+- `requests.utils.get_netrc_auth` now takes an `raise_errors` kwarg,576+ defaulting to `False`. When `True`, errors parsing `.netrc` files577+ cause exceptions to be thrown.578+- Change to bundled projects import logic to make it easier to579+ unbundle requests downstream.580+- Changed the default User-Agent string to avoid leaking data on581+ Linux: now contains only the requests version.582+583+**Bugfixes**584+585+- The `json` parameter to `post()` and friends will now only be used586+ if neither `data` nor `files` are present, consistent with the587+ documentation.588+- We now ignore empty fields in the `NO_PROXY` environment variable.589+- Fixed problem where `httplib.BadStatusLine` would get raised if590+ combining `stream=True` with `contextlib.closing`.591+- Prevented bugs where we would attempt to return the same connection592+ back to the connection pool twice when sending a Chunked body.593+- Miscellaneous minor internal changes.594+- Digest Auth support is now thread safe.595+596+**Updates**597+598+- Updated urllib3 to 1.12.599+600+2.7.0 (2015-05-03)601+------------------602+603+This is the first release that follows our new release process. For604+more, see [our605+documentation](http://docs.python-requests.org/en/latest/community/release-process/).606+607+**Bugfixes**608+609+- Updated urllib3 to 1.10.4, resolving several bugs involving chunked610+ transfer encoding and response framing.611+612+2.6.2 (2015-04-23)613+------------------614+615+**Bugfixes**616+617+- Fix regression where compressed data that was sent as chunked data618+ was not properly decompressed. (\#2561)619+620+2.6.1 (2015-04-22)621+------------------622+623+**Bugfixes**624+625+- Remove VendorAlias import machinery introduced in v2.5.2.626+- Simplify the PreparedRequest.prepare API: We no longer require the627+ user to pass an empty list to the hooks keyword argument. (c.f.628+ \#2552)629+- Resolve redirects now receives and forwards all of the original630+ arguments to the adapter. (\#2503)631+- Handle UnicodeDecodeErrors when trying to deal with a unicode URL632+ that cannot be encoded in ASCII. (\#2540)633+- Populate the parsed path of the URI field when performing Digest634+ Authentication. (\#2426)635+- Copy a PreparedRequest's CookieJar more reliably when it is not an636+ instance of RequestsCookieJar. (\#2527)637+638+2.6.0 (2015-03-14)639+------------------640+641+**Bugfixes**642+643+- CVE-2015-2296: Fix handling of cookies on redirect. Previously a644+ cookie without a host value set would use the hostname for the645+ redirected URL exposing requests users to session fixation attacks646+ and potentially cookie stealing. This was disclosed privately by647+ Matthew Daley of [BugFuzz](https://bugfuzz.com). This affects all648+ versions of requests from v2.1.0 to v2.5.3 (inclusive on both ends).649+- Fix error when requests is an `install_requires` dependency and650+ `python setup.py test` is run. (\#2462)651+- Fix error when urllib3 is unbundled and requests continues to use652+ the vendored import location.653+- Include fixes to `urllib3`'s header handling.654+- Requests' handling of unvendored dependencies is now more655+ restrictive.656+657+**Features and Improvements**658+659+- Support bytearrays when passed as parameters in the `files`660+ argument. (\#2468)661+- Avoid data duplication when creating a request with `str`, `bytes`,662+ or `bytearray` input to the `files` argument.663+664+2.5.3 (2015-02-24)665+------------------666+667+**Bugfixes**668+669+- Revert changes to our vendored certificate bundle. For more context670+ see (\#2455, \#2456, and <https://bugs.python.org/issue23476>)671+672+2.5.2 (2015-02-23)673+------------------674+675+**Features and Improvements**676+677+- Add sha256 fingerprint support.678+ ([shazow/urllib3\#540](https://github.com/shazow/urllib3/pull/540))679+- Improve the performance of headers.680+ ([shazow/urllib3\#544](https://github.com/shazow/urllib3/pull/544))681+682+**Bugfixes**683+684+- Copy pip's import machinery. When downstream redistributors remove685+ requests.packages.urllib3 the import machinery will continue to let686+ those same symbols work. Example usage in requests' documentation687+ and 3rd-party libraries relying on the vendored copies of urllib3688+ will work without having to fallback to the system urllib3.689+- Attempt to quote parts of the URL on redirect if unquoting and then690+ quoting fails. (\#2356)691+- Fix filename type check for multipart form-data uploads. (\#2411)692+- Properly handle the case where a server issuing digest693+ authentication challenges provides both auth and auth-int694+ qop-values. (\#2408)695+- Fix a socket leak.696+ ([shazow/urllib3\#549](https://github.com/shazow/urllib3/pull/549))697+- Fix multiple `Set-Cookie` headers properly.698+ ([shazow/urllib3\#534](https://github.com/shazow/urllib3/pull/534))699+- Disable the built-in hostname verification.700+ ([shazow/urllib3\#526](https://github.com/shazow/urllib3/pull/526))701+- Fix the behaviour of decoding an exhausted stream.702+ ([shazow/urllib3\#535](https://github.com/shazow/urllib3/pull/535))703+704+**Security**705+706+- Pulled in an updated `cacert.pem`.707+- Drop RC4 from the default cipher list.708+ ([shazow/urllib3\#551](https://github.com/shazow/urllib3/pull/551))709+710+2.5.1 (2014-12-23)711+------------------712+713+**Behavioural Changes**714+715+- Only catch HTTPErrors in raise\_for\_status (\#2382)716+717+**Bugfixes**718+719+- Handle LocationParseError from urllib3 (\#2344)720+- Handle file-like object filenames that are not strings (\#2379)721+- Unbreak HTTPDigestAuth handler. Allow new nonces to be negotiated722+ (\#2389)723+724+2.5.0 (2014-12-01)725+------------------726+727+**Improvements**728+729+- Allow usage of urllib3's Retry object with HTTPAdapters (\#2216)730+- The `iter_lines` method on a response now accepts a delimiter with731+ which to split the content (\#2295)732+733+**Behavioural Changes**734+735+- Add deprecation warnings to functions in requests.utils that will be736+ removed in 3.0 (\#2309)737+- Sessions used by the functional API are always closed (\#2326)738+- Restrict requests to HTTP/1.1 and HTTP/1.0 (stop accepting HTTP/0.9)739+ (\#2323)740+741+**Bugfixes**742+743+- Only parse the URL once (\#2353)744+- Allow Content-Length header to always be overridden (\#2332)745+- Properly handle files in HTTPDigestAuth (\#2333)746+- Cap redirect\_cache size to prevent memory abuse (\#2299)747+- Fix HTTPDigestAuth handling of redirects after authenticating748+ successfully (\#2253)749+- Fix crash with custom method parameter to Session.request (\#2317)750+- Fix how Link headers are parsed using the regular expression library751+ (\#2271)752+753+**Documentation**754+755+- Add more references for interlinking (\#2348)756+- Update CSS for theme (\#2290)757+- Update width of buttons and sidebar (\#2289)758+- Replace references of Gittip with Gratipay (\#2282)759+- Add link to changelog in sidebar (\#2273)760+761+2.4.3 (2014-10-06)762+------------------763+764+**Bugfixes**765+766+- Unicode URL improvements for Python 2.767+- Re-order JSON param for backwards compat.768+- Automatically defrag authentication schemes from host/pass URIs.769+ ([\#2249](https://github.com/requests/requests/issues/2249))770+771+2.4.2 (2014-10-05)772+------------------773+774+**Improvements**775+776+- FINALLY! Add json parameter for uploads!777+ ([\#2258](https://github.com/requests/requests/pull/2258))778+- Support for bytestring URLs on Python 3.x779+ ([\#2238](https://github.com/requests/requests/pull/2238))780+781+**Bugfixes**782+783+- Avoid getting stuck in a loop784+ ([\#2244](https://github.com/requests/requests/pull/2244))785+- Multiple calls to iter\* fail with unhelpful error.786+ ([\#2240](https://github.com/requests/requests/issues/2240),787+ [\#2241](https://github.com/requests/requests/issues/2241))788+789+**Documentation**790+791+- Correct redirection introduction792+ ([\#2245](https://github.com/requests/requests/pull/2245/))793+- Added example of how to send multiple files in one request.794+ ([\#2227](https://github.com/requests/requests/pull/2227/))795+- Clarify how to pass a custom set of CAs796+ ([\#2248](https://github.com/requests/requests/pull/2248/))797+798+2.4.1 (2014-09-09)799+------------------800+801+- Now has a "security" package extras set,802+ `$ pip install requests[security]`803+- Requests will now use Certifi if it is available.804+- Capture and re-raise urllib3 ProtocolError805+- Bugfix for responses that attempt to redirect to themselves forever806+ (wtf?).807+808+2.4.0 (2014-08-29)809+------------------810+811+**Behavioral Changes**812+813+- `Connection: keep-alive` header is now sent automatically.814+815+**Improvements**816+817+- Support for connect timeouts! Timeout now accepts a tuple (connect,818+ read) which is used to set individual connect and read timeouts.819+- Allow copying of PreparedRequests without headers/cookies.820+- Updated bundled urllib3 version.821+- Refactored settings loading from environment -- new822+ Session.merge\_environment\_settings.823+- Handle socket errors in iter\_content.824+825+2.3.0 (2014-05-16)826+------------------827+828+**API Changes**829+830+- New `Response` property `is_redirect`, which is true when the831+ library could have processed this response as a redirection (whether832+ or not it actually did).833+- The `timeout` parameter now affects requests with both `stream=True`834+ and `stream=False` equally.835+- The change in v2.0.0 to mandate explicit proxy schemes has been836+ reverted. Proxy schemes now default to `http://`.837+- The `CaseInsensitiveDict` used for HTTP headers now behaves like a838+ normal dictionary when references as string or viewed in the839+ interpreter.840+841+**Bugfixes**842+843+- No longer expose Authorization or Proxy-Authorization headers on844+ redirect. Fix CVE-2014-1829 and CVE-2014-1830 respectively.845+- Authorization is re-evaluated each redirect.846+- On redirect, pass url as native strings.847+- Fall-back to autodetected encoding for JSON when Unicode detection848+ fails.849+- Headers set to `None` on the `Session` are now correctly not sent.850+- Correctly honor `decode_unicode` even if it wasn't used earlier in851+ the same response.852+- Stop advertising `compress` as a supported Content-Encoding.853+- The `Response.history` parameter is now always a list.854+- Many, many `urllib3` bugfixes.855+856+2.2.1 (2014-01-23)857+------------------858+859+**Bugfixes**860+861+- Fixes incorrect parsing of proxy credentials that contain a literal862+ or encoded '\#' character.863+- Assorted urllib3 fixes.864+865+2.2.0 (2014-01-09)866+------------------867+868+**API Changes**869+870+- New exception: `ContentDecodingError`. Raised instead of `urllib3`871+ `DecodeError` exceptions.872+873+**Bugfixes**874+875+- Avoid many many exceptions from the buggy implementation of876+ `proxy_bypass` on OS X in Python 2.6.877+- Avoid crashing when attempting to get authentication credentials878+ from \~/.netrc when running as a user without a home directory.879+- Use the correct pool size for pools of connections to proxies.880+- Fix iteration of `CookieJar` objects.881+- Ensure that cookies are persisted over redirect.882+- Switch back to using chardet, since it has merged with charade.883+884+2.1.0 (2013-12-05)885+------------------886+887+- Updated CA Bundle, of course.888+- Cookies set on individual Requests through a `Session` (e.g. via889+ `Session.get()`) are no longer persisted to the `Session`.890+- Clean up connections when we hit problems during chunked upload,891+ rather than leaking them.892+- Return connections to the pool when a chunked upload is successful,893+ rather than leaking it.894+- Match the HTTPbis recommendation for HTTP 301 redirects.895+- Prevent hanging when using streaming uploads and Digest Auth when a896+ 401 is received.897+- Values of headers set by Requests are now always the native string898+ type.899+- Fix previously broken SNI support.900+- Fix accessing HTTP proxies using proxy authentication.901+- Unencode HTTP Basic usernames and passwords extracted from URLs.902+- Support for IP address ranges for no\_proxy environment variable903+- Parse headers correctly when users override the default `Host:`904+ header.905+- Avoid munging the URL in case of case-sensitive servers.906+- Looser URL handling for non-HTTP/HTTPS urls.907+- Accept unicode methods in Python 2.6 and 2.7.908+- More resilient cookie handling.909+- Make `Response` objects pickleable.910+- Actually added MD5-sess to Digest Auth instead of pretending to like911+ last time.912+- Updated internal urllib3.913+- Fixed @Lukasa's lack of taste.914+915+2.0.1 (2013-10-24)916+------------------917+918+- Updated included CA Bundle with new mistrusts and automated process919+ for the future920+- Added MD5-sess to Digest Auth921+- Accept per-file headers in multipart file POST messages.922+- Fixed: Don't send the full URL on CONNECT messages.923+- Fixed: Correctly lowercase a redirect scheme.924+- Fixed: Cookies not persisted when set via functional API.925+- Fixed: Translate urllib3 ProxyError into a requests ProxyError926+ derived from ConnectionError.927+- Updated internal urllib3 and chardet.928+929+2.0.0 (2013-09-24)930+------------------931+932+**API Changes:**933+934+- Keys in the Headers dictionary are now native strings on all Python935+ versions, i.e. bytestrings on Python 2, unicode on Python 3.936+- Proxy URLs now *must* have an explicit scheme. A `MissingSchema`937+ exception will be raised if they don't.938+- Timeouts now apply to read time if `Stream=False`.939+- `RequestException` is now a subclass of `IOError`, not940+ `RuntimeError`.941+- Added new method to `PreparedRequest` objects:942+ `PreparedRequest.copy()`.943+- Added new method to `Session` objects: `Session.update_request()`.944+ This method updates a `Request` object with the data (e.g. cookies)945+ stored on the `Session`.946+- Added new method to `Session` objects: `Session.prepare_request()`.947+ This method updates and prepares a `Request` object, and returns the948+ corresponding `PreparedRequest` object.949+- Added new method to `HTTPAdapter` objects:950+ `HTTPAdapter.proxy_headers()`. This should not be called directly,951+ but improves the subclass interface.952+- `httplib.IncompleteRead` exceptions caused by incorrect chunked953+ encoding will now raise a Requests `ChunkedEncodingError` instead.954+- Invalid percent-escape sequences now cause a Requests `InvalidURL`955+ exception to be raised.956+- HTTP 208 no longer uses reason phrase `"im_used"`. Correctly uses957+ `"already_reported"`.958+- HTTP 226 reason added (`"im_used"`).959+960+**Bugfixes:**961+962+- Vastly improved proxy support, including the CONNECT verb. Special963+ thanks to the many contributors who worked towards this improvement.964+- Cookies are now properly managed when 401 authentication responses965+ are received.966+- Chunked encoding fixes.967+- Support for mixed case schemes.968+- Better handling of streaming downloads.969+- Retrieve environment proxies from more locations.970+- Minor cookies fixes.971+- Improved redirect behaviour.972+- Improved streaming behaviour, particularly for compressed data.973+- Miscellaneous small Python 3 text encoding bugs.974+- `.netrc` no longer overrides explicit auth.975+- Cookies set by hooks are now correctly persisted on Sessions.976+- Fix problem with cookies that specify port numbers in their host977+ field.978+- `BytesIO` can be used to perform streaming uploads.979+- More generous parsing of the `no_proxy` environment variable.980+- Non-string objects can be passed in data values alongside files.981+982+1.2.3 (2013-05-25)983+------------------984+985+- Simple packaging fix986+987+1.2.2 (2013-05-23)988+------------------989+990+- Simple packaging fix991+992+1.2.1 (2013-05-20)993+------------------994+995+- 301 and 302 redirects now change the verb to GET for all verbs, not996+ just POST, improving browser compatibility.997+- Python 3.3.2 compatibility998+- Always percent-encode location headers999+- Fix connection adapter matching to be most-specific first1000+- new argument to the default connection adapter for passing a block1001+ argument1002+- prevent a KeyError when there's no link headers1003+1004+1.2.0 (2013-03-31)1005+------------------1006+1007+- Fixed cookies on sessions and on requests1008+- Significantly change how hooks are dispatched - hooks now receive1009+ all the arguments specified by the user when making a request so1010+ hooks can make a secondary request with the same parameters. This is1011+ especially necessary for authentication handler authors1012+- certifi support was removed1013+- Fixed bug where using OAuth 1 with body `signature_type` sent no1014+ data1015+- Major proxy work thanks to @Lukasa including parsing of proxy1016+ authentication from the proxy url1017+- Fix DigestAuth handling too many 401s1018+- Update vendored urllib3 to include SSL bug fixes1019+- Allow keyword arguments to be passed to `json.loads()` via the1020+ `Response.json()` method1021+- Don't send `Content-Length` header by default on `GET` or `HEAD`1022+ requests1023+- Add `elapsed` attribute to `Response` objects to time how long a1024+ request took.1025+- Fix `RequestsCookieJar`1026+- Sessions and Adapters are now picklable, i.e., can be used with the1027+ multiprocessing library1028+- Update charade to version 1.0.31029+1030+The change in how hooks are dispatched will likely cause a great deal of1031+issues.1032+1033+1.1.0 (2013-01-10)1034+------------------1035+1036+- CHUNKED REQUESTS1037+- Support for iterable response bodies1038+- Assume servers persist redirect params1039+- Allow explicit content types to be specified for file data1040+- Make merge\_kwargs case-insensitive when looking up keys1041+1042+1.0.3 (2012-12-18)1043+------------------1044+1045+- Fix file upload encoding bug1046+- Fix cookie behavior1047+1048+1.0.2 (2012-12-17)1049+------------------1050+1051+- Proxy fix for HTTPAdapter.1052+1053+1.0.1 (2012-12-17)1054+------------------1055+1056+- Cert verification exception bug.1057+- Proxy fix for HTTPAdapter.1058+1059+1.0.0 (2012-12-17)1060+------------------1061+1062+- Massive Refactor and Simplification1063+- Switch to Apache 2.0 license1064+- Swappable Connection Adapters1065+- Mountable Connection Adapters1066+- Mutable ProcessedRequest chain1067+- /s/prefetch/stream1068+- Removal of all configuration1069+- Standard library logging1070+- Make Response.json() callable, not property.1071+- Usage of new charade project, which provides python 2 and 31072+ simultaneous chardet.1073+- Removal of all hooks except 'response'1074+- Removal of all authentication helpers (OAuth, Kerberos)1075+1076+This is not a backwards compatible change.1077+1078+0.14.2 (2012-10-27)1079+-------------------1080+1081+- Improved mime-compatible JSON handling1082+- Proxy fixes1083+- Path hack fixes1084+- Case-Insensitive Content-Encoding headers1085+- Support for CJK parameters in form posts1086+1087+0.14.1 (2012-10-01)1088+-------------------1089+1090+- Python 3.3 Compatibility1091+- Simply default accept-encoding1092+- Bugfixes1093+1094+0.14.0 (2012-09-02)1095+-------------------1096+1097+- No more iter\_content errors if already downloaded.1098+1099+0.13.9 (2012-08-25)1100+-------------------1101+1102+- Fix for OAuth + POSTs1103+- Remove exception eating from dispatch\_hook1104+- General bugfixes1105+1106+0.13.8 (2012-08-21)1107+-------------------1108+1109+- Incredible Link header support :)1110+1111+0.13.7 (2012-08-19)1112+-------------------1113+1114+- Support for (key, value) lists everywhere.1115+- Digest Authentication improvements.1116+- Ensure proxy exclusions work properly.1117+- Clearer UnicodeError exceptions.1118+- Automatic casting of URLs to strings (fURL and such)1119+- Bugfixes.1120+1121+0.13.6 (2012-08-06)1122+-------------------1123+1124+- Long awaited fix for hanging connections!1125+1126+0.13.5 (2012-07-27)1127+-------------------1128+1129+- Packaging fix1130+1131+0.13.4 (2012-07-27)1132+-------------------1133+1134+- GSSAPI/Kerberos authentication!1135+- App Engine 2.7 Fixes!1136+- Fix leaking connections (from urllib3 update)1137+- OAuthlib path hack fix1138+- OAuthlib URL parameters fix.1139+1140+0.13.3 (2012-07-12)1141+-------------------1142+1143+- Use simplejson if available.1144+- Do not hide SSLErrors behind Timeouts.1145+- Fixed param handling with urls containing fragments.1146+- Significantly improved information in User Agent.1147+- client certificates are ignored when verify=False1148+1149+0.13.2 (2012-06-28)1150+-------------------1151+1152+- Zero dependencies (once again)!1153+- New: Response.reason1154+- Sign querystring parameters in OAuth 1.01155+- Client certificates no longer ignored when verify=False1156+- Add openSUSE certificate support1157+1158+0.13.1 (2012-06-07)1159+-------------------1160+1161+- Allow passing a file or file-like object as data.1162+- Allow hooks to return responses that indicate errors.1163+- Fix Response.text and Response.json for body-less responses.1164+1165+0.13.0 (2012-05-29)1166+-------------------1167+1168+- Removal of Requests.async in favor of1169+ [grequests](https://github.com/kennethreitz/grequests)1170+- Allow disabling of cookie persistence.1171+- New implementation of safe\_mode1172+- cookies.get now supports default argument1173+- Session cookies not saved when Session.request is called with1174+ return\_response=False1175+- Env: no\_proxy support.1176+- RequestsCookieJar improvements.1177+- Various bug fixes.1178+1179+0.12.1 (2012-05-08)1180+-------------------1181+1182+- New `Response.json` property.1183+- Ability to add string file uploads.1184+- Fix out-of-range issue with iter\_lines.1185+- Fix iter\_content default size.1186+- Fix POST redirects containing files.1187+1188+0.12.0 (2012-05-02)1189+-------------------1190+1191+- EXPERIMENTAL OAUTH SUPPORT!1192+- Proper CookieJar-backed cookies interface with awesome dict-like1193+ interface.1194+- Speed fix for non-iterated content chunks.1195+- Move `pre_request` to a more usable place.1196+- New `pre_send` hook.1197+- Lazily encode data, params, files.1198+- Load system Certificate Bundle if `certify` isn't available.1199+- Cleanups, fixes.1200+1201+0.11.2 (2012-04-22)1202+-------------------1203+1204+- Attempt to use the OS's certificate bundle if `certifi` isn't1205+ available.1206+- Infinite digest auth redirect fix.1207+- Multi-part file upload improvements.1208+- Fix decoding of invalid %encodings in URLs.1209+- If there is no content in a response don't throw an error the second1210+ time that content is attempted to be read.1211+- Upload data on redirects.1212+1213+0.11.1 (2012-03-30)1214+-------------------1215+1216+- POST redirects now break RFC to do what browsers do: Follow up with1217+ a GET.1218+- New `strict_mode` configuration to disable new redirect behavior.1219+1220+0.11.0 (2012-03-14)1221+-------------------1222+1223+- Private SSL Certificate support1224+- Remove select.poll from Gevent monkeypatching1225+- Remove redundant generator for chunked transfer encoding1226+- Fix: Response.ok raises Timeout Exception in safe\_mode1227+1228+0.10.8 (2012-03-09)1229+-------------------1230+1231+- Generate chunked ValueError fix1232+- Proxy configuration by environment variables1233+- Simplification of iter\_lines.1234+- New trust\_env configuration for disabling system/environment hints.1235+- Suppress cookie errors.1236+1237+0.10.7 (2012-03-07)1238+-------------------1239+1240+- encode\_uri = False1241+1242+0.10.6 (2012-02-25)1243+-------------------1244+1245+- Allow '=' in cookies.1246+1247+0.10.5 (2012-02-25)1248+-------------------1249+1250+- Response body with 0 content-length fix.1251+- New async.imap.1252+- Don't fail on netrc.1253+1254+0.10.4 (2012-02-20)1255+-------------------1256+1257+- Honor netrc.1258+1259+0.10.3 (2012-02-20)1260+-------------------1261+1262+- HEAD requests don't follow redirects anymore.1263+- raise\_for\_status() doesn't raise for 3xx anymore.1264+- Make Session objects picklable.1265+- ValueError for invalid schema URLs.1266+1267+0.10.2 (2012-01-15)1268+-------------------1269+1270+- Vastly improved URL quoting.1271+- Additional allowed cookie key values.1272+- Attempted fix for "Too many open files" Error1273+- Replace unicode errors on first pass, no need for second pass.1274+- Append '/' to bare-domain urls before query insertion.1275+- Exceptions now inherit from RuntimeError.1276+- Binary uploads + auth fix.1277+- Bugfixes.1278+1279+0.10.1 (2012-01-23)1280+-------------------1281+1282+- PYTHON 3 SUPPORT!1283+- Dropped 2.5 Support. (*Backwards Incompatible*)1284+1285+0.10.0 (2012-01-21)1286+-------------------1287+1288+- `Response.content` is now bytes-only. (*Backwards Incompatible*)1289+- New `Response.text` is unicode-only.1290+- If no `Response.encoding` is specified and `chardet` is available,1291+ `Response.text` will guess an encoding.1292+- Default to ISO-8859-1 (Western) encoding for "text" subtypes.1293+- Removal of decode\_unicode. (*Backwards Incompatible*)1294+- New multiple-hooks system.1295+- New `Response.register_hook` for registering hooks within the1296+ pipeline.1297+- `Response.url` is now Unicode.1298+1299+0.9.3 (2012-01-18)1300+------------------1301+1302+- SSL verify=False bugfix (apparent on windows machines).1303+1304+0.9.2 (2012-01-18)1305+------------------1306+1307+- Asynchronous async.send method.1308+- Support for proper chunk streams with boundaries.1309+- session argument for Session classes.1310+- Print entire hook tracebacks, not just exception instance.1311+- Fix response.iter\_lines from pending next line.1312+- Fix but in HTTP-digest auth w/ URI having query strings.1313+- Fix in Event Hooks section.1314+- Urllib3 update.1315+1316+0.9.1 (2012-01-06)1317+------------------1318+1319+- danger\_mode for automatic Response.raise\_for\_status()1320+- Response.iter\_lines refactor1321+1322+0.9.0 (2011-12-28)1323+------------------1324+1325+- verify ssl is default.1326+1327+0.8.9 (2011-12-28)1328+------------------1329+1330+- Packaging fix.1331+1332+0.8.8 (2011-12-28)1333+------------------1334+1335+- SSL CERT VERIFICATION!1336+- Release of Cerifi: Mozilla's cert list.1337+- New 'verify' argument for SSL requests.1338+- Urllib3 update.1339+1340+0.8.7 (2011-12-24)1341+------------------1342+1343+- iter\_lines last-line truncation fix1344+- Force safe\_mode for async requests1345+- Handle safe\_mode exceptions more consistently1346+- Fix iteration on null responses in safe\_mode1347+1348+0.8.6 (2011-12-18)1349+------------------1350+1351+- Socket timeout fixes.1352+- Proxy Authorization support.1353+1354+0.8.5 (2011-12-14)1355+------------------1356+1357+- Response.iter\_lines!1358+1359+0.8.4 (2011-12-11)1360+------------------1361+1362+- Prefetch bugfix.1363+- Added license to installed version.1364+1365+0.8.3 (2011-11-27)1366+------------------1367+1368+- Converted auth system to use simpler callable objects.1369+- New session parameter to API methods.1370+- Display full URL while logging.1371+1372+0.8.2 (2011-11-19)1373+------------------1374+1375+- New Unicode decoding system, based on over-ridable1376+ Response.encoding.1377+- Proper URL slash-quote handling.1378+- Cookies with `[`, `]`, and `_` allowed.1379+1380+0.8.1 (2011-11-15)1381+------------------1382+1383+- URL Request path fix1384+- Proxy fix.1385+- Timeouts fix.1386+1387+0.8.0 (2011-11-13)1388+------------------1389+1390+- Keep-alive support!1391+- Complete removal of Urllib21392+- Complete removal of Poster1393+- Complete removal of CookieJars1394+- New ConnectionError raising1395+- Safe\_mode for error catching1396+- prefetch parameter for request methods1397+- OPTION method1398+- Async pool size throttling1399+- File uploads send real names1400+- Vendored in urllib31401+1402+0.7.6 (2011-11-07)1403+------------------1404+1405+- Digest authentication bugfix (attach query data to path)1406+1407+0.7.5 (2011-11-04)1408+------------------1409+1410+- Response.content = None if there was an invalid response.1411+- Redirection auth handling.1412+1413+0.7.4 (2011-10-26)1414+------------------1415+1416+- Session Hooks fix.1417+1418+0.7.3 (2011-10-23)1419+------------------1420+1421+- Digest Auth fix.1422+1423+0.7.2 (2011-10-23)1424+------------------1425+1426+- PATCH Fix.1427+1428+0.7.1 (2011-10-23)1429+------------------1430+1431+- Move away from urllib2 authentication handling.1432+- Fully Remove AuthManager, AuthObject, &c.1433+- New tuple-based auth system with handler callbacks.1434+1435+0.7.0 (2011-10-22)1436+------------------1437+1438+- Sessions are now the primary interface.1439+- Deprecated InvalidMethodException.1440+- PATCH fix.1441+- New config system (no more global settings).1442+1443+0.6.6 (2011-10-19)1444+------------------1445+1446+- Session parameter bugfix (params merging).1447+1448+0.6.5 (2011-10-18)1449+------------------1450+1451+- Offline (fast) test suite.1452+- Session dictionary argument merging.1453+1454+0.6.4 (2011-10-13)1455+------------------1456+1457+- Automatic decoding of unicode, based on HTTP Headers.1458+- New `decode_unicode` setting.1459+- Removal of `r.read/close` methods.1460+- New `r.faw` interface for advanced response usage.\*1461+- Automatic expansion of parameterized headers.1462+1463+0.6.3 (2011-10-13)1464+------------------1465+1466+- Beautiful `requests.async` module, for making async requests w/1467+ gevent.1468+1469+0.6.2 (2011-10-09)1470+------------------1471+1472+- GET/HEAD obeys allow\_redirects=False.1473+1474+0.6.1 (2011-08-20)1475+------------------1476+1477+- Enhanced status codes experience `\o/`1478+- Set a maximum number of redirects (`settings.max_redirects`)1479+- Full Unicode URL support1480+- Support for protocol-less redirects.1481+- Allow for arbitrary request types.1482+- Bugfixes1483+1484+0.6.0 (2011-08-17)1485+------------------1486+1487+- New callback hook system1488+- New persistent sessions object and context manager1489+- Transparent Dict-cookie handling1490+- Status code reference object1491+- Removed Response.cached1492+- Added Response.request1493+- All args are kwargs1494+- Relative redirect support1495+- HTTPError handling improvements1496+- Improved https testing1497+- Bugfixes1498+1499+0.5.1 (2011-07-23)1500+------------------1501+1502+- International Domain Name Support!1503+- Access headers without fetching entire body (`read()`)1504+- Use lists as dicts for parameters1505+- Add Forced Basic Authentication1506+- Forced Basic is default authentication type1507+- `python-requests.org` default User-Agent header1508+- CaseInsensitiveDict lower-case caching1509+- Response.history bugfix1510+1511+0.5.0 (2011-06-21)1512+------------------1513+1514+- PATCH Support1515+- Support for Proxies1516+- HTTPBin Test Suite1517+- Redirect Fixes1518+- settings.verbose stream writing1519+- Querystrings for all methods1520+- URLErrors (Connection Refused, Timeout, Invalid URLs) are treated as1521+ explicitly raised1522+ `r.requests.get('hwe://blah'); r.raise_for_status()`1523+1524+0.4.1 (2011-05-22)1525+------------------1526+1527+- Improved Redirection Handling1528+- New 'allow\_redirects' param for following non-GET/HEAD Redirects1529+- Settings module refactoring1530+1531+0.4.0 (2011-05-15)1532+------------------1533+1534+- Response.history: list of redirected responses1535+- Case-Insensitive Header Dictionaries!1536+- Unicode URLs1537+1538+0.3.4 (2011-05-14)1539+------------------1540+1541+- Urllib2 HTTPAuthentication Recursion fix (Basic/Digest)1542+- Internal Refactor1543+- Bytes data upload Bugfix1544+1545+0.3.3 (2011-05-12)1546+------------------1547+1548+- Request timeouts1549+- Unicode url-encoded data1550+- Settings context manager and module1551+1552+0.3.2 (2011-04-15)1553+------------------1554+1555+- Automatic Decompression of GZip Encoded Content1556+- AutoAuth Support for Tupled HTTP Auth1557+1558+0.3.1 (2011-04-01)1559+------------------1560+1561+- Cookie Changes1562+- Response.read()1563+- Poster fix1564+1565+0.3.0 (2011-02-25)1566+------------------1567+1568+- Automatic Authentication API Change1569+- Smarter Query URL Parameterization1570+- Allow file uploads and POST data together1571+- 1572+1573+ New Authentication Manager System1574+1575+ : - Simpler Basic HTTP System1576+ - Supports all build-in urllib2 Auths1577+ - Allows for custom Auth Handlers1578+1579+0.2.4 (2011-02-19)1580+------------------1581+1582+- Python 2.5 Support1583+- PyPy-c v1.4 Support1584+- Auto-Authentication tests1585+- Improved Request object constructor1586+1587+0.2.3 (2011-02-15)1588+------------------1589+1590+- 1591+1592+ New HTTPHandling Methods1593+1594+ : - Response.\_\_nonzero\_\_ (false if bad HTTP Status)1595+ - Response.ok (True if expected HTTP Status)1596+ - Response.error (Logged HTTPError if bad HTTP Status)1597+ - Response.raise\_for\_status() (Raises stored HTTPError)1598+1599+0.2.2 (2011-02-14)1600+------------------1601+1602+- Still handles request in the event of an HTTPError. (Issue \#2)1603+- Eventlet and Gevent Monkeypatch support.1604+- Cookie Support (Issue \#1)1605+1606+0.2.1 (2011-02-14)1607+------------------1608+1609+- Added file attribute to POST and PUT requests for multipart-encode1610+ file uploads.1611+- Added Request.url attribute for context and redirects1612+1613+0.2.0 (2011-02-14)1614+------------------1615+1616+- Birth!1617+1618+0.0.1 (2011-02-13)1619+------------------1620+1621+- Frustration1622+- Conception1623+deleted:HISTORY.rst-1527 removed
1-.. :changelog:2-3-Release History4----------------5-6-dev7-+++8-9-**Improvements**10-11-**Bugfixes**12-13-**Dependencies**14-15-- We now support idna v2.6.16-17-2.18.3 (2017-08-02)18-+++++++++++++++++++19-20-**Improvements**21-22-- Running ``$ python -m requests.help`` now includes the installed version of idna.23-24-**Bugfixes**25-26-- Fixed issue where Requests would raise ``ConnectionError`` instead of27- ``SSLError`` when encountering SSL problems when using urllib3 v1.22.28-29-2.18.2 (2017-07-25)30-+++++++++++++++++++31-32-**Bugfixes**33-34-- ``requests.help`` no longer fails on Python 2.6 due to the absence of35- ``ssl.OPENSSL_VERSION_NUMBER``.36-37-**Dependencies**38-39-- We now support urllib3 v1.22.40-41-2.18.1 (2017-06-14)42-+++++++++++++++++++43-44-**Bugfixes**45-46-- Fix an error in the packaging whereby the *.whl contained incorrect data that47- regressed the fix in v2.17.3.48-49-2.18.0 (2017-06-14)50-+++++++++++++++++++51-52-**Improvements**53-54-- ``Response`` is now a context manager, so can be used directly in a ``with`` statement55- without first having to be wrapped by ``contextlib.closing()``.56-57-**Bugfixes**58-59-- Resolve installation failure if multiprocessing is not available60-- Resolve tests crash if multiprocessing is not able to determine the number of CPU cores61-- Resolve error swallowing in utils set_environ generator62-63-64-2.17.3 (2017-05-29)65-+++++++++++++++++++66-67-**Improvements**68-69-- Improved ``packages`` namespace identity support, for monkeypatching libraries.70-71-72-2.17.2 (2017-05-29)73-+++++++++++++++++++74-75-**Improvements**76-77-- Improved ``packages`` namespace identity support, for monkeypatching libraries.78-79-80-2.17.1 (2017-05-29)81-+++++++++++++++++++82-83-**Improvements**84-85-- Improved ``packages`` namespace identity support, for monkeypatching libraries.86-87-88-2.17.0 (2017-05-29)89-+++++++++++++++++++90-91-**Improvements**92-93-- Removal of the 301 redirect cache. This improves thread-safety.94-95-96-2.16.5 (2017-05-28)97-+++++++++++++++++++98-99-- Improvements to ``$ python -m requests.help``.100-101-2.16.4 (2017-05-27)102-+++++++++++++++++++103-104-- Introduction of the ``$ python -m requests.help`` command, for debugging with maintainers!105-106-2.16.3 (2017-05-27)107-+++++++++++++++++++108-109-- Further restored the ``requests.packages`` namespace for compatibility reasons.110-111-2.16.2 (2017-05-27)112-+++++++++++++++++++113-114-- Further restored the ``requests.packages`` namespace for compatibility reasons.115-116-No code modification (noted below) should be neccessary any longer.117-118-2.16.1 (2017-05-27)119-+++++++++++++++++++120-121-- Restored the ``requests.packages`` namespace for compatibility reasons.122-- Bugfix for ``urllib3`` version parsing.123-124-**Note**: code that was written to import against the ``requests.packages``125-namespace previously will have to import code that rests at this module-level126-now.127-128-For example::129-130- from requests.packages.urllib3.poolmanager import PoolManager131-132-Will need to be re-written to be::133-134- from requests.packages import urllib3135- urllib3.poolmanager.PoolManager136-137-Or, even better::138-139- from urllib3.poolmanager import PoolManager140-141-2.16.0 (2017-05-26)142-+++++++++++++++++++143-144-- Unvendor ALL the things!145-146-2.15.1 (2017-05-26)147-+++++++++++++++++++148-149-- Everyone makes mistakes.150-151-2.15.0 (2017-05-26)152-+++++++++++++++++++153-154-**Improvements**155-156-- Introduction of the ``Response.next`` property, for getting the next157- ``PreparedResponse`` from a redirect chain (when ``allow_redirects=False``).158-- Internal refactoring of ``__version__`` module.159-160-**Bugfixes**161-162-- Restored once-optional parameter for ``requests.utils.get_environ_proxies()``.163-164-2.14.2 (2017-05-10)165-+++++++++++++++++++166-167-**Bugfixes**168-169-- Changed a less-than to an equal-to and an or in the dependency markers to170- widen compatibility with older setuptools releases.171-172-2.14.1 (2017-05-09)173-+++++++++++++++++++174-175-**Bugfixes**176-177-- Changed the dependency markers to widen compatibility with older pip178- releases.179-180-2.14.0 (2017-05-09)181-+++++++++++++++++++182-183-**Improvements**184-185-- It is now possible to pass ``no_proxy`` as a key to the ``proxies``186- dictionary to provide handling similar to the ``NO_PROXY`` environment187- variable.188-- When users provide invalid paths to certificate bundle files or directories189- Requests now raises ``IOError``, rather than failing at the time of the HTTPS190- request with a fairly inscrutable certificate validation error.191-- The behavior of ``SessionRedirectMixin`` was slightly altered.192- ``resolve_redirects`` will now detect a redirect by calling193- ``get_redirect_target(response)`` instead of directly194- querying ``Response.is_redirect`` and ``Response.headers['location']``.195- Advanced users will be able to process malformed redirects more easily.196-- Changed the internal calculation of elapsed request time to have higher197- resolution on Windows.198-- Added ``win_inet_pton`` as conditional dependency for the ``[socks]`` extra199- on Windows with Python 2.7.200-- Changed the proxy bypass implementation on Windows: the proxy bypass201- check doesn't use forward and reverse DNS requests anymore202-- URLs with schemes that begin with ``http`` but are not ``http`` or ``https``203- no longer have their host parts forced to lowercase.204-205-**Bugfixes**206-207-- Much improved handling of non-ASCII ``Location`` header values in redirects.208- Fewer ``UnicodeDecodeErrors`` are encountered on Python 2, and Python 3 now209- correctly understands that Latin-1 is unlikely to be the correct encoding.210-- If an attempt to ``seek`` file to find out its length fails, we now211- appropriately handle that by aborting our content-length calculations.212-- Restricted ``HTTPDigestAuth`` to only respond to auth challenges made on 4XX213- responses, rather than to all auth challenges.214-- Fixed some code that was firing ``DeprecationWarning`` on Python 3.6.215-- The dismayed person emoticon (``/o\\``) no longer has a big head. I'm sure216- this is what you were all worrying about most.217-218-219-**Miscellaneous**220-221-- Updated bundled urllib3 to v1.21.1.222-- Updated bundled chardet to v3.0.2.223-- Updated bundled idna to v2.5.224-- Updated bundled certifi to 2017.4.17.225-226-2.13.0 (2017-01-24)227-+++++++++++++++++++228-229-**Features**230-231-- Only load the ``idna`` library when we've determined we need it. This will232- save some memory for users.233-234-**Miscellaneous**235-236-- Updated bundled urllib3 to 1.20.237-- Updated bundled idna to 2.2.238-239-2.12.5 (2017-01-18)240-+++++++++++++++++++241-242-**Bugfixes**243-244-- Fixed an issue with JSON encoding detection, specifically detecting245- big-endian UTF-32 with BOM.246-247-2.12.4 (2016-12-14)248-+++++++++++++++++++249-250-**Bugfixes**251-252-- Fixed regression from 2.12.2 where non-string types were rejected in the253- basic auth parameters. While support for this behaviour has been readded,254- the behaviour is deprecated and will be removed in the future.255-256-2.12.3 (2016-12-01)257-+++++++++++++++++++258-259-**Bugfixes**260-261-- Fixed regression from v2.12.1 for URLs with schemes that begin with "http".262- These URLs have historically been processed as though they were HTTP-schemed263- URLs, and so have had parameters added. This was removed in v2.12.2 in an264- overzealous attempt to resolve problems with IDNA-encoding those URLs. This265- change was reverted: the other fixes for IDNA-encoding have been judged to266- be sufficient to return to the behaviour Requests had before v2.12.0.267-268-2.12.2 (2016-11-30)269-+++++++++++++++++++270-271-**Bugfixes**272-273-- Fixed several issues with IDNA-encoding URLs that are technically invalid but274- which are widely accepted. Requests will now attempt to IDNA-encode a URL if275- it can but, if it fails, and the host contains only ASCII characters, it will276- be passed through optimistically. This will allow users to opt-in to using277- IDNA2003 themselves if they want to, and will also allow technically invalid278- but still common hostnames.279-- Fixed an issue where URLs with leading whitespace would raise280- ``InvalidSchema`` errors.281-- Fixed an issue where some URLs without the HTTP or HTTPS schemes would still282- have HTTP URL preparation applied to them.283-- Fixed an issue where Unicode strings could not be used in basic auth.284-- Fixed an issue encountered by some Requests plugins where constructing a285- Response object would cause ``Response.content`` to raise an286- ``AttributeError``.287-288-2.12.1 (2016-11-16)289-+++++++++++++++++++290-291-**Bugfixes**292-293-- Updated setuptools 'security' extra for the new PyOpenSSL backend in urllib3.294-295-**Miscellaneous**296-297-- Updated bundled urllib3 to 1.19.1.298-299-2.12.0 (2016-11-15)300-+++++++++++++++++++301-302-**Improvements**303-304-- Updated support for internationalized domain names from IDNA2003 to IDNA2008.305- This updated support is required for several forms of IDNs and is mandatory306- for .de domains.307-- Much improved heuristics for guessing content lengths: Requests will no308- longer read an entire ``StringIO`` into memory.309-- Much improved logic for recalculating ``Content-Length`` headers for310- ``PreparedRequest`` objects.311-- Improved tolerance for file-like objects that have no ``tell`` method but312- do have a ``seek`` method.313-- Anything that is a subclass of ``Mapping`` is now treated like a dictionary314- by the ``data=`` keyword argument.315-- Requests now tolerates empty passwords in proxy credentials, rather than316- stripping the credentials.317-- If a request is made with a file-like object as the body and that request is318- redirected with a 307 or 308 status code, Requests will now attempt to319- rewind the body object so it can be replayed.320-321-**Bugfixes**322-323-- When calling ``response.close``, the call to ``close`` will be propagated324- through to non-urllib3 backends.325-- Fixed issue where the ``ALL_PROXY`` environment variable would be preferred326- over scheme-specific variables like ``HTTP_PROXY``.327-- Fixed issue where non-UTF8 reason phrases got severely mangled by falling328- back to decoding using ISO 8859-1 instead.329-- Fixed a bug where Requests would not correctly correlate cookies set when330- using custom Host headers if those Host headers did not use the native331- string type for the platform.332-333-**Miscellaneous**334-335-- Updated bundled urllib3 to 1.19.336-- Updated bundled certifi certs to 2016.09.26.337-338-2.11.1 (2016-08-17)339-+++++++++++++++++++340-341-**Bugfixes**342-343-- Fixed a bug when using ``iter_content`` with ``decode_unicode=True`` for344- streamed bodies would raise ``AttributeError``. This bug was introduced in345- 2.11.346-- Strip Content-Type and Transfer-Encoding headers from the header block when347- following a redirect that transforms the verb from POST/PUT to GET.348-349-2.11.0 (2016-08-08)350-+++++++++++++++++++351-352-**Improvements**353-354-- Added support for the ``ALL_PROXY`` environment variable.355-- Reject header values that contain leading whitespace or newline characters to356- reduce risk of header smuggling.357-358-**Bugfixes**359-360-- Fixed occasional ``TypeError`` when attempting to decode a JSON response that361- occurred in an error case. Now correctly returns a ``ValueError``.362-- Requests would incorrectly ignore a non-CIDR IP address in the ``NO_PROXY``363- environment variables: Requests now treats it as a specific IP.364-- Fixed a bug when sending JSON data that could cause us to encounter obscure365- OpenSSL errors in certain network conditions (yes, really).366-- Added type checks to ensure that ``iter_content`` only accepts integers and367- ``None`` for chunk sizes.368-- Fixed issue where responses whose body had not been fully consumed would have369- the underlying connection closed but not returned to the connection pool,370- which could cause Requests to hang in situations where the ``HTTPAdapter``371- had been configured to use a blocking connection pool.372-373-**Miscellaneous**374-375-- Updated bundled urllib3 to 1.16.376-- Some previous releases accidentally accepted non-strings as acceptable header values. This release does not.377-378-2.10.0 (2016-04-29)379-+++++++++++++++++++380-381-**New Features**382-383-- SOCKS Proxy Support! (requires PySocks; ``$ pip install requests[socks]``)384-385-**Miscellaneous**386-387-- Updated bundled urllib3 to 1.15.1.388-389-2.9.2 (2016-04-29)390-++++++++++++++++++391-392-**Improvements**393-394-- Change built-in CaseInsensitiveDict (used for headers) to use OrderedDict395- as its underlying datastore.396-397-**Bugfixes**398-399-- Don't use redirect_cache if allow_redirects=False400-- When passed objects that throw exceptions from ``tell()``, send them via401- chunked transfer encoding instead of failing.402-- Raise a ProxyError for proxy related connection issues.403-404-2.9.1 (2015-12-21)405-++++++++++++++++++406-407-**Bugfixes**408-409-- Resolve regression introduced in 2.9.0 that made it impossible to send binary410- strings as bodies in Python 3.411-- Fixed errors when calculating cookie expiration dates in certain locales.412-413-**Miscellaneous**414-415-- Updated bundled urllib3 to 1.13.1.416-417-2.9.0 (2015-12-15)418-++++++++++++++++++419-420-**Minor Improvements** (Backwards compatible)421-422-- The ``verify`` keyword argument now supports being passed a path to a423- directory of CA certificates, not just a single-file bundle.424-- Warnings are now emitted when sending files opened in text mode.425-- Added the 511 Network Authentication Required status code to the status code426- registry.427-428-**Bugfixes**429-430-- For file-like objects that are not seeked to the very beginning, we now431- send the content length for the number of bytes we will actually read, rather432- than the total size of the file, allowing partial file uploads.433-- When uploading file-like objects, if they are empty or have no obvious434- content length we set ``Transfer-Encoding: chunked`` rather than435- ``Content-Length: 0``.436-- We correctly receive the response in buffered mode when uploading chunked437- bodies.438-- We now handle being passed a query string as a bytestring on Python 3, by439- decoding it as UTF-8.440-- Sessions are now closed in all cases (exceptional and not) when using the441- functional API rather than leaking and waiting for the garbage collector to442- clean them up.443-- Correctly handle digest auth headers with a malformed ``qop`` directive that444- contains no token, by treating it the same as if no ``qop`` directive was445- provided at all.446-- Minor performance improvements when removing specific cookies by name.447-448-**Miscellaneous**449-450-- Updated urllib3 to 1.13.451-452-2.8.1 (2015-10-13)453-++++++++++++++++++454-455-**Bugfixes**456-457-- Update certificate bundle to match ``certifi`` 2015.9.6.2's weak certificate458- bundle.459-- Fix a bug in 2.8.0 where requests would raise ``ConnectTimeout`` instead of460- ``ConnectionError``461-- When using the PreparedRequest flow, requests will now correctly respect the462- ``json`` parameter. Broken in 2.8.0.463-- When using the PreparedRequest flow, requests will now correctly handle a464- Unicode-string method name on Python 2. Broken in 2.8.0.465-466-2.8.0 (2015-10-05)467-++++++++++++++++++468-469-**Minor Improvements** (Backwards Compatible)470-471-- Requests now supports per-host proxies. This allows the ``proxies``472- dictionary to have entries of the form473- ``{'<scheme>://<hostname>': '<proxy>'}``. Host-specific proxies will be used474- in preference to the previously-supported scheme-specific ones, but the475- previous syntax will continue to work.476-- ``Response.raise_for_status`` now prints the URL that failed as part of the477- exception message.478-- ``requests.utils.get_netrc_auth`` now takes an ``raise_errors`` kwarg,479- defaulting to ``False``. When ``True``, errors parsing ``.netrc`` files cause480- exceptions to be thrown.481-- Change to bundled projects import logic to make it easier to unbundle482- requests downstream.483-- Changed the default User-Agent string to avoid leaking data on Linux: now484- contains only the requests version.485-486-**Bugfixes**487-488-- The ``json`` parameter to ``post()`` and friends will now only be used if489- neither ``data`` nor ``files`` are present, consistent with the490- documentation.491-- We now ignore empty fields in the ``NO_PROXY`` environment variable.492-- Fixed problem where ``httplib.BadStatusLine`` would get raised if combining493- ``stream=True`` with ``contextlib.closing``.494-- Prevented bugs where we would attempt to return the same connection back to495- the connection pool twice when sending a Chunked body.496-- Miscellaneous minor internal changes.497-- Digest Auth support is now thread safe.498-499-**Updates**500-501-- Updated urllib3 to 1.12.502-503-2.7.0 (2015-05-03)504-++++++++++++++++++505-506-This is the first release that follows our new release process. For more, see507-`our documentation508-<http://docs.python-requests.org/en/latest/community/release-process/>`_.509-510-**Bugfixes**511-512-- Updated urllib3 to 1.10.4, resolving several bugs involving chunked transfer513- encoding and response framing.514-515-2.6.2 (2015-04-23)516-++++++++++++++++++517-518-**Bugfixes**519-520-- Fix regression where compressed data that was sent as chunked data was not521- properly decompressed. (#2561)522-523-2.6.1 (2015-04-22)524-++++++++++++++++++525-526-**Bugfixes**527-528-- Remove VendorAlias import machinery introduced in v2.5.2.529-530-- Simplify the PreparedRequest.prepare API: We no longer require the user to531- pass an empty list to the hooks keyword argument. (c.f. #2552)532-533-- Resolve redirects now receives and forwards all of the original arguments to534- the adapter. (#2503)535-536-- Handle UnicodeDecodeErrors when trying to deal with a unicode URL that537- cannot be encoded in ASCII. (#2540)538-539-- Populate the parsed path of the URI field when performing Digest540- Authentication. (#2426)541-542-- Copy a PreparedRequest's CookieJar more reliably when it is not an instance543- of RequestsCookieJar. (#2527)544-545-2.6.0 (2015-03-14)546-++++++++++++++++++547-548-**Bugfixes**549-550-- CVE-2015-2296: Fix handling of cookies on redirect. Previously a cookie551- without a host value set would use the hostname for the redirected URL552- exposing requests users to session fixation attacks and potentially cookie553- stealing. This was disclosed privately by Matthew Daley of554- `BugFuzz <https://bugfuzz.com>`_. This affects all versions of requests from555- v2.1.0 to v2.5.3 (inclusive on both ends).556-557-- Fix error when requests is an ``install_requires`` dependency and ``python558- setup.py test`` is run. (#2462)559-560-- Fix error when urllib3 is unbundled and requests continues to use the561- vendored import location.562-563-- Include fixes to ``urllib3``'s header handling.564-565-- Requests' handling of unvendored dependencies is now more restrictive.566-567-**Features and Improvements**568-569-- Support bytearrays when passed as parameters in the ``files`` argument.570- (#2468)571-572-- Avoid data duplication when creating a request with ``str``, ``bytes``, or573- ``bytearray`` input to the ``files`` argument.574-575-2.5.3 (2015-02-24)576-++++++++++++++++++577-578-**Bugfixes**579-580-- Revert changes to our vendored certificate bundle. For more context see581- (#2455, #2456, and http://bugs.python.org/issue23476)582-583-2.5.2 (2015-02-23)584-++++++++++++++++++585-586-**Features and Improvements**587-588-- Add sha256 fingerprint support. (`shazow/urllib3#540`_)589-590-- Improve the performance of headers. (`shazow/urllib3#544`_)591-592-**Bugfixes**593-594-- Copy pip's import machinery. When downstream redistributors remove595- requests.packages.urllib3 the import machinery will continue to let those596- same symbols work. Example usage in requests' documentation and 3rd-party597- libraries relying on the vendored copies of urllib3 will work without having598- to fallback to the system urllib3.599-600-- Attempt to quote parts of the URL on redirect if unquoting and then quoting601- fails. (#2356)602-603-- Fix filename type check for multipart form-data uploads. (#2411)604-605-- Properly handle the case where a server issuing digest authentication606- challenges provides both auth and auth-int qop-values. (#2408)607-608-- Fix a socket leak. (`shazow/urllib3#549`_)609-610-- Fix multiple ``Set-Cookie`` headers properly. (`shazow/urllib3#534`_)611-612-- Disable the built-in hostname verification. (`shazow/urllib3#526`_)613-614-- Fix the behaviour of decoding an exhausted stream. (`shazow/urllib3#535`_)615-616-**Security**617-618-- Pulled in an updated ``cacert.pem``.619-620-- Drop RC4 from the default cipher list. (`shazow/urllib3#551`_)621-622-.. _shazow/urllib3#551: https://github.com/shazow/urllib3/pull/551623-.. _shazow/urllib3#549: https://github.com/shazow/urllib3/pull/549624-.. _shazow/urllib3#544: https://github.com/shazow/urllib3/pull/544625-.. _shazow/urllib3#540: https://github.com/shazow/urllib3/pull/540626-.. _shazow/urllib3#535: https://github.com/shazow/urllib3/pull/535627-.. _shazow/urllib3#534: https://github.com/shazow/urllib3/pull/534628-.. _shazow/urllib3#526: https://github.com/shazow/urllib3/pull/526629-630-2.5.1 (2014-12-23)631-++++++++++++++++++632-633-**Behavioural Changes**634-635-- Only catch HTTPErrors in raise_for_status (#2382)636-637-**Bugfixes**638-639-- Handle LocationParseError from urllib3 (#2344)640-- Handle file-like object filenames that are not strings (#2379)641-- Unbreak HTTPDigestAuth handler. Allow new nonces to be negotiated (#2389)642-643-2.5.0 (2014-12-01)644-++++++++++++++++++645-646-**Improvements**647-648-- Allow usage of urllib3's Retry object with HTTPAdapters (#2216)649-- The ``iter_lines`` method on a response now accepts a delimiter with which650- to split the content (#2295)651-652-**Behavioural Changes**653-654-- Add deprecation warnings to functions in requests.utils that will be removed655- in 3.0 (#2309)656-- Sessions used by the functional API are always closed (#2326)657-- Restrict requests to HTTP/1.1 and HTTP/1.0 (stop accepting HTTP/0.9) (#2323)658-659-**Bugfixes**660-661-- Only parse the URL once (#2353)662-- Allow Content-Length header to always be overridden (#2332)663-- Properly handle files in HTTPDigestAuth (#2333)664-- Cap redirect_cache size to prevent memory abuse (#2299)665-- Fix HTTPDigestAuth handling of redirects after authenticating successfully666- (#2253)667-- Fix crash with custom method parameter to Session.request (#2317)668-- Fix how Link headers are parsed using the regular expression library (#2271)669-670-**Documentation**671-672-- Add more references for interlinking (#2348)673-- Update CSS for theme (#2290)674-- Update width of buttons and sidebar (#2289)675-- Replace references of Gittip with Gratipay (#2282)676-- Add link to changelog in sidebar (#2273)677-678-2.4.3 (2014-10-06)679-++++++++++++++++++680-681-**Bugfixes**682-683-- Unicode URL improvements for Python 2.684-- Re-order JSON param for backwards compat.685-- Automatically defrag authentication schemes from host/pass URIs. (`#2249 <https://github.com/requests/requests/issues/2249>`_)686-687-688-2.4.2 (2014-10-05)689-++++++++++++++++++690-691-**Improvements**692-693-- FINALLY! Add json parameter for uploads! (`#2258 <https://github.com/requests/requests/pull/2258>`_)694-- Support for bytestring URLs on Python 3.x (`#2238 <https://github.com/requests/requests/pull/2238>`_)695-696-**Bugfixes**697-698-- Avoid getting stuck in a loop (`#2244 <https://github.com/requests/requests/pull/2244>`_)699-- Multiple calls to iter* fail with unhelpful error. (`#2240 <https://github.com/requests/requests/issues/2240>`_, `#2241 <https://github.com/requests/requests/issues/2241>`_)700-701-**Documentation**702-703-- Correct redirection introduction (`#2245 <https://github.com/requests/requests/pull/2245/>`_)704-- Added example of how to send multiple files in one request. (`#2227 <https://github.com/requests/requests/pull/2227/>`_)705-- Clarify how to pass a custom set of CAs (`#2248 <https://github.com/requests/requests/pull/2248/>`_)706-707-708-709-2.4.1 (2014-09-09)710-++++++++++++++++++711-712-- Now has a "security" package extras set, ``$ pip install requests[security]``713-- Requests will now use Certifi if it is available.714-- Capture and re-raise urllib3 ProtocolError715-- Bugfix for responses that attempt to redirect to themselves forever (wtf?).716-717-718-2.4.0 (2014-08-29)719-++++++++++++++++++720-721-**Behavioral Changes**722-723-- ``Connection: keep-alive`` header is now sent automatically.724-725-**Improvements**726-727-- Support for connect timeouts! Timeout now accepts a tuple (connect, read) which is used to set individual connect and read timeouts.728-- Allow copying of PreparedRequests without headers/cookies.729-- Updated bundled urllib3 version.730-- Refactored settings loading from environment -- new `Session.merge_environment_settings`.731-- Handle socket errors in iter_content.732-733-734-2.3.0 (2014-05-16)735-++++++++++++++++++736-737-**API Changes**738-739-- New ``Response`` property ``is_redirect``, which is true when the740- library could have processed this response as a redirection (whether741- or not it actually did).742-- The ``timeout`` parameter now affects requests with both ``stream=True`` and743- ``stream=False`` equally.744-- The change in v2.0.0 to mandate explicit proxy schemes has been reverted.745- Proxy schemes now default to ``http://``.746-- The ``CaseInsensitiveDict`` used for HTTP headers now behaves like a normal747- dictionary when references as string or viewed in the interpreter.748-749-**Bugfixes**750-751-- No longer expose Authorization or Proxy-Authorization headers on redirect.752- Fix CVE-2014-1829 and CVE-2014-1830 respectively.753-- Authorization is re-evaluated each redirect.754-- On redirect, pass url as native strings.755-- Fall-back to autodetected encoding for JSON when Unicode detection fails.756-- Headers set to ``None`` on the ``Session`` are now correctly not sent.757-- Correctly honor ``decode_unicode`` even if it wasn't used earlier in the same758- response.759-- Stop advertising ``compress`` as a supported Content-Encoding.760-- The ``Response.history`` parameter is now always a list.761-- Many, many ``urllib3`` bugfixes.762-763-2.2.1 (2014-01-23)764-++++++++++++++++++765-766-**Bugfixes**767-768-- Fixes incorrect parsing of proxy credentials that contain a literal or encoded '#' character.769-- Assorted urllib3 fixes.770-771-2.2.0 (2014-01-09)772-++++++++++++++++++773-774-**API Changes**775-776-- New exception: ``ContentDecodingError``. Raised instead of ``urllib3``777- ``DecodeError`` exceptions.778-779-**Bugfixes**780-781-- Avoid many many exceptions from the buggy implementation of ``proxy_bypass`` on OS X in Python 2.6.782-- Avoid crashing when attempting to get authentication credentials from ~/.netrc when running as a user without a home directory.783-- Use the correct pool size for pools of connections to proxies.784-- Fix iteration of ``CookieJar`` objects.785-- Ensure that cookies are persisted over redirect.786-- Switch back to using chardet, since it has merged with charade.787-788-2.1.0 (2013-12-05)789-++++++++++++++++++790-791-- Updated CA Bundle, of course.792-- Cookies set on individual Requests through a ``Session`` (e.g. via ``Session.get()``) are no longer persisted to the ``Session``.793-- Clean up connections when we hit problems during chunked upload, rather than leaking them.794-- Return connections to the pool when a chunked upload is successful, rather than leaking it.795-- Match the HTTPbis recommendation for HTTP 301 redirects.796-- Prevent hanging when using streaming uploads and Digest Auth when a 401 is received.797-- Values of headers set by Requests are now always the native string type.798-- Fix previously broken SNI support.799-- Fix accessing HTTP proxies using proxy authentication.800-- Unencode HTTP Basic usernames and passwords extracted from URLs.801-- Support for IP address ranges for no_proxy environment variable802-- Parse headers correctly when users override the default ``Host:`` header.803-- Avoid munging the URL in case of case-sensitive servers.804-- Looser URL handling for non-HTTP/HTTPS urls.805-- Accept unicode methods in Python 2.6 and 2.7.806-- More resilient cookie handling.807-- Make ``Response`` objects pickleable.808-- Actually added MD5-sess to Digest Auth instead of pretending to like last time.809-- Updated internal urllib3.810-- Fixed @Lukasa's lack of taste.811-812-2.0.1 (2013-10-24)813-++++++++++++++++++814-815-- Updated included CA Bundle with new mistrusts and automated process for the future816-- Added MD5-sess to Digest Auth817-- Accept per-file headers in multipart file POST messages.818-- Fixed: Don't send the full URL on CONNECT messages.819-- Fixed: Correctly lowercase a redirect scheme.820-- Fixed: Cookies not persisted when set via functional API.821-- Fixed: Translate urllib3 ProxyError into a requests ProxyError derived from ConnectionError.822-- Updated internal urllib3 and chardet.823-824-2.0.0 (2013-09-24)825-++++++++++++++++++826-827-**API Changes:**828-829-- Keys in the Headers dictionary are now native strings on all Python versions,830- i.e. bytestrings on Python 2, unicode on Python 3.831-- Proxy URLs now *must* have an explicit scheme. A ``MissingSchema`` exception832- will be raised if they don't.833-- Timeouts now apply to read time if ``Stream=False``.834-- ``RequestException`` is now a subclass of ``IOError``, not ``RuntimeError``.835-- Added new method to ``PreparedRequest`` objects: ``PreparedRequest.copy()``.836-- Added new method to ``Session`` objects: ``Session.update_request()``. This837- method updates a ``Request`` object with the data (e.g. cookies) stored on838- the ``Session``.839-- Added new method to ``Session`` objects: ``Session.prepare_request()``. This840- method updates and prepares a ``Request`` object, and returns the841- corresponding ``PreparedRequest`` object.842-- Added new method to ``HTTPAdapter`` objects: ``HTTPAdapter.proxy_headers()``.843- This should not be called directly, but improves the subclass interface.844-- ``httplib.IncompleteRead`` exceptions caused by incorrect chunked encoding845- will now raise a Requests ``ChunkedEncodingError`` instead.846-- Invalid percent-escape sequences now cause a Requests ``InvalidURL``847- exception to be raised.848-- HTTP 208 no longer uses reason phrase ``"im_used"``. Correctly uses849- ``"already_reported"``.850-- HTTP 226 reason added (``"im_used"``).851-852-**Bugfixes:**853-854-- Vastly improved proxy support, including the CONNECT verb. Special thanks to855- the many contributors who worked towards this improvement.856-- Cookies are now properly managed when 401 authentication responses are857- received.858-- Chunked encoding fixes.859-- Support for mixed case schemes.860-- Better handling of streaming downloads.861-- Retrieve environment proxies from more locations.862-- Minor cookies fixes.863-- Improved redirect behaviour.864-- Improved streaming behaviour, particularly for compressed data.865-- Miscellaneous small Python 3 text encoding bugs.866-- ``.netrc`` no longer overrides explicit auth.867-- Cookies set by hooks are now correctly persisted on Sessions.868-- Fix problem with cookies that specify port numbers in their host field.869-- ``BytesIO`` can be used to perform streaming uploads.870-- More generous parsing of the ``no_proxy`` environment variable.871-- Non-string objects can be passed in data values alongside files.872-873-1.2.3 (2013-05-25)874-++++++++++++++++++875-876-- Simple packaging fix877-878-879-1.2.2 (2013-05-23)880-++++++++++++++++++881-882-- Simple packaging fix883-884-885-1.2.1 (2013-05-20)886-++++++++++++++++++887-888-- 301 and 302 redirects now change the verb to GET for all verbs, not just889- POST, improving browser compatibility.890-- Python 3.3.2 compatibility891-- Always percent-encode location headers892-- Fix connection adapter matching to be most-specific first893-- new argument to the default connection adapter for passing a block argument894-- prevent a KeyError when there's no link headers895-896-1.2.0 (2013-03-31)897-++++++++++++++++++898-899-- Fixed cookies on sessions and on requests900-- Significantly change how hooks are dispatched - hooks now receive all the901- arguments specified by the user when making a request so hooks can make a902- secondary request with the same parameters. This is especially necessary for903- authentication handler authors904-- certifi support was removed905-- Fixed bug where using OAuth 1 with body ``signature_type`` sent no data906-- Major proxy work thanks to @Lukasa including parsing of proxy authentication907- from the proxy url908-- Fix DigestAuth handling too many 401s909-- Update vendored urllib3 to include SSL bug fixes910-- Allow keyword arguments to be passed to ``json.loads()`` via the911- ``Response.json()`` method912-- Don't send ``Content-Length`` header by default on ``GET`` or ``HEAD``913- requests914-- Add ``elapsed`` attribute to ``Response`` objects to time how long a request915- took.916-- Fix ``RequestsCookieJar``917-- Sessions and Adapters are now picklable, i.e., can be used with the918- multiprocessing library919-- Update charade to version 1.0.3920-921-The change in how hooks are dispatched will likely cause a great deal of922-issues.923-924-1.1.0 (2013-01-10)925-++++++++++++++++++926-927-- CHUNKED REQUESTS928-- Support for iterable response bodies929-- Assume servers persist redirect params930-- Allow explicit content types to be specified for file data931-- Make merge_kwargs case-insensitive when looking up keys932-933-1.0.3 (2012-12-18)934-++++++++++++++++++935-936-- Fix file upload encoding bug937-- Fix cookie behavior938-939-1.0.2 (2012-12-17)940-++++++++++++++++++941-942-- Proxy fix for HTTPAdapter.943-944-1.0.1 (2012-12-17)945-++++++++++++++++++946-947-- Cert verification exception bug.948-- Proxy fix for HTTPAdapter.949-950-1.0.0 (2012-12-17)951-++++++++++++++++++952-953-- Massive Refactor and Simplification954-- Switch to Apache 2.0 license955-- Swappable Connection Adapters956-- Mountable Connection Adapters957-- Mutable ProcessedRequest chain958-- /s/prefetch/stream959-- Removal of all configuration960-- Standard library logging961-- Make Response.json() callable, not property.962-- Usage of new charade project, which provides python 2 and 3 simultaneous chardet.963-- Removal of all hooks except 'response'964-- Removal of all authentication helpers (OAuth, Kerberos)965-966-This is not a backwards compatible change.967-968-0.14.2 (2012-10-27)969-+++++++++++++++++++970-971-- Improved mime-compatible JSON handling972-- Proxy fixes973-- Path hack fixes974-- Case-Insensitive Content-Encoding headers975-- Support for CJK parameters in form posts976-977-978-0.14.1 (2012-10-01)979-+++++++++++++++++++980-981-- Python 3.3 Compatibility982-- Simply default accept-encoding983-- Bugfixes984-985-986-0.14.0 (2012-09-02)987-++++++++++++++++++++988-989-- No more iter_content errors if already downloaded.990-991-0.13.9 (2012-08-25)992-+++++++++++++++++++993-994-- Fix for OAuth + POSTs995-- Remove exception eating from dispatch_hook996-- General bugfixes997-998-0.13.8 (2012-08-21)999-+++++++++++++++++++1000-1001-- Incredible Link header support :)1002-1003-0.13.7 (2012-08-19)1004-+++++++++++++++++++1005-1006-- Support for (key, value) lists everywhere.1007-- Digest Authentication improvements.1008-- Ensure proxy exclusions work properly.1009-- Clearer UnicodeError exceptions.1010-- Automatic casting of URLs to strings (fURL and such)1011-- Bugfixes.1012-1013-0.13.6 (2012-08-06)1014-+++++++++++++++++++1015-1016-- Long awaited fix for hanging connections!1017-1018-0.13.5 (2012-07-27)1019-+++++++++++++++++++1020-1021-- Packaging fix1022-1023-0.13.4 (2012-07-27)1024-+++++++++++++++++++1025-1026-- GSSAPI/Kerberos authentication!1027-- App Engine 2.7 Fixes!1028-- Fix leaking connections (from urllib3 update)1029-- OAuthlib path hack fix1030-- OAuthlib URL parameters fix.1031-1032-0.13.3 (2012-07-12)1033-+++++++++++++++++++1034-1035-- Use simplejson if available.1036-- Do not hide SSLErrors behind Timeouts.1037-- Fixed param handling with urls containing fragments.1038-- Significantly improved information in User Agent.1039-- client certificates are ignored when verify=False1040-1041-0.13.2 (2012-06-28)1042-+++++++++++++++++++1043-1044-- Zero dependencies (once again)!1045-- New: Response.reason1046-- Sign querystring parameters in OAuth 1.01047-- Client certificates no longer ignored when verify=False1048-- Add openSUSE certificate support1049-1050-0.13.1 (2012-06-07)1051-+++++++++++++++++++1052-1053-- Allow passing a file or file-like object as data.1054-- Allow hooks to return responses that indicate errors.1055-- Fix Response.text and Response.json for body-less responses.1056-1057-0.13.0 (2012-05-29)1058-+++++++++++++++++++1059-1060-- Removal of Requests.async in favor of `grequests <https://github.com/kennethreitz/grequests>`_1061-- Allow disabling of cookie persistence.1062-- New implementation of safe_mode1063-- cookies.get now supports default argument1064-- Session cookies not saved when Session.request is called with return_response=False1065-- Env: no_proxy support.1066-- RequestsCookieJar improvements.1067-- Various bug fixes.1068-1069-0.12.1 (2012-05-08)1070-+++++++++++++++++++1071-1072-- New ``Response.json`` property.1073-- Ability to add string file uploads.1074-- Fix out-of-range issue with iter_lines.1075-- Fix iter_content default size.1076-- Fix POST redirects containing files.1077-1078-0.12.0 (2012-05-02)1079-+++++++++++++++++++1080-1081-- EXPERIMENTAL OAUTH SUPPORT!1082-- Proper CookieJar-backed cookies interface with awesome dict-like interface.1083-- Speed fix for non-iterated content chunks.1084-- Move ``pre_request`` to a more usable place.1085-- New ``pre_send`` hook.1086-- Lazily encode data, params, files.1087-- Load system Certificate Bundle if ``certify`` isn't available.1088-- Cleanups, fixes.1089-1090-0.11.2 (2012-04-22)1091-+++++++++++++++++++1092-1093-- Attempt to use the OS's certificate bundle if ``certifi`` isn't available.1094-- Infinite digest auth redirect fix.1095-- Multi-part file upload improvements.1096-- Fix decoding of invalid %encodings in URLs.1097-- If there is no content in a response don't throw an error the second time that content is attempted to be read.1098-- Upload data on redirects.1099-1100-0.11.1 (2012-03-30)1101-+++++++++++++++++++1102-1103-* POST redirects now break RFC to do what browsers do: Follow up with a GET.1104-* New ``strict_mode`` configuration to disable new redirect behavior.1105-1106-1107-0.11.0 (2012-03-14)1108-+++++++++++++++++++1109-1110-* Private SSL Certificate support1111-* Remove select.poll from Gevent monkeypatching1112-* Remove redundant generator for chunked transfer encoding1113-* Fix: Response.ok raises Timeout Exception in safe_mode1114-1115-0.10.8 (2012-03-09)1116-+++++++++++++++++++1117-1118-* Generate chunked ValueError fix1119-* Proxy configuration by environment variables1120-* Simplification of iter_lines.1121-* New `trust_env` configuration for disabling system/environment hints.1122-* Suppress cookie errors.1123-1124-0.10.7 (2012-03-07)1125-+++++++++++++++++++1126-1127-* `encode_uri` = False1128-1129-0.10.6 (2012-02-25)1130-+++++++++++++++++++1131-1132-* Allow '=' in cookies.1133-1134-0.10.5 (2012-02-25)1135-+++++++++++++++++++1136-1137-* Response body with 0 content-length fix.1138-* New async.imap.1139-* Don't fail on netrc.1140-1141-1142-0.10.4 (2012-02-20)1143-+++++++++++++++++++1144-1145-* Honor netrc.1146-1147-0.10.3 (2012-02-20)1148-+++++++++++++++++++1149-1150-* HEAD requests don't follow redirects anymore.1151-* raise_for_status() doesn't raise for 3xx anymore.1152-* Make Session objects picklable.1153-* ValueError for invalid schema URLs.1154-1155-0.10.2 (2012-01-15)1156-+++++++++++++++++++1157-1158-* Vastly improved URL quoting.1159-* Additional allowed cookie key values.1160-* Attempted fix for "Too many open files" Error1161-* Replace unicode errors on first pass, no need for second pass.1162-* Append '/' to bare-domain urls before query insertion.1163-* Exceptions now inherit from RuntimeError.1164-* Binary uploads + auth fix.1165-* Bugfixes.1166-1167-1168-0.10.1 (2012-01-23)1169-+++++++++++++++++++1170-1171-* PYTHON 3 SUPPORT!1172-* Dropped 2.5 Support. (*Backwards Incompatible*)1173-1174-0.10.0 (2012-01-21)1175-+++++++++++++++++++1176-1177-* ``Response.content`` is now bytes-only. (*Backwards Incompatible*)1178-* New ``Response.text`` is unicode-only.1179-* If no ``Response.encoding`` is specified and ``chardet`` is available, ``Response.text`` will guess an encoding.1180-* Default to ISO-8859-1 (Western) encoding for "text" subtypes.1181-* Removal of `decode_unicode`. (*Backwards Incompatible*)1182-* New multiple-hooks system.1183-* New ``Response.register_hook`` for registering hooks within the pipeline.1184-* ``Response.url`` is now Unicode.1185-1186-0.9.3 (2012-01-18)1187-++++++++++++++++++1188-1189-* SSL verify=False bugfix (apparent on windows machines).1190-1191-0.9.2 (2012-01-18)1192-++++++++++++++++++1193-1194-* Asynchronous async.send method.1195-* Support for proper chunk streams with boundaries.1196-* session argument for Session classes.1197-* Print entire hook tracebacks, not just exception instance.1198-* Fix response.iter_lines from pending next line.1199-* Fix but in HTTP-digest auth w/ URI having query strings.1200-* Fix in Event Hooks section.1201-* Urllib3 update.1202-1203-1204-0.9.1 (2012-01-06)1205-++++++++++++++++++1206-1207-* danger_mode for automatic Response.raise_for_status()1208-* Response.iter_lines refactor1209-1210-0.9.0 (2011-12-28)1211-++++++++++++++++++1212-1213-* verify ssl is default.1214-1215-1216-0.8.9 (2011-12-28)1217-++++++++++++++++++1218-1219-* Packaging fix.1220-1221-1222-0.8.8 (2011-12-28)1223-++++++++++++++++++1224-1225-* SSL CERT VERIFICATION!1226-* Release of Cerifi: Mozilla's cert list.1227-* New 'verify' argument for SSL requests.1228-* Urllib3 update.1229-1230-0.8.7 (2011-12-24)1231-++++++++++++++++++1232-1233-* iter_lines last-line truncation fix1234-* Force safe_mode for async requests1235-* Handle safe_mode exceptions more consistently1236-* Fix iteration on null responses in safe_mode1237-1238-0.8.6 (2011-12-18)1239-++++++++++++++++++1240-1241-* Socket timeout fixes.1242-* Proxy Authorization support.1243-1244-0.8.5 (2011-12-14)1245-++++++++++++++++++1246-1247-* Response.iter_lines!1248-1249-0.8.4 (2011-12-11)1250-++++++++++++++++++1251-1252-* Prefetch bugfix.1253-* Added license to installed version.1254-1255-0.8.3 (2011-11-27)1256-++++++++++++++++++1257-1258-* Converted auth system to use simpler callable objects.1259-* New session parameter to API methods.1260-* Display full URL while logging.1261-1262-0.8.2 (2011-11-19)1263-++++++++++++++++++1264-1265-* New Unicode decoding system, based on over-ridable `Response.encoding`.1266-* Proper URL slash-quote handling.1267-* Cookies with ``[``, ``]``, and ``_`` allowed.1268-1269-0.8.1 (2011-11-15)1270-++++++++++++++++++1271-1272-* URL Request path fix1273-* Proxy fix.1274-* Timeouts fix.1275-1276-0.8.0 (2011-11-13)1277-++++++++++++++++++1278-1279-* Keep-alive support!1280-* Complete removal of Urllib21281-* Complete removal of Poster1282-* Complete removal of CookieJars1283-* New ConnectionError raising1284-* Safe_mode for error catching1285-* prefetch parameter for request methods1286-* OPTION method1287-* Async pool size throttling1288-* File uploads send real names1289-* Vendored in urllib31290-1291-0.7.6 (2011-11-07)1292-++++++++++++++++++1293-1294-* Digest authentication bugfix (attach query data to path)1295-1296-0.7.5 (2011-11-04)1297-++++++++++++++++++1298-1299-* Response.content = None if there was an invalid response.1300-* Redirection auth handling.1301-1302-0.7.4 (2011-10-26)1303-++++++++++++++++++1304-1305-* Session Hooks fix.1306-1307-0.7.3 (2011-10-23)1308-++++++++++++++++++1309-1310-* Digest Auth fix.1311-1312-1313-0.7.2 (2011-10-23)1314-++++++++++++++++++1315-1316-* PATCH Fix.1317-1318-1319-0.7.1 (2011-10-23)1320-++++++++++++++++++1321-1322-* Move away from urllib2 authentication handling.1323-* Fully Remove AuthManager, AuthObject, &c.1324-* New tuple-based auth system with handler callbacks.1325-1326-1327-0.7.0 (2011-10-22)1328-++++++++++++++++++1329-1330-* Sessions are now the primary interface.1331-* Deprecated InvalidMethodException.1332-* PATCH fix.1333-* New config system (no more global settings).1334-1335-1336-0.6.6 (2011-10-19)1337-++++++++++++++++++1338-1339-* Session parameter bugfix (params merging).1340-1341-1342-0.6.5 (2011-10-18)1343-++++++++++++++++++1344-1345-* Offline (fast) test suite.1346-* Session dictionary argument merging.1347-1348-1349-0.6.4 (2011-10-13)1350-++++++++++++++++++1351-1352-* Automatic decoding of unicode, based on HTTP Headers.1353-* New ``decode_unicode`` setting.1354-* Removal of ``r.read/close`` methods.1355-* New ``r.faw`` interface for advanced response usage.*1356-* Automatic expansion of parameterized headers.1357-1358-1359-0.6.3 (2011-10-13)1360-++++++++++++++++++1361-1362-* Beautiful ``requests.async`` module, for making async requests w/ gevent.1363-1364-1365-0.6.2 (2011-10-09)1366-++++++++++++++++++1367-1368-* GET/HEAD obeys allow_redirects=False.1369-1370-1371-0.6.1 (2011-08-20)1372-++++++++++++++++++1373-1374-* Enhanced status codes experience ``\o/``1375-* Set a maximum number of redirects (``settings.max_redirects``)1376-* Full Unicode URL support1377-* Support for protocol-less redirects.1378-* Allow for arbitrary request types.1379-* Bugfixes1380-1381-1382-0.6.0 (2011-08-17)1383-++++++++++++++++++1384-1385-* New callback hook system1386-* New persistent sessions object and context manager1387-* Transparent Dict-cookie handling1388-* Status code reference object1389-* Removed Response.cached1390-* Added Response.request1391-* All args are kwargs1392-* Relative redirect support1393-* HTTPError handling improvements1394-* Improved https testing1395-* Bugfixes1396-1397-1398-0.5.1 (2011-07-23)1399-++++++++++++++++++1400-1401-* International Domain Name Support!1402-* Access headers without fetching entire body (``read()``)1403-* Use lists as dicts for parameters1404-* Add Forced Basic Authentication1405-* Forced Basic is default authentication type1406-* ``python-requests.org`` default User-Agent header1407-* CaseInsensitiveDict lower-case caching1408-* Response.history bugfix1409-1410-1411-0.5.0 (2011-06-21)1412-++++++++++++++++++1413-1414-* PATCH Support1415-* Support for Proxies1416-* HTTPBin Test Suite1417-* Redirect Fixes1418-* settings.verbose stream writing1419-* Querystrings for all methods1420-* URLErrors (Connection Refused, Timeout, Invalid URLs) are treated as explicitly raised1421- ``r.requests.get('hwe://blah'); r.raise_for_status()``1422-1423-1424-0.4.1 (2011-05-22)1425-++++++++++++++++++1426-1427-* Improved Redirection Handling1428-* New 'allow_redirects' param for following non-GET/HEAD Redirects1429-* Settings module refactoring1430-1431-1432-0.4.0 (2011-05-15)1433-++++++++++++++++++1434-1435-* Response.history: list of redirected responses1436-* Case-Insensitive Header Dictionaries!1437-* Unicode URLs1438-1439-1440-0.3.4 (2011-05-14)1441-++++++++++++++++++1442-1443-* Urllib2 HTTPAuthentication Recursion fix (Basic/Digest)1444-* Internal Refactor1445-* Bytes data upload Bugfix1446-1447-1448-1449-0.3.3 (2011-05-12)1450-++++++++++++++++++1451-1452-* Request timeouts1453-* Unicode url-encoded data1454-* Settings context manager and module1455-1456-1457-0.3.2 (2011-04-15)1458-++++++++++++++++++1459-1460-* Automatic Decompression of GZip Encoded Content1461-* AutoAuth Support for Tupled HTTP Auth1462-1463-1464-0.3.1 (2011-04-01)1465-++++++++++++++++++1466-1467-* Cookie Changes1468-* Response.read()1469-* Poster fix1470-1471-1472-0.3.0 (2011-02-25)1473-++++++++++++++++++1474-1475-* Automatic Authentication API Change1476-* Smarter Query URL Parameterization1477-* Allow file uploads and POST data together1478-* New Authentication Manager System1479- - Simpler Basic HTTP System1480- - Supports all build-in urllib2 Auths1481- - Allows for custom Auth Handlers1482-1483-1484-0.2.4 (2011-02-19)1485-++++++++++++++++++1486-1487-* Python 2.5 Support1488-* PyPy-c v1.4 Support1489-* Auto-Authentication tests1490-* Improved Request object constructor1491-1492-0.2.3 (2011-02-15)1493-++++++++++++++++++1494-1495-* New HTTPHandling Methods1496- - Response.__nonzero__ (false if bad HTTP Status)1497- - Response.ok (True if expected HTTP Status)1498- - Response.error (Logged HTTPError if bad HTTP Status)1499- - Response.raise_for_status() (Raises stored HTTPError)1500-1501-1502-0.2.2 (2011-02-14)1503-++++++++++++++++++1504-1505-* Still handles request in the event of an HTTPError. (Issue #2)1506-* Eventlet and Gevent Monkeypatch support.1507-* Cookie Support (Issue #1)1508-1509-1510-0.2.1 (2011-02-14)1511-++++++++++++++++++1512-1513-* Added file attribute to POST and PUT requests for multipart-encode file uploads.1514-* Added Request.url attribute for context and redirects1515-1516-1517-0.2.0 (2011-02-14)1518-++++++++++++++++++1519-1520-* Birth!1521-1522-1523-0.0.1 (2011-02-13)1524-++++++++++++++++++1525-1526-* Frustration1527-* Conceptionmodified:LICENSE+2 added-2 removed
1-Copyright 2017 Kenneth Reitz1+Copyright 2018 Kenneth Reitz2 3 Licensed under the Apache License, Version 2.0 (the "License");4 you may not use this file except in compliance with the License.5 You may obtain a copy of the License at6 7- http://www.apache.org/licenses/LICENSE-2.07+ https://www.apache.org/licenses/LICENSE-2.08 9 Unless required by applicable law or agreed to in writing, software10 distributed under the License is distributed on an "AS IS" BASIS,11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.2 unmodified linesmodified:Makefile+6 added-5 removed
1 .PHONY: docs2 init:3- pip install -r requirements.txt3+ pip install pipenv --upgrade4+ pipenv install --dev --skip-lock5 test:6 # This runs all of the tests, on both Python 2 and Python 3.7 detox8 ci:8- py.test -n 8 --boxed --junitxml=report.xml9+ pipenv run py.test -n 8 --boxed --junitxml=report.xml10 11 test-readme:11- @python setup.py check --restructuredtext --strict && ([ $$? -eq 0 ] && echo "README.rst and HISTORY.rst ok") || echo "Invalid markup in README.rst or HISTORY.rst!"12+ @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!"13 14 flake8:14- flake8 --ignore=E501,F401,E128,E402,E731,F821 requests15+ pipenv run flake8 --ignore=E501,F401,E128,E402,E731,F821 requests16 17 coverage:17- py.test --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=requests tests18+ pipenv run py.test --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=requests tests19 20 publish:21 pip install 'twine>=1.5.0'22 python setup.py sdist bdist_wheel6 unmodified linesmodified:MANIFEST.in+1 added-1 removed
1-include README.rst LICENSE NOTICE HISTORY.rst pytest.ini requirements.txt1+include README.md LICENSE NOTICE HISTORY.md pytest.ini requirements.txt Pipfile Pipfile.lock2 recursive-include tests *.pyadded:Pipfile+24 added
1+[[source]]2+url = "https://pypi.org/simple/"3+verify_ssl = true4+name = "pypi"5+6+[dev-packages]7+pytest = ">=2.8.0"8+codecov = "*"9+pytest-httpbin = ">=0.0.7"10+pytest-mock = "*"11+pytest-cov = "*"12+pytest-xdist = "*"13+alabaster = "*"14+readme-renderer = "*"15+sphinx = "<=1.5.5"16+pysocks = "*"17+docutils = "*"18+"flake8" = "*"19+tox = "*"20+detox = "*"21+httpbin = ">=0.7.0"22+23+[packages]24+"e1839a8" = {path = ".", editable = true, extras = ["socks"]}added:Pipfile.lock+641 added
1+{2+ "_meta": {3+ "hash": {4+ "sha256": "0735b243455d8e924fbd05188ed435bfd3917f4acdade9b9e8f14741f3fc47e9"5+ },6+ "pipfile-spec": 6,7+ "requires": {},8+ "sources": [9+ {10+ "name": "pypi",11+ "url": "https://pypi.org/simple/",12+ "verify_ssl": true13+ }14+ ]15+ },16+ "default": {17+ "certifi": {18+ "hashes": [19+ "sha256:13e698f54293db9f89122b0581843a782ad0934a4fe0172d2a980ba77fc61bb7",20+ "sha256:9fa520c1bacfb634fa7af20a76bcbd3d5fb390481724c597da32c719a7dca4b0"21+ ],22+ "version": "==2018.4.16"23+ },24+ "chardet": {25+ "hashes": [26+ "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",27+ "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"28+ ],29+ "version": "==3.0.4"30+ },31+ "e1839a8": {32+ "editable": true,33+ "extras": [34+ "socks"35+ ],36+ "path": "."37+ },38+ "idna": {39+ "hashes": [40+ "sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f",41+ "sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4"42+ ],43+ "version": "==2.6"44+ },45+ "pysocks": {46+ "hashes": [47+ "sha256:3fe52c55890a248676fd69dc9e3c4e811718b777834bcaab7a8125cf9deac672"48+ ],49+ "version": "==1.6.8"50+ },51+ "urllib3": {52+ "hashes": [53+ "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b",54+ "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f"55+ ],56+ "version": "==1.22"57+ }58+ },59+ "develop": {60+ "alabaster": {61+ "hashes": [62+ "sha256:2eef172f44e8d301d25aff8068fddd65f767a3f04b5f15b0f4922f113aa1c732",63+ "sha256:37cdcb9e9954ed60912ebc1ca12a9d12178c26637abdf124e3cde2341c257fe0"64+ ],65+ "index": "pypi",66+ "version": "==0.7.10"67+ },68+ "apipkg": {69+ "hashes": [70+ "sha256:2e38399dbe842891fe85392601aab8f40a8f4cc5a9053c326de35a1cc0297ac6",71+ "sha256:65d2aa68b28e7d31233bb2ba8eb31cda40e4671f8ac2d6b241e358c9652a74b9"72+ ],73+ "version": "==1.4"74+ },75+ "attrs": {76+ "hashes": [77+ "sha256:4b90b09eeeb9b88c35bc642cbac057e45a5fd85367b985bd2809c62b7b939265",78+ "sha256:e0d0eb91441a3b53dab4d9b743eafc1ac44476296a2053b6ca3af0b139faf87b"79+ ],80+ "version": "==18.1.0"81+ },82+ "babel": {83+ "hashes": [84+ "sha256:8ce4cb6fdd4393edd323227cba3a077bceb2a6ce5201c902c65e730046f41f14",85+ "sha256:ad209a68d7162c4cff4b29cdebe3dec4cef75492df501b0049a9433c96ce6f80"86+ ],87+ "version": "==2.5.3"88+ },89+ "bleach": {90+ "hashes": [91+ "sha256:b8fa79e91f96c2c2cd9fd1f9eda906efb1b88b483048978ba62fef680e962b34",92+ "sha256:eb7386f632349d10d9ce9d4a838b134d4731571851149f9cc2c05a9a837a9a44"93+ ],94+ "version": "==2.1.3"95+ },96+ "blinker": {97+ "hashes": [98+ "sha256:471aee25f3992bd325afa3772f1063dbdbbca947a041b8b89466dc00d606f8b6"99+ ],100+ "version": "==1.4"101+ },102+ "brotlipy": {103+ "hashes": [104+ "sha256:07194f4768eb62a4f4ea76b6d0df6ade185e24ebd85877c351daa0a069f1111a",105+ "sha256:091b299bf36dd6ef7a06570dbc98c0f80a504a56c5b797f31934d2ad01ae7d17",106+ "sha256:09ec3e125d16749b31c74f021aba809541b3564e5359f8c265cbae442810b41a",107+ "sha256:0be698678a114addcf87a4b9496c552c68a2c99bf93cf8e08f5738b392e82057",108+ "sha256:0fa6088a9a87645d43d7e21e32b4a6bf8f7c3939015a50158c10972aa7f425b7",109+ "sha256:1ea4e578241504b58f2456a6c69952c88866c794648bdc74baee74839da61d44",110+ "sha256:2699945a0a992c04fc7dc7fa2f1d0575a2c8b4b769f2874a08e8eae46bef36ae",111+ "sha256:2a80319ae13ea8dd60ecdc4f5ccf6da3ae64787765923256b62c598c5bba4121",112+ "sha256:2e5c64522364a9ebcdf47c5744a5ddeb3f934742d31e61ebfbbc095460b47162",113+ "sha256:36def0b859beaf21910157b4c33eb3b06d8ce459c942102f16988cca6ea164df",114+ "sha256:3a3e56ced8b15fbbd363380344f70f3b438e0fd1fcf27b7526b6172ea950e867",115+ "sha256:3c1d5e2cf945a46975bdb11a19257fa057b67591eb232f393d260e7246d9e571",116+ "sha256:50ca336374131cfad20612f26cc43c637ac0bfd2be3361495e99270883b52962",117+ "sha256:5de6f7d010b7558f72f4b061a07395c5c3fd57f0285c5af7f126a677b976a868",118+ "sha256:637847560d671657f993313ecc6c6c6666a936b7a925779fd044065c7bc035b9",119+ "sha256:653faef61241bf8bf99d73ca7ec4baa63401ba7b2a2aa88958394869379d67c7",120+ "sha256:786afc8c9bd67de8d31f46e408a3386331e126829114e4db034f91eacb05396d",121+ "sha256:79aaf217072840f3e9a3b641cccc51f7fc23037496bd71e26211856b93f4b4cb",122+ "sha256:7e31f7adcc5851ca06134705fcf3478210da45d35ad75ec181e1ce9ce345bb38",123+ "sha256:8b39abc3256c978f575df5cd7893153277216474f303e26f0e43ba3d3969ef96",124+ "sha256:9448227b0df082e574c45c983fa5cd4bda7bfb11ea6b59def0940c1647be0c3c",125+ "sha256:96bc59ff9b5b5552843dc67999486a220e07a0522dddd3935da05dc194fa485c",126+ "sha256:a07647886e24e2fb2d68ca8bf3ada398eb56fd8eac46c733d4d95c64d17f743b",127+ "sha256:af65d2699cb9f13b26ec3ba09e75e80d31ff422c03675fcb36ee4dabe588fdc2",128+ "sha256:b4c98b0d2c9c7020a524ca5bbff42027db1004c6571f8bc7b747f2b843128e7a",129+ "sha256:c6cc0036b1304dd0073eec416cb2f6b9e37ac8296afd9e481cac3b1f07f9db25",130+ "sha256:d2c1c724c4ac375feb2110f1af98ecdc0e5a8ea79d068efb5891f621a5b235cb",131+ "sha256:dc6c5ee0df9732a44d08edab32f8a616b769cc5a4155a12d2d010d248eb3fb07",132+ "sha256:fd1d1c64214af5d90014d82cee5d8141b13d44c92ada7a0c0ec0679c6f15a471"133+ ],134+ "version": "==0.7.0"135+ },136+ "certifi": {137+ "hashes": [138+ "sha256:13e698f54293db9f89122b0581843a782ad0934a4fe0172d2a980ba77fc61bb7",139+ "sha256:9fa520c1bacfb634fa7af20a76bcbd3d5fb390481724c597da32c719a7dca4b0"140+ ],141+ "version": "==2018.4.16"142+ },143+ "cffi": {144+ "hashes": [145+ "sha256:151b7eefd035c56b2b2e1eb9963c90c6302dc15fbd8c1c0a83a163ff2c7d7743",146+ "sha256:1553d1e99f035ace1c0544050622b7bc963374a00c467edafac50ad7bd276aef",147+ "sha256:1b0493c091a1898f1136e3f4f991a784437fac3673780ff9de3bcf46c80b6b50",148+ "sha256:2ba8a45822b7aee805ab49abfe7eec16b90587f7f26df20c71dd89e45a97076f",149+ "sha256:3c85641778460581c42924384f5e68076d724ceac0f267d66c757f7535069c93",150+ "sha256:3eb6434197633b7748cea30bf0ba9f66727cdce45117a712b29a443943733257",151+ "sha256:4c91af6e967c2015729d3e69c2e51d92f9898c330d6a851bf8f121236f3defd3",152+ "sha256:770f3782b31f50b68627e22f91cb182c48c47c02eb405fd689472aa7b7aa16dc",153+ "sha256:79f9b6f7c46ae1f8ded75f68cf8ad50e5729ed4d590c74840471fc2823457d04",154+ "sha256:7a33145e04d44ce95bcd71e522b478d282ad0eafaf34fe1ec5bbd73e662f22b6",155+ "sha256:857959354ae3a6fa3da6651b966d13b0a8bed6bbc87a0de7b38a549db1d2a359",156+ "sha256:87f37fe5130574ff76c17cab61e7d2538a16f843bb7bca8ebbc4b12de3078596",157+ "sha256:95d5251e4b5ca00061f9d9f3d6fe537247e145a8524ae9fd30a2f8fbce993b5b",158+ "sha256:9d1d3e63a4afdc29bd76ce6aa9d58c771cd1599fbba8cf5057e7860b203710dd",159+ "sha256:a36c5c154f9d42ec176e6e620cb0dd275744aa1d804786a71ac37dc3661a5e95",160+ "sha256:ae5e35a2c189d397b91034642cb0eab0e346f776ec2eb44a49a459e6615d6e2e",161+ "sha256:b0f7d4a3df8f06cf49f9f121bead236e328074de6449866515cea4907bbc63d6",162+ "sha256:b75110fb114fa366b29a027d0c9be3709579602ae111ff61674d28c93606acca",163+ "sha256:ba5e697569f84b13640c9e193170e89c13c6244c24400fc57e88724ef610cd31",164+ "sha256:be2a9b390f77fd7676d80bc3cdc4f8edb940d8c198ed2d8c0be1319018c778e1",165+ "sha256:d5d8555d9bfc3f02385c1c37e9f998e2011f0db4f90e250e5bc0c0a85a813085",166+ "sha256:e55e22ac0a30023426564b1059b035973ec82186ddddbac867078435801c7801",167+ "sha256:e90f17980e6ab0f3c2f3730e56d1fe9bcba1891eeea58966e89d352492cc74f4",168+ "sha256:ecbb7b01409e9b782df5ded849c178a0aa7c906cf8c5a67368047daab282b184",169+ "sha256:ed01918d545a38998bfa5902c7c00e0fee90e957ce036a4000a88e3fe2264917",170+ "sha256:edabd457cd23a02965166026fd9bfd196f4324fe6032e866d0f3bd0301cd486f",171+ "sha256:fdf1c1dc5bafc32bc5d08b054f94d659422b05aba244d6be4ddc1c72d9aa70fb"172+ ],173+ "version": "==1.11.5"174+ },175+ "chardet": {176+ "hashes": [177+ "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",178+ "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"179+ ],180+ "version": "==3.0.4"181+ },182+ "click": {183+ "hashes": [184+ "sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d",185+ "sha256:f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b"186+ ],187+ "version": "==6.7"188+ },189+ "cmarkgfm": {190+ "hashes": [191+ "sha256:0186dccca79483e3405217993b83b914ba4559fe9a8396efc4eea56561b74061",192+ "sha256:1a625afc6f62da428df96ec325dc30866cc5781520cbd904ff4ec44cf018171c",193+ "sha256:275905bb371a99285c74931700db3f0c078e7603bed383e8cf1a09f3ee05a3de",194+ "sha256:50098f1c4950722521f0671e54139e0edc1837d63c990cf0f3d2c49607bb51a2",195+ "sha256:50ed116d0b60a07df0dc7b180c28569064b9d37d1578d4c9021cff04d725cb63",196+ "sha256:61a72def110eed903cd1848245897bcb80d295cd9d13944d4f9f30cba5b76655",197+ "sha256:64186fb75d973a06df0e6ea12879533b71f6e7ba1ab01ffee7fc3e7534758889",198+ "sha256:665303d34d7f14f10d7b0651082f25ebf7107f29ef3d699490cac16cdc0fc8ce",199+ "sha256:70b18f843aec58e4e64aadce48a897fe7c50426718b7753aaee399e72df64190",200+ "sha256:761ee7b04d1caee2931344ac6bfebf37102ffb203b136b676b0a71a3f0ea3c87",201+ "sha256:811527e9b7280b136734ed6cb6845e5fbccaeaa132ddf45f0246cbe544016957",202+ "sha256:987b0e157f70c72a84f3c2f9ef2d7ab0f26c08f2bf326c12c087ff9eebcb3ff5",203+ "sha256:9fc6a2183d0a9b0974ec7cdcdad42bd78a3be674cc3e65f87dd694419b3b0ab7",204+ "sha256:c573ea89dd95d41b6d8cf36799c34b6d5b1eac4aed0212dee0f0a11fb7b01e8f",205+ "sha256:c5f1b9e8592d2c448c44e6bc0d91224b16ea5f8293908b1561de1f6d2d0658b1",206+ "sha256:cbe581456357d8f0674d6a590b1aaf46c11d01dd0a23af147a51a798c3818034",207+ "sha256:cf219bec69e601fe27e3974b7307d2f06082ab385d42752738ad2eb630a47d65",208+ "sha256:d08bad67fa18f7e8ff738c090628ee0cbf0505d74a991c848d6d04abfe67b697",209+ "sha256:d6f716d7b1182bf35862b5065112f933f43dd1aa4f8097c9bcfb246f71528a34",210+ "sha256:e08e479102627641c7cb4ece421c6ed4124820b1758765db32201136762282d9",211+ "sha256:e20ac21418af0298437d29599f7851915497ce9f2866bc8e86b084d8911ee061",212+ "sha256:e25f53c37e319241b9a412382140dffac98ca756ba8f360ac7ab5e30cad9670a",213+ "sha256:f20900f16377f2109783ae9348d34bc80530808439591c3d3df73d5c7ef1a00c"214+ ],215+ "version": "==0.4.2"216+ },217+ "codecov": {218+ "hashes": [219+ "sha256:8ed8b7c6791010d359baed66f84f061bba5bd41174bf324c31311e8737602788",220+ "sha256:ae00d68e18d8a20e9c3288ba3875ae03db3a8e892115bf9b83ef20507732bed4"221+ ],222+ "index": "pypi",223+ "version": "==2.0.15"224+ },225+ "configparser": {226+ "hashes": [227+ "sha256:5308b47021bc2340965c371f0f058cc6971a04502638d4244225c49d80db273a"228+ ],229+ "markers": "python_version < '3.2'",230+ "version": "==3.5.0"231+ },232+ "contextlib2": {233+ "hashes": [234+ "sha256:509f9419ee91cdd00ba34443217d5ca51f5a364a404e1dce9e8979cea969ca48",235+ "sha256:f5260a6e679d2ff42ec91ec5252f4eeffdcf21053db9113bd0a8e4d953769c00"236+ ],237+ "markers": "python_version < '3.2'",238+ "version": "==0.5.5"239+ },240+ "coverage": {241+ "hashes": [242+ "sha256:03481e81d558d30d230bc12999e3edffe392d244349a90f4ef9b88425fac74ba",243+ "sha256:0b136648de27201056c1869a6c0d4e23f464750fd9a9ba9750b8336a244429ed",244+ "sha256:104ab3934abaf5be871a583541e8829d6c19ce7bde2923b2751e0d3ca44db60a",245+ "sha256:15b111b6a0f46ee1a485414a52a7ad1d703bdf984e9ed3c288a4414d3871dcbd",246+ "sha256:198626739a79b09fa0a2f06e083ffd12eb55449b5f8bfdbeed1df4910b2ca640",247+ "sha256:1c383d2ef13ade2acc636556fd544dba6e14fa30755f26812f54300e401f98f2",248+ "sha256:28b2191e7283f4f3568962e373b47ef7f0392993bb6660d079c62bd50fe9d162",249+ "sha256:2eb564bbf7816a9d68dd3369a510be3327f1c618d2357fa6b1216994c2e3d508",250+ "sha256:337ded681dd2ef9ca04ef5d93cfc87e52e09db2594c296b4a0a3662cb1b41249",251+ "sha256:3a2184c6d797a125dca8367878d3b9a178b6fdd05fdc2d35d758c3006a1cd694",252+ "sha256:3c79a6f7b95751cdebcd9037e4d06f8d5a9b60e4ed0cd231342aa8ad7124882a",253+ "sha256:3d72c20bd105022d29b14a7d628462ebdc61de2f303322c0212a054352f3b287",254+ "sha256:3eb42bf89a6be7deb64116dd1cc4b08171734d721e7a7e57ad64cc4ef29ed2f1",255+ "sha256:4635a184d0bbe537aa185a34193898eee409332a8ccb27eea36f262566585000",256+ "sha256:56e448f051a201c5ebbaa86a5efd0ca90d327204d8b059ab25ad0f35fbfd79f1",257+ "sha256:5a13ea7911ff5e1796b6d5e4fbbf6952381a611209b736d48e675c2756f3f74e",258+ "sha256:69bf008a06b76619d3c3f3b1983f5145c75a305a0fea513aca094cae5c40a8f5",259+ "sha256:6bc583dc18d5979dc0f6cec26a8603129de0304d5ae1f17e57a12834e7235062",260+ "sha256:701cd6093d63e6b8ad7009d8a92425428bc4d6e7ab8d75efbb665c806c1d79ba",261+ "sha256:7608a3dd5d73cb06c531b8925e0ef8d3de31fed2544a7de6c63960a1e73ea4bc",262+ "sha256:76ecd006d1d8f739430ec50cc872889af1f9c1b6b8f48e29941814b09b0fd3cc",263+ "sha256:7aa36d2b844a3e4a4b356708d79fd2c260281a7390d678a10b91ca595ddc9e99",264+ "sha256:7d3f553904b0c5c016d1dad058a7554c7ac4c91a789fca496e7d8347ad040653",265+ "sha256:7e1fe19bd6dce69d9fd159d8e4a80a8f52101380d5d3a4d374b6d3eae0e5de9c",266+ "sha256:8c3cb8c35ec4d9506979b4cf90ee9918bc2e49f84189d9bf5c36c0c1119c6558",267+ "sha256:9d6dd10d49e01571bf6e147d3b505141ffc093a06756c60b053a859cb2128b1f",268+ "sha256:9e112fcbe0148a6fa4f0a02e8d58e94470fc6cb82a5481618fea901699bf34c4",269+ "sha256:ac4fef68da01116a5c117eba4dd46f2e06847a497de5ed1d64bb99a5fda1ef91",270+ "sha256:b8815995e050764c8610dbc82641807d196927c3dbed207f0a079833ffcf588d",271+ "sha256:be6cfcd8053d13f5f5eeb284aa8a814220c3da1b0078fa859011c7fffd86dab9",272+ "sha256:c1bb572fab8208c400adaf06a8133ac0712179a334c09224fb11393e920abcdd",273+ "sha256:de4418dadaa1c01d497e539210cb6baa015965526ff5afc078c57ca69160108d",274+ "sha256:e05cb4d9aad6233d67e0541caa7e511fa4047ed7750ec2510d466e806e0255d6",275+ "sha256:e4d96c07229f58cb686120f168276e434660e4358cc9cf3b0464210b04913e77",276+ "sha256:f3f501f345f24383c0000395b26b726e46758b71393267aeae0bd36f8b3ade80",277+ "sha256:f8a923a85cb099422ad5a2e345fe877bbc89a8a8b23235824a93488150e45f6e"278+ ],279+ "version": "==4.5.1"280+ },281+ "decorator": {282+ "hashes": [283+ "sha256:2c51dff8ef3c447388fe5e4453d24a2bf128d3a4c32af3fabef1f01c6851ab82",284+ "sha256:c39efa13fbdeb4506c476c9b3babf6a718da943dab7811c206005a4a956c080c"285+ ],286+ "version": "==4.3.0"287+ },288+ "detox": {289+ "hashes": [290+ "sha256:cb24895a0e4f95c0bcb1087a201c453600e075568af00848e91518fb2b984568",291+ "sha256:f3119bca4444f1e8a1d7189b064c52cfdd9a89ad3a1c921d78b49bf7f5dc5b1b"292+ ],293+ "index": "pypi",294+ "version": "==0.12"295+ },296+ "docutils": {297+ "hashes": [298+ "sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6",299+ "sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274",300+ "sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6"301+ ],302+ "index": "pypi",303+ "version": "==0.14"304+ },305+ "enum34": {306+ "hashes": [307+ "sha256:2d81cbbe0e73112bdfe6ef8576f2238f2ba27dd0d55752a776c41d38b7da2850",308+ "sha256:644837f692e5f550741432dd3f223bbb9852018674981b1664e5dc339387588a",309+ "sha256:6bd0f6ad48ec2aa117d3d141940d484deccda84d4fcd884f5c3d93c23ecd8c79",310+ "sha256:8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1"311+ ],312+ "markers": "python_version < '3.4'",313+ "version": "==1.1.6"314+ },315+ "eventlet": {316+ "hashes": [317+ "sha256:06cffa55b335cc4fc32d0079242a81e8a9cddf2581d64d5f0543e2d412b26ca8",318+ "sha256:554a50dad7abee0a9775b0780ce9d9c0bd9123dda4743c46d4314170267c6c47"319+ ],320+ "version": "==0.23.0"321+ },322+ "execnet": {323+ "hashes": [324+ "sha256:a7a84d5fa07a089186a329528f127c9d73b9de57f1a1131b82bb5320ee651f6a",325+ "sha256:fc155a6b553c66c838d1a22dba1dc9f5f505c43285a878c6f74a79c024750b83"326+ ],327+ "version": "==1.5.0"328+ },329+ "flake8": {330+ "hashes": [331+ "sha256:7253265f7abd8b313e3892944044a365e3f4ac3fcdcfb4298f55ee9ddf188ba0",332+ "sha256:c7841163e2b576d435799169b78703ad6ac1bbb0f199994fc05f700b2a90ea37"333+ ],334+ "index": "pypi",335+ "version": "==3.5.0"336+ },337+ "flask": {338+ "hashes": [339+ "sha256:2271c0070dbcb5275fad4a82e29f23ab92682dc45f9dfbc22c02ba9b9322ce48",340+ "sha256:a080b744b7e345ccfcbc77954861cb05b3c63786e93f2b3875e0913d44b43f05"341+ ],342+ "version": "==1.0.2"343+ },344+ "funcsigs": {345+ "hashes": [346+ "sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca",347+ "sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50"348+ ],349+ "markers": "python_version < '3.3'",350+ "version": "==1.0.2"351+ },352+ "future": {353+ "hashes": [354+ "sha256:e39ced1ab767b5936646cedba8bcce582398233d6a627067d4c6a454c90cfedb"355+ ],356+ "version": "==0.16.0"357+ },358+ "greenlet": {359+ "hashes": [360+ "sha256:09ef2636ea35782364c830f07127d6c7a70542b178268714a9a9ba16318e7e8b",361+ "sha256:0fef83d43bf87a5196c91e73cb9772f945a4caaff91242766c5916d1dd1381e4",362+ "sha256:1b7df09c6598f5cfb40f843ade14ed1eb40596e75cd79b6fa2efc750ba01bb01",363+ "sha256:1fff21a2da5f9e03ddc5bd99131a6b8edf3d7f9d6bc29ba21784323d17806ed7",364+ "sha256:42118bf608e0288e35304b449a2d87e2ba77d1e373e8aa221ccdea073de026fa",365+ "sha256:50643fd6d54fd919f9a0a577c5f7b71f5d21f0959ab48767bd4bb73ae0839500",366+ "sha256:58798b5d30054bb4f6cf0f712f08e6092df23a718b69000786634a265e8911a9",367+ "sha256:5b49b3049697aeae17ef7bf21267e69972d9e04917658b4e788986ea5cc518e8",368+ "sha256:75c413551a436b462d5929255b6dc9c0c3c2b25cbeaee5271a56c7fda8ca49c0",369+ "sha256:769b740aeebd584cd59232be84fdcaf6270b8adc356596cdea5b2152c82caaac",370+ "sha256:ad2383d39f13534f3ca5c48fe1fc0975676846dc39c2cece78c0f1f9891418e0",371+ "sha256:b417bb7ff680d43e7bd7a13e2e08956fa6acb11fd432f74c97b7664f8bdb6ec1",372+ "sha256:b6ef0cabaf5a6ecb5ac122e689d25ba12433a90c7b067b12e5f28bdb7fb78254",373+ "sha256:c2de19c88bdb0366c976cc125dca1002ec1b346989d59524178adfd395e62421",374+ "sha256:c7b04a6dc74087b1598de8d713198de4718fa30ec6cbb84959b26426c198e041",375+ "sha256:f8f2a0ae8de0b49c7b5b2daca4f150fdd9c1173e854df2cce3b04123244f9f45",376+ "sha256:fcfadaf4bf68a27e5dc2f42cbb2f4b4ceea9f05d1d0b8f7787e640bed2801634"377+ ],378+ "version": "==0.4.13"379+ },380+ "html5lib": {381+ "hashes": [382+ "sha256:20b159aa3badc9d5ee8f5c647e5efd02ed2a66ab8d354930bd9ff139fc1dc0a3",383+ "sha256:66cb0dcfdbbc4f9c3ba1a63fdb511ffdbd4f513b2b6d81b80cd26ce6b3fb3736"384+ ],385+ "version": "==1.0.1"386+ },387+ "httpbin": {388+ "hashes": [389+ "sha256:7a04b5904c80b7aa04dd0a6af6520d68ce17a5db175e66a64b971f8e93d73a26",390+ "sha256:cbb37790c91575f4f15757f42ad41d9f729eb227d5edbe89e4ec175486db8dfa"391+ ],392+ "index": "pypi",393+ "version": "==0.7.0"394+ },395+ "idna": {396+ "hashes": [397+ "sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f",398+ "sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4"399+ ],400+ "version": "==2.6"401+ },402+ "imagesize": {403+ "hashes": [404+ "sha256:3620cc0cadba3f7475f9940d22431fc4d407269f1be59ec9b8edcca26440cf18",405+ "sha256:5b326e4678b6925158ccc66a9fa3122b6106d7c876ee32d7de6ce59385b96315"406+ ],407+ "version": "==1.0.0"408+ },409+ "itsdangerous": {410+ "hashes": [411+ "sha256:cbb3fcf8d3e33df861709ecaf89d9e6629cff0a217bc2848f1b41cd30d360519"412+ ],413+ "version": "==0.24"414+ },415+ "jinja2": {416+ "hashes": [417+ "sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd",418+ "sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"419+ ],420+ "version": "==2.10"421+ },422+ "markupsafe": {423+ "hashes": [424+ "sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665"425+ ],426+ "version": "==1.0"427+ },428+ "mccabe": {429+ "hashes": [430+ "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42",431+ "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"432+ ],433+ "version": "==0.6.1"434+ },435+ "mock": {436+ "hashes": [437+ "sha256:5ce3c71c5545b472da17b72268978914d0252980348636840bd34a00b5cc96c1",438+ "sha256:b158b6df76edd239b8208d481dc46b6afd45a846b7812ff0ce58971cf5bc8bba"439+ ],440+ "markers": "python_version < '3.0'",441+ "version": "==2.0.0"442+ },443+ "more-itertools": {444+ "hashes": [445+ "sha256:0dd8f72eeab0d2c3bd489025bb2f6a1b8342f9b198f6fc37b52d15cfa4531fea",446+ "sha256:11a625025954c20145b37ff6309cd54e39ca94f72f6bb9576d1195db6fa2442e",447+ "sha256:c9ce7eccdcb901a2c75d326ea134e0886abfbea5f93e91cc95de9507c0816c44"448+ ],449+ "version": "==4.1.0"450+ },451+ "pbr": {452+ "hashes": [453+ "sha256:680bf5ba9b28dd56e08eb7c267991a37c7a5f90a92c2e07108829931a50ff80a",454+ "sha256:6874feb22334a1e9a515193cba797664e940b763440c88115009ec323a7f2df5"455+ ],456+ "version": "==4.0.3"457+ },458+ "pluggy": {459+ "hashes": [460+ "sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff",461+ "sha256:d345c8fe681115900d6da8d048ba67c25df42973bda370783cd58826442dcd7c",462+ "sha256:e160a7fcf25762bb60efc7e171d4497ff1d8d2d75a3d0df7a21b76821ecbf5c5"463+ ],464+ "version": "==0.6.0"465+ },466+ "py": {467+ "hashes": [468+ "sha256:29c9fab495d7528e80ba1e343b958684f4ace687327e6f789a94bf3d1915f881",469+ "sha256:983f77f3331356039fdd792e9220b7b8ee1aa6bd2b25f567a963ff1de5a64f6a"470+ ],471+ "version": "==1.5.3"472+ },473+ "pycodestyle": {474+ "hashes": [475+ "sha256:682256a5b318149ca0d2a9185d365d8864a768a28db66a84a2ea946bcc426766",476+ "sha256:6c4245ade1edfad79c3446fadfc96b0de2759662dc29d07d80a6f27ad1ca6ba9"477+ ],478+ "version": "==2.3.1"479+ },480+ "pycparser": {481+ "hashes": [482+ "sha256:99a8ca03e29851d96616ad0404b4aad7d9ee16f25c9f9708a11faf2810f7b226"483+ ],484+ "version": "==2.18"485+ },486+ "pyflakes": {487+ "hashes": [488+ "sha256:08bd6a50edf8cffa9fa09a463063c425ecaaf10d1eb0335a7e8b1401aef89e6f",489+ "sha256:8d616a382f243dbf19b54743f280b80198be0bca3a5396f1d2e1fca6223e8805"490+ ],491+ "version": "==1.6.0"492+ },493+ "pygments": {494+ "hashes": [495+ "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d",496+ "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc"497+ ],498+ "version": "==2.2.0"499+ },500+ "pysocks": {501+ "hashes": [502+ "sha256:3fe52c55890a248676fd69dc9e3c4e811718b777834bcaab7a8125cf9deac672"503+ ],504+ "version": "==1.6.8"505+ },506+ "pytest": {507+ "hashes": [508+ "sha256:54713b26c97538db6ff0703a12b19aeaeb60b5e599de542e7fca0ec83b9038e8",509+ "sha256:829230122facf05a5f81a6d4dfe6454a04978ea3746853b2b84567ecf8e5c526"510+ ],511+ "index": "pypi",512+ "version": "==3.5.1"513+ },514+ "pytest-cov": {515+ "hashes": [516+ "sha256:03aa752cf11db41d281ea1d807d954c4eda35cfa1b21d6971966cc041bbf6e2d",517+ "sha256:890fe5565400902b0c78b5357004aab1c814115894f4f21370e2433256a3eeec"518+ ],519+ "index": "pypi",520+ "version": "==2.5.1"521+ },522+ "pytest-forked": {523+ "hashes": [524+ "sha256:e4500cd0509ec4a26535f7d4112a8cc0f17d3a41c29ffd4eab479d2a55b30805",525+ "sha256:f275cb48a73fc61a6710726348e1da6d68a978f0ec0c54ece5a5fae5977e5a08"526+ ],527+ "version": "==0.2"528+ },529+ "pytest-httpbin": {530+ "hashes": [531+ "sha256:8cd57e27418a7d7d205fcc9802eea246ed06170e3065abfa76c6d9b40553592c",532+ "sha256:d3919c5df0b644454129c0066a8ae62db40ac54bacb4cfd89d8cfa58615a4b42"533+ ],534+ "index": "pypi",535+ "version": "==0.3.0"536+ },537+ "pytest-mock": {538+ "hashes": [539+ "sha256:53801e621223d34724926a5c98bd90e8e417ce35264365d39d6c896388dcc928",540+ "sha256:d89a8209d722b8307b5e351496830d5cc5e192336003a485443ae9adeb7dd4c0"541+ ],542+ "index": "pypi",543+ "version": "==1.10.0"544+ },545+ "pytest-xdist": {546+ "hashes": [547+ "sha256:be2662264b035920ba740ed6efb1c816a83c8a22253df7766d129f6a7bfdbd35",548+ "sha256:e8f5744acc270b3e7d915bdb4d5f471670f049b6fbd163d4cbd52203b075d30f"549+ ],550+ "index": "pypi",551+ "version": "==1.22.2"552+ },553+ "pytz": {554+ "hashes": [555+ "sha256:65ae0c8101309c45772196b21b74c46b2e5d11b6275c45d251b150d5da334555",556+ "sha256:c06425302f2cf668f1bba7a0a03f3c1d34d4ebeef2c72003da308b3947c7f749"557+ ],558+ "version": "==2018.4"559+ },560+ "raven": {561+ "hashes": [562+ "sha256:1c641e5ebc2d4185560608e253970ca0d4b98475f4edf67735015a415f9e1d48",563+ "sha256:95aecf76c414facaddbb056f3e98c7936318123e467728f2e50b3a66b65a6ef7"564+ ],565+ "version": "==6.8.0"566+ },567+ "readme-renderer": {568+ "hashes": [569+ "sha256:bde909eaa84d65b7942f7e6998c8b427b90b568b2630ff0306f4ca75f6d2a909",570+ "sha256:e7e43a7ba49f08c3cb660d0f2e25b561f6b10b36c63f029060230aab2dc2875e"571+ ],572+ "index": "pypi",573+ "version": "==20.0"574+ },575+ "requests": {576+ "hashes": [577+ "sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b",578+ "sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e"579+ ],580+ "version": "==2.18.4"581+ },582+ "six": {583+ "hashes": [584+ "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",585+ "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"586+ ],587+ "version": "==1.11.0"588+ },589+ "snowballstemmer": {590+ "hashes": [591+ "sha256:919f26a68b2c17a7634da993d91339e288964f93c274f1343e3bbbe2096e1128",592+ "sha256:9f3bcd3c401c3e862ec0ebe6d2c069ebc012ce142cce209c098ccb5b09136e89"593+ ],594+ "version": "==1.2.1"595+ },596+ "sphinx": {597+ "hashes": [598+ "sha256:11f271e7a9398385ed730e90f0bb41dc3815294bdcd395b46ed2d033bc2e7d87",599+ "sha256:4064ea6c56feeb268838cb8fbbee507d0c3d5d92fa63a7df935a916b52c9e2f5"600+ ],601+ "index": "pypi",602+ "version": "==1.5.5"603+ },604+ "tox": {605+ "hashes": [606+ "sha256:96efa09710a3daeeb845561ebbe1497641d9cef2ee0aea30db6969058b2bda2f",607+ "sha256:9ee7de958a43806402a38c0d2aa07fa8553f4d2c20a15b140e9f771c2afeade0"608+ ],609+ "index": "pypi",610+ "version": "==3.0.0"611+ },612+ "urllib3": {613+ "hashes": [614+ "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b",615+ "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f"616+ ],617+ "version": "==1.22"618+ },619+ "virtualenv": {620+ "hashes": [621+ "sha256:1d7e241b431e7afce47e77f8843a276f652699d1fa4f93b9d8ce0076fd7b0b54",622+ "sha256:e8e05d4714a1c51a2f5921e62f547fcb0f713ebbe959e0a7f585cc8bef71d11f"623+ ],624+ "version": "==15.2.0"625+ },626+ "webencodings": {627+ "hashes": [628+ "sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78",629+ "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923"630+ ],631+ "version": "==0.5.1"632+ },633+ "werkzeug": {634+ "hashes": [635+ "sha256:c3fd7a7d41976d9f44db327260e263132466836cef6f91512889ed60ad26557c",636+ "sha256:d5da73735293558eb1651ee2fddc4d0dedcfa06538b8813a2e20011583c9e49b"637+ ],638+ "version": "==0.14.1"639+ }640+ }641+}added:README.md+107 added
1+Requests: HTTP for Humans™2+==========================3+4+[](https://pypi.org/project/requests/)5+[](https://pypi.org/project/requests/)6+[](https://pypi.org/project/requests/)7+[](https://codecov.io/github/requests/requests)8+[](https://github.com/requests/requests/graphs/contributors)9+[](https://saythanks.io/to/kennethreitz)10+11+**If you're interested in financially supporting Kenneth Reitz open source, consider [visiting this link](https://cash.me/$KennethReitz). Your support helps tremendously with sustainability of motivation, as Open Source is no longer part of my day job.**12+13+Requests is the only *Non-GMO* HTTP library for Python, safe for human14+consumption.15+16+17+18+Behold, the power of Requests:19+20+``` {.sourceCode .python}21+>>> r = requests.get('https://api.github.com/user', auth=('user', 'pass'))22+>>> r.status_code23+20024+>>> r.headers['content-type']25+'application/json; charset=utf8'26+>>> r.encoding27+'utf-8'28+>>> r.text29+u'{"type":"User"...'30+>>> r.json()31+{u'disk_usage': 368627, u'private_gists': 484, ...}32+```33+34+See [the similar code, sans Requests](https://gist.github.com/973705).35+36+[](http://docs.python-requests.org/)37+38+Requests allows you to send *organic, grass-fed* HTTP/1.1 requests,39+without the need for manual labor. There's no need to manually add query40+strings to your URLs, or to form-encode your POST data. Keep-alive and41+HTTP connection pooling are 100% automatic, thanks to42+[urllib3](https://github.com/shazow/urllib3).43+44+Besides, all the cool kids are doing it. Requests is one of the most45+downloaded Python packages of all time, pulling in over 11,000,00046+downloads every month. You don't want to be left out!47+48+Feature Support49+---------------50+51+Requests is ready for today's web.52+53+- International Domains and URLs54+- Keep-Alive & Connection Pooling55+- Sessions with Cookie Persistence56+- Browser-style SSL Verification57+- Basic/Digest Authentication58+- Elegant Key/Value Cookies59+- Automatic Decompression60+- Automatic Content Decoding61+- Unicode Response Bodies62+- Multipart File Uploads63+- HTTP(S) Proxy Support64+- Connection Timeouts65+- Streaming Downloads66+- `.netrc` Support67+- Chunked Requests68+69+Requests officially supports Python 2.7 & 3.4–3.7, and runs great on70+PyPy.71+72+Installation73+------------74+75+To install Requests, simply use [pipenv](http://pipenv.org/) (or pip, of76+course):77+78+``` {.sourceCode .bash}79+$ pipenv install requests80+✨🍰✨81+```82+83+Satisfaction guaranteed.84+85+Documentation86+-------------87+88+Fantastic documentation is available at89+<http://docs.python-requests.org/>, for a limited time only.90+91+How to Contribute92+-----------------93+94+1. Check for open issues or open a fresh issue to start a discussion95+ around a feature idea or a bug. There is a [Contributor96+ Friendly](https://github.com/requests/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open)97+ tag for issues that should be ideal for people who are not very98+ familiar with the codebase yet.99+2. Fork [the repository](https://github.com/requests/requests) on100+ GitHub to start making your changes to the **master** branch (or101+ branch off of it).102+3. Write a test which shows that the bug was fixed or that the feature103+ works as expected.104+4. Send a pull request and bug the maintainer until it gets merged and105+ published. :) Make sure to add yourself to106+ [AUTHORS](https://github.com/requests/requests/blob/master/AUTHORS.rst).107+deleted:README.rst-114 removed
1-Requests: HTTP for Humans2-=========================3-4-.. image:: https://img.shields.io/pypi/v/requests.svg5- :target: https://pypi.python.org/pypi/requests6-7-.. image:: https://img.shields.io/pypi/l/requests.svg8- :target: https://pypi.python.org/pypi/requests9-10-.. image:: https://img.shields.io/pypi/pyversions/requests.svg11- :target: https://pypi.python.org/pypi/requests12-13-.. image:: https://codecov.io/github/requests/requests/coverage.svg?branch=master14- :target: https://codecov.io/github/requests/requests15- :alt: codecov.io16-17-.. image:: https://img.shields.io/github/contributors/requests/requests.svg18- :target: https://github.com/requests/requests/graphs/contributors19-20-.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg21- :target: https://saythanks.io/to/kennethreitz22-23-24-25-Requests is the only *Non-GMO* HTTP library for Python, safe for human26-consumption.27-28-**Warning:** Recreational use of the Python standard library for HTTP may result in dangerous side-effects,29-including: security vulnerabilities, verbose code, reinventing the wheel,30-constantly reading documentation, depression, headaches, or even death.31-32-Behold, the power of Requests:33-34-.. code-block:: python35-36- >>> r = requests.get('https://api.github.com/user', auth=('user', 'pass'))37- >>> r.status_code38- 20039- >>> r.headers['content-type']40- 'application/json; charset=utf8'41- >>> r.encoding42- 'utf-8'43- >>> r.text44- u'{"type":"User"...'45- >>> r.json()46- {u'disk_usage': 368627, u'private_gists': 484, ...}47-48-See `the similar code, sans Requests <https://gist.github.com/973705>`_.49-50-.. image:: https://raw.githubusercontent.com/requests/requests/master/docs/_static/requests-logo-small.png51- :target: http://docs.python-requests.org/52-53-54-Requests allows you to send *organic, grass-fed* HTTP/1.1 requests, without the55-need for manual labor. There's no need to manually add query strings to your56-URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling57-are 100% automatic, thanks to `urllib3 <https://github.com/shazow/urllib3>`_.58-59-Besides, all the cool kids are doing it. Requests is one of the most60-downloaded Python packages of all time, pulling in over 11,000,000 downloads61-every month. You don't want to be left out!62-63-Feature Support64----------------65-66-Requests is ready for today's web.67-68-- International Domains and URLs69-- Keep-Alive & Connection Pooling70-- Sessions with Cookie Persistence71-- Browser-style SSL Verification72-- Basic/Digest Authentication73-- Elegant Key/Value Cookies74-- Automatic Decompression75-- Automatic Content Decoding76-- Unicode Response Bodies77-- Multipart File Uploads78-- HTTP(S) Proxy Support79-- Connection Timeouts80-- Streaming Downloads81-- ``.netrc`` Support82-- Chunked Requests83-84-Requests officially supports Python 2.6–2.7 & 3.3–3.7, and runs great on PyPy.85-86-Installation87-------------88-89-To install Requests, simply:90-91-.. code-block:: bash92-93- $ pip install requests94- ✨🍰✨95-96-Satisfaction guaranteed.97-98-Documentation99--------------100-101-Fantastic documentation is available at http://docs.python-requests.org/, for a limited time only.102-103-104-How to Contribute105------------------106-107-#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a `Contributor Friendly`_ tag for issues that should be ideal for people who are not very familiar with the codebase yet.108-#. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it).109-#. Write a test which shows that the bug was fixed or that the feature works as expected.110-#. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_.111-112-.. _`the repository`: http://github.com/requests/requests113-.. _AUTHORS: https://github.com/requests/requests/blob/master/AUTHORS.rst114-.. _Contributor Friendly: https://github.com/requests/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=opendeleted:requirements.txt-16 removed
1--e .[socks]2-pytest>=2.8.03-codecov4-pytest-httpbin==0.0.75-pytest-mock6-pytest-cov7-pytest-xdist8-alabaster9-readme_renderer10-Sphinx<=1.5.511-PySocks12-setuptools>=18.513-docutils14-flake815-tox16-detoxmodified:setup.cfg+3 added
1 [bdist_wheel]2 universal = 13+4+[metadata]5+license_file = LICENSEmodified:setup.py+22 added-14 removed
1 #!/usr/bin/env python2-2+# Learn more: https://github.com/kennethreitz/setup.py3 import os4 import re5 import sys6 35 unmodified lines42 packages = ['requests']43 44 requires = [45 'chardet>=3.0.2,<3.1.0',46- 'idna>=2.5,<2.7',47- 'urllib3>=1.21.1,<1.23',46+ 'idna>=2.5,<2.8',47+ 'urllib3>=1.21.1,<1.25',48 'certifi>=2017.4.17'49 50 ]51-test_requirements = ['pytest-httpbin==0.0.7', 'pytest-cov', 'pytest-mock', 'pytest-xdist', 'PySocks>=1.5.6, !=1.5.7', 'pytest>=2.8.0']51+test_requirements = [52+ 'pytest-httpbin==0.0.7',53+ 'pytest-cov',54+ 'pytest-mock',55+ 'pytest-xdist',56+ 'PySocks>=1.5.6, !=1.5.7',57+ 'pytest>=2.8.0'58+]59 60 about = {}61 with open(os.path.join(here, 'requests', '__version__.py'), 'r', 'utf-8') as f:62 exec(f.read(), about)63 57-with open('README.rst', 'r', 'utf-8') as f:64+with open('README.md', 'r', 'utf-8') as f:65 readme = f.read()59-with open('HISTORY.rst', 'r', 'utf-8') as f:66+with open('HISTORY.md', 'r', 'utf-8') as f:67 history = f.read()68 69 setup(70 name=about['__title__'],71 version=about['__version__'],72 description=about['__description__'],66- long_description=readme + '\n\n' + history,73+ long_description=readme,74+ long_description_content_type='text/markdown',75 author=about['__author__'],76 author_email=about['__author_email__'],77 url=about['__url__'],78 packages=packages,79 package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},80 package_dir={'requests': 'requests'},81 include_package_data=True,82+ python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",83 install_requires=requires,84 license=about['__license__'],85 zip_safe=False,77- classifiers=(86+ classifiers=[87 'Development Status :: 5 - Production/Stable',88 'Intended Audience :: Developers',89 'Natural Language :: English',90 'License :: OSI Approved :: Apache Software License',91 'Programming Language :: Python',83- 'Programming Language :: Python :: 2.6',92+ 'Programming Language :: Python :: 2',93 'Programming Language :: Python :: 2.7',94 'Programming Language :: Python :: 3',86- 'Programming Language :: Python :: 3.3',95 'Programming Language :: Python :: 3.4',96 'Programming Language :: Python :: 3.5',97 'Programming Language :: Python :: 3.6',98+ 'Programming Language :: Python :: 3.7',99 'Programming Language :: Python :: Implementation :: CPython',100 'Programming Language :: Python :: Implementation :: PyPy'92- ),101+ ],102 cmdclass={'test': PyTest},103 tests_require=test_requirements,104 extras_require={96- 'security': ['pyOpenSSL>=0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'],105+ 'security': ['pyOpenSSL >= 0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'],106 'socks': ['PySocks>=1.5.6, !=1.5.7'],98- 'socks:sys_platform == "win32" and (python_version == "2.7" or python_version == "2.6")': ['win_inet_pton'],107+ 'socks:sys_platform == "win32" and python_version == "2.7"': ['win_inet_pton'],108 },109 )101-modified:tox.ini+2 added-2 removed
1 [tox]2-envlist = py26,py27,py33,py34,py35,py362+envlist = py27,py34,py35,py363 4 [testenv]5 6 commands =7 pip install -e .[socks]8- python setup.py test8+ python setup.py test