Prefer https:// for URLs throughout project
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Jon Dufresne · committed by Jon Dufresne · parent 8f20b7d · Browse files · 20 files·+90 added−90 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
20 files+90 added−90 removed
- other:+90 added−90 removed
Provenance
- Commit
b0ad249- Tree
be0efaf- Author
Jon Dufresne <jon.dufresne@gmail.com>- Committer
Jon Dufresne <jon.dufresne@gmail.com>- Parent
8f20b7d
20 files changed+90 added−90 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+mainmodified:docs/_templates/sidebarintro.html+6 added-6 removed
23 unmodified lines2425262728282930313132333334353637383637383940414267 unmodified lines23 unmodified lines<p><iframe src="https://ghbtns.com/github-btn.html?user=kennethreitz&type=follow&count=false" allowtransparency="true" frameborder="0" scrolling="0" width="200" height="20"></iframe></p>
<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><p><a href="http://tinyletter.com/kennethreitz">Join Mailing List</a>.</p><p><a href="https://tinyletter.com/kennethreitz">Join Mailing List</a>.</p><h3>Other Projects</h3>
<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p><p>More <a href="https://www.kennethreitz.org/">Kenneth Reitz</a> projects:</p><ul> <li><a href="http://html.python-requests.org/">Requests-HTML</a></li> <li><a href="https://html.python-requests.org/">Requests-HTML</a></li> <li><a href="http://howtopython.org/">howtopython.org</a></li> <li><a href="http://pipenv.org/">pipenv</a></li> <li><a href="http://pep8.org/">pep8.org</a></li> <li><a href="http://httpbin.org/">httpbin.org</a></li> <li><a href="http://python-guide.org">The Python Guide</a></li> <li><a href="https://pep8.org/">pep8.org</a></li> <li><a href="https://httpbin.org/">httpbin.org</a></li> <li><a href="https://docs.python-guide.org/">The Python Guide</a></li> <li><a href="https://github.com/kennethreitz/maya">Maya: Datetimes for Humans</a></li> <li><a href="https://github.com/kennethreitz/records">Records: SQL for Humans</a></li> <li><a href="http://www.git-legit.org">Legit: Git for Humans</a></li> <li><a href="http://docs.python-tablib.org/en/latest/">Tablib: Tabular Datasets</a></li>67 unmodified linesmodified:docs/_templates/sidebarlogo.html+6 added-6 removed
18 unmodified lines192021222323242526275 unmodified lines33343536373738393940414243444243444546474815 unmodified lines18 unmodified lines
<h3>Stay Informed</h3><p>Receive updates on new releases and upcoming projects.</p>
<p><a href="http://tinyletter.com/kennethreitz">Join Mailing List</a>.</p><p><a href="https://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>
<hr/>
<script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=pythonrequestsorg" id="_carbonads_js"></script>5 unmodified lines
<h3>Other Projects</h3>
<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p><p>More <a href="https://www.kennethreitz.org/">Kenneth Reitz</a> projects:</p><ul> <li><a href="http://html.python-requests.org/">Requests-HTML</a></li> <li><a href="https://html.python-requests.org/">Requests-HTML</a></li> <li><a href="http://howtopython.org/">howtopython.org</a></li> <li><a href="http://pipenv.org/">pipenv</a></li> <li><a href="http://pep8.org/">pep8.org</a></li> <li><a href="http://httpbin.org/">httpbin.org</a></li> <li><a href="http://python-guide.org">The Python Guide</a></li> <li><a href="https://pep8.org/">pep8.org</a></li> <li><a href="https://httpbin.org/">httpbin.org</a></li> <li><a href="https://docs.python-guide.org/">The Python Guide</a></li> <li><a href="https://github.com/kennethreitz/maya">Maya: Datetimes for Humans</a></li> <li><a href="https://github.com/kennethreitz/records">Records: SQL for Humans</a></li> <li><a href="http://www.git-legit.org">Legit: Git for Humans</a></li> <li><a href="http://docs.python-tablib.org/en/latest/">Tablib: Tabular Datasets</a></li>15 unmodified linesmodified:docs/community/out-there.rst+5 added-5 removed
13 unmodified lines14 15 16 Articles & Talks17 ================18-- `Python for the Web <http://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 <http://pydanny.blogspot.com/2011/05/python-http-requests-for-humans.html>`_20-- `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>`_ )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 <http://arunsag.wordpress.com/2011/08/17/new-package-python-requests-http-for-humans/>`_23-- `Russian blog post introducing Requests <http://habrahabr.ru/blogs/python/126262/>`_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/dev/contributing.rst+1 added-1 removed
155 unmodified lines156 model methods (e.g. ``__repr__``) are typically the exception to this rule.157 158 Thanks for helping to make the world a better place!159 160-.. _PEP 8: http://pep8.org160+.. _PEP 8: https://pep8.org/161 .. _line continuations: https://www.python.org/dev/peps/pep-0008/#indentation162 163 Documentation Contributions164 ---------------------------44 unmodified linesmodified:docs/dev/philosophy.rst+2 added-2 removed
7 unmodified lines8 9 Management Style10 ~~~~~~~~~~~~~~~~11 12-`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 14 `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.15 16 Values8 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 29-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 14 unmodified linesmodified:docs/user/advanced.rst+21 added-21 removed
23 unmodified lines24 Let's persist some cookies across requests::25 26 s = requests.Session()27 28- s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')29- 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 sent43- 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 56- 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 60- 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:72- 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 100- >>> 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.headers217 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 326- 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 61 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 396- >>> 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)53 unmodified lines454 return r455 456 Let's print some request method arguments at runtime::457 458- >>> requests.get('http://httpbin.org', hooks={'response': print_url})459- 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('http://httpbin.org', hooks={'response': [print_url, record_hook]})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('http://httpbin.org')474- http://httpbin.org473+ >>> 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.49 unmodified lines528 529 import json530 import requests531 532- 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 546- 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 105 unmodified lines656 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 2616660-<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>`.255 unmodified lines920 921 ::922 923 >>> s = requests.Session()924- >>> 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.29 unmodified lines958 self.poolmanager = PoolManager(959 num_pools=connections, maxsize=maxsize,960 block=block, ssl_version=ssl.PROTOCOL_SSLv3)961 962-.. _`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 35 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 packet1006-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 1031-.. _`connect()`: http://linux.die.net/man/2/connect1031+.. _`connect()`: https://linux.die.net/man/2/connectmodified:docs/user/authentication.rst+3 added-3 removed
51 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 HTTPDigestAuth56- >>> 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 ...125- >>> 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 137-.. _OAuth: http://oauth.net/137+.. _OAuth: https://oauth.net/138 .. _requests_oauthlib: https://github.com/requests/requests-oauthlib139 .. _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-flow5 unmodified linesmodified:docs/user/install.rst+1 added-1 removed
16 unmodified lines17 18 $ pipenv install requests19 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 <http://docs.python-guide.org/en/latest/starting/installation/>`_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+2 added-2 removed
35 unmodified lines36 closed-source software.37 38 Requests is released under terms of `Apache2 License`_.39 40-.. _`GPL Licensed`: http://www.opensource.org/licenses/gpl-license.php41-.. _`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+25 added-25 removed
37 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 42- >>> 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 47- >>> r = requests.put('http://httpbin.org/put', data = {'key':'value'})48- >>> r = requests.delete('http://httpbin.org/delete')49- >>> r = requests.head('http://httpbin.org/get')50- >>> 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'}68- >>> 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)73- 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 82- >>> r = requests.get('http://httpbin.org/get', params=payload)82+ >>> r = requests.get('https://httpbin.org/get', params=payload)83 >>> print(r.url)84- http://httpbin.org/get?key1=value1&key2=value2&key2=value384+ https://httpbin.org/get?key1=value1&key2=value2&key2=value385 86 Response Content87 ----------------88 143 unmodified lines232 dictionary of data will automatically be form-encoded when the request is made::233 234 >>> payload = {'key1': 'value1', 'key2': 'value2'}235 236- >>> 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": {8 unmodified lines249 as values. This is particularly useful when the form has multiple elements that250 use the same key::251 252 >>> payload_tuples = [('key1', 'value1'), ('key1', 'value2')]253- >>> r1 = requests.post('http://httpbin.org/post', data=payload_tuples)253+ >>> r1 = requests.post('https://httpbin.org/post', data=payload_tuples)254 >>> payload_dict = {'key1': ['value1', 'value2']}255- >>> r2 = requests.post('http://httpbin.org/post', data=payload_dict)255+ >>> r2 = requests.post('https://httpbin.org/post', data=payload_dict)256 >>> print(r1.text)257 {258 ...259 "form": {35 unmodified lines295 -----------------------------296 297 Requests makes it simple to upload Multipart-encoded files::298 299- >>> 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 314- >>> 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 329- >>> 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.text25 unmodified lines359 ---------------------360 361 We can check the response status code::362 363- >>> 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 377- >>> 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 to413-`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 per427-`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 448- >>> 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')463- >>> 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 484- >>> r = requests.get('http://github.com')484+ >>> r = requests.get('https://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 499- >>> r = requests.get('http://github.com', allow_redirects=False)499+ >>> r = requests.get('https://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 509- >>> r = requests.head('http://github.com', allow_redirects=True)509+ >>> r = requests.head('https://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 526- >>> 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+5 added-5 removed
137 unmodified lines138 139 s = requests.Session() # formerly, session took parameters140 s.auth = auth141 s.headers.update(headers)142- 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. See37 unmodified lines184 requests_log = logging.getLogger("urllib3")185 requests_log.setLevel(logging.DEBUG)186 requests_log.propagate = True187 188- 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 200-.. _ISC: http://opensource.org/licenses/ISC201-.. _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 216-.. _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:requests/__init__.py+1 added-1 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": {107 unmodified linesmodified:requests/api.py+1 added-1 removed
47 unmodified lines48 49 Usage::50 51 >>> import requests52- >>> 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 we102 unmodified linesmodified:requests/models.py+2 added-2 removed
216 unmodified lines217 218 Usage::219 220 >>> import requests221- >>> 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 requests281- >>> 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()671 unmodified linesmodified:requests/sessions.py+3 added-3 removed
309 unmodified lines310 based on certain specs or browser behavior.311 """312 method = prepared_request.method313 314- # 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()340- >>> 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:346- >>> s.get('http://httpbin.org/get')346+ >>> s.get('https://httpbin.org/get')347 <Response [200]>348 """349 350 __attrs__ = [411 unmodified linesmodified:requests/utils.py+1 added-1 removed
174 unmodified lines175 try:176 loc = os.path.expanduser('~/{0}'.format(f))177 except KeyError:178 # os.path.expanduser can fail when $HOME is undefined and179- # 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):797 unmodified linesmodified:appveyor.yml+2 added-2 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:23 unmodified lines30 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 be19 unmodified linesmodified:HISTORY.md+1 added-1 removed
644 unmodified lines645 646 **Bugfixes**647 648 - Revert changes to our vendored certificate bundle. For more context649- see (\#2455, \#2456, and <http://bugs.python.org/issue23476>)649+ see (\#2455, \#2456, and <https://bugs.python.org/issue23476>)650 651 2.5.2 (2015-02-23)652 ------------------653 949 unmodified linesmodified:LICENSE+1 added-1 removed
2 unmodified lines3 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 lines