From b0ad2499c8641d29affc90f565e6628d333d2a96 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 30 Sep 2018 17:14:40 -0500 Subject: [PATCH] Prefer https:// for URLs throughout project --- HISTORY.md | 2 +- LICENSE | 2 +- _appveyor/install.ps1 | 2 +- appveyor.yml | 4 +-- docs/_templates/sidebarintro.html | 12 ++++---- docs/_templates/sidebarlogo.html | 12 ++++---- docs/api.rst | 10 +++---- docs/community/out-there.rst | 10 +++---- docs/dev/contributing.rst | 2 +- docs/dev/philosophy.rst | 4 +-- docs/user/advanced.rst | 42 +++++++++++++------------- docs/user/authentication.rst | 6 ++-- docs/user/install.rst | 2 +- docs/user/intro.rst | 4 +-- docs/user/quickstart.rst | 50 +++++++++++++++---------------- requests/__init__.py | 2 +- requests/api.py | 2 +- requests/models.py | 4 +-- requests/sessions.py | 6 ++-- requests/utils.py | 2 +- 20 files changed, 90 insertions(+), 90 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 6226835938..2afdefcd34 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -646,7 +646,7 @@ documentation](http://docs.python-requests.org/en/latest/community/release-proce **Bugfixes** - Revert changes to our vendored certificate bundle. For more context - see (\#2455, \#2456, and ) + see (\#2455, \#2456, and ) 2.5.2 (2015-02-23) ------------------ diff --git a/LICENSE b/LICENSE index 2e68b82ecb..841c6023b9 100644 --- a/LICENSE +++ b/LICENSE @@ -4,7 +4,7 @@ Copyright 2018 Kenneth Reitz you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/_appveyor/install.ps1 b/_appveyor/install.ps1 index 94d6f01813..160ba55c07 100644 --- a/_appveyor/install.ps1 +++ b/_appveyor/install.ps1 @@ -226,4 +226,4 @@ function main () { InstallPip $env:PYTHON } -main \ No newline at end of file +main diff --git a/appveyor.yml b/appveyor.yml index 5e310d5ae4..3b6cef631b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ # AppVeyor.yml from https://github.com/ogrisel/python-appveyor-demo -# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ +# License: CC0 1.0 Universal: https://creativecommons.org/publicdomain/zero/1.0/ build: off @@ -31,7 +31,7 @@ environment: TOXENV: "py37" install: - # Install Python (from the official .msi of http://python.org) and pip when + # Install Python (from the official .msi of https://www.python.org/) and pip when # not already installed. - ps: if (-not(Test-Path($env:PYTHON))) { & _appveyor\install.ps1 } diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html index 88251989fa..6bfc5cef12 100644 --- a/docs/_templates/sidebarintro.html +++ b/docs/_templates/sidebarintro.html @@ -25,17 +25,17 @@

Stay Informed

allowtransparency="true" frameborder="0" scrolling="0" width="200" height="20">

-

Join Mailing List.

+

Join Mailing List.

Other Projects

-

More Kenneth Reitz projects:

+

More Kenneth Reitz projects:

    -
  • Requests-HTML
  • +
  • Requests-HTML
  • howtopython.org
  • pipenv
  • -
  • pep8.org
  • -
  • httpbin.org
  • -
  • The Python Guide
  • +
  • pep8.org
  • +
  • httpbin.org
  • +
  • The Python Guide
  • Maya: Datetimes for Humans
  • Records: SQL for Humans
  • Legit: Git for Humans
  • diff --git a/docs/_templates/sidebarlogo.html b/docs/_templates/sidebarlogo.html index 263f4407d7..7fe26493e7 100644 --- a/docs/_templates/sidebarlogo.html +++ b/docs/_templates/sidebarlogo.html @@ -20,7 +20,7 @@

    Stay Informed

    Receive updates on new releases and upcoming projects.

    -

    Join Mailing List.

    +

    Join Mailing List.


    @@ -34,14 +34,14 @@

    Stay Informed

    Other Projects

    -

    More Kenneth Reitz projects:

    +

    More Kenneth Reitz projects:

      -
    • Requests-HTML
    • +
    • Requests-HTML
    • howtopython.org
    • pipenv
    • -
    • pep8.org
    • -
    • httpbin.org
    • -
    • The Python Guide
    • +
    • pep8.org
    • +
    • httpbin.org
    • +
    • The Python Guide
    • Maya: Datetimes for Humans
    • Records: SQL for Humans
    • Legit: Git for Humans
    • diff --git a/docs/api.rst b/docs/api.rst index ef84bf6077..93cc4f0d20 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -139,7 +139,7 @@ API Changes s = requests.Session() # formerly, session took parameters s.auth = auth s.headers.update(headers) - r = s.get('http://httpbin.org/headers') + r = s.get('https://httpbin.org/headers') * All request hooks have been removed except 'response'. @@ -185,7 +185,7 @@ API Changes requests_log.setLevel(logging.DEBUG) requests_log.propagate = True - requests.get('http://httpbin.org/headers') + requests.get('https://httpbin.org/headers') @@ -197,8 +197,8 @@ license from the ISC_ license to the `Apache 2.0`_ license. The Apache 2.0 license ensures that contributions to Requests are also covered by the Apache 2.0 license. -.. _ISC: http://opensource.org/licenses/ISC -.. _Apache 2.0: http://opensource.org/licenses/Apache-2.0 +.. _ISC: https://opensource.org/licenses/ISC +.. _Apache 2.0: https://opensource.org/licenses/Apache-2.0 Migrating to 2.x @@ -213,7 +213,7 @@ For more details on the changes in this release including new APIs, links to the relevant GitHub issues and some of the bug fixes, read Cory's blog_ on the subject. -.. _blog: http://lukasa.co.uk/2013/09/Requests_20/ +.. _blog: https://lukasa.co.uk/2013/09/Requests_20/ API Changes diff --git a/docs/community/out-there.rst b/docs/community/out-there.rst index 63e70169f9..79b21c6da2 100644 --- a/docs/community/out-there.rst +++ b/docs/community/out-there.rst @@ -15,10 +15,10 @@ To give it a try, simply:: Articles & Talks ================ -- `Python for the Web `_ teaches how to use Python to interact with the web, using Requests. -- `Daniel Greenfeld's Review of Requests `_ -- `My 'Python for Humans' talk `_ ( `audio `_ ) +- `Python for the Web `_ teaches how to use Python to interact with the web, using Requests. +- `Daniel Greenfeld's Review of Requests `_ +- `My 'Python for Humans' talk `_ ( `audio `_ ) - `Issac Kelly's 'Consuming Web APIs' talk `_ -- `Blog post about Requests via Yum `_ -- `Russian blog post introducing Requests `_ +- `Blog post about Requests via Yum `_ +- `Russian blog post introducing Requests `_ - `Sending JSON in Requests `_ diff --git a/docs/dev/contributing.rst b/docs/dev/contributing.rst index 06d7d6ce7f..45e5cfa104 100644 --- a/docs/dev/contributing.rst +++ b/docs/dev/contributing.rst @@ -157,7 +157,7 @@ model methods (e.g. ``__repr__``) are typically the exception to this rule. Thanks for helping to make the world a better place! -.. _PEP 8: http://pep8.org +.. _PEP 8: https://pep8.org/ .. _line continuations: https://www.python.org/dev/peps/pep-0008/#indentation Documentation Contributions diff --git a/docs/dev/philosophy.rst b/docs/dev/philosophy.rst index 563c551c82..c9d8713595 100644 --- a/docs/dev/philosophy.rst +++ b/docs/dev/philosophy.rst @@ -9,7 +9,7 @@ Requests is an open but opinionated library, created by an open but opinionated Management Style ~~~~~~~~~~~~~~~~ -`Kenneth Reitz `_ 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. +`Kenneth Reitz `_ 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. `Ian Cordasco `_ and `Cory Benfield `_ 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. @@ -26,7 +26,7 @@ Semantic Versioning 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. -Requests uses `Semantic Versioning `_. 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. +Requests uses `Semantic Versioning `_. 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. Standard Library? ~~~~~~~~~~~~~~~~~ diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst index 2076fc0059..9a615aae73 100644 --- a/docs/user/advanced.rst +++ b/docs/user/advanced.rst @@ -25,8 +25,8 @@ Let's persist some cookies across requests:: s = requests.Session() - s.get('http://httpbin.org/cookies/set/sessioncookie/123456789') - r = s.get('http://httpbin.org/cookies') + s.get('https://httpbin.org/cookies/set/sessioncookie/123456789') + r = s.get('https://httpbin.org/cookies') print(r.text) # '{"cookies": {"sessioncookie": "123456789"}}' @@ -40,7 +40,7 @@ is done by providing data to the properties on a Session object:: s.headers.update({'x-test': 'true'}) # both 'x-test' and 'x-test2' are sent - s.get('http://httpbin.org/headers', headers={'x-test2': 'true'}) + s.get('https://httpbin.org/headers', headers={'x-test2': 'true'}) Any dictionaries that you pass to a request method will be merged with the @@ -53,11 +53,11 @@ with the first request, but not the second:: s = requests.Session() - r = s.get('http://httpbin.org/cookies', cookies={'from-my': 'browser'}) + r = s.get('https://httpbin.org/cookies', cookies={'from-my': 'browser'}) print(r.text) # '{"cookies": {"from-my": "browser"}}' - r = s.get('http://httpbin.org/cookies') + r = s.get('https://httpbin.org/cookies') print(r.text) # '{"cookies": {}}' @@ -69,7 +69,7 @@ If you want to manually add cookies to your session, use the Sessions can also be used as context managers:: with requests.Session() as s: - s.get('http://httpbin.org/cookies/set/sessioncookie/123456789') + s.get('https://httpbin.org/cookies/set/sessioncookie/123456789') This will make sure the session is closed as soon as the ``with`` block is exited, even if unhandled exceptions occurred. @@ -97,7 +97,7 @@ The ``Response`` object contains all of the information returned by the server a also contains the ``Request`` object you created originally. Here is a simple request to get some very important information from Wikipedia's servers:: - >>> r = requests.get('http://en.wikipedia.org/wiki/Monty_Python') + >>> r = requests.get('https://en.wikipedia.org/wiki/Monty_Python') If we want to access the headers the server sent back to us, we do this:: @@ -323,7 +323,7 @@ inefficiency with connections. If you find yourself partially reading request bodies (or not reading them at all) while using ``stream=True``, you should make the request within a ``with`` statement to ensure it's always closed:: - with requests.get('http://httpbin.org/get', stream=True) as r: + with requests.get('https://httpbin.org/get', stream=True) as r: # Do things with the response here. .. _keep-alive: @@ -393,7 +393,7 @@ upload image files to an HTML form with a multiple file field 'images':: To do that, just set files to a list of tuples of ``(form_field_name, file_info)``:: - >>> url = 'http://httpbin.org/post' + >>> url = 'https://httpbin.org/post' >>> multiple_files = [ ('images', ('foo.png', open('foo.png', 'rb'), 'image/png')), ('images', ('bar.png', open('bar.png', 'rb'), 'image/png'))] @@ -455,13 +455,13 @@ anything, nothing else is affected. Let's print some request method arguments at runtime:: - >>> requests.get('http://httpbin.org', hooks={'response': print_url}) - http://httpbin.org + >>> requests.get('https://httpbin.org/', hooks={'response': print_url}) + https://httpbin.org/ You can add multiple hooks to a single request. Let's call two hooks at once:: - >>> r = requests.get('http://httpbin.org', hooks={'response': [print_url, record_hook]}) + >>> r = requests.get('https://httpbin.org/', hooks={'response': [print_url, record_hook]}) >>> r.hook_called True @@ -470,8 +470,8 @@ be called on every request made to the session. For example:: >>> s = requests.Session() >>> s.hooks['response'].append(print_url) - >>> s.get('http://httpbin.org') - http://httpbin.org + >>> s.get('https://httpbin.org/') + https://httpbin.org/ A ``Session`` can have multiple hooks, which will be called in the order @@ -529,7 +529,7 @@ set ``stream`` to ``True`` and iterate over the response with import json import requests - r = requests.get('http://httpbin.org/stream/20', stream=True) + r = requests.get('https://httpbin.org/stream/20', stream=True) for line in r.iter_lines(): @@ -543,7 +543,7 @@ When using `decode_unicode=True` with :meth:`Response.iter_content() `, you'll want to provide a fallback encoding in the event the server doesn't provide one:: - r = requests.get('http://httpbin.org/stream/20', stream=True) + r = requests.get('https://httpbin.org/stream/20', stream=True) if r.encoding is None: r.encoding = 'utf-8' @@ -657,7 +657,7 @@ encoding in the HTTP header, and if none is present, will use `chardet The only time Requests will not do this is if no explicit charset is present in the HTTP headers **and** the ``Content-Type`` header contains ``text``. In this situation, `RFC 2616 -`_ specifies +`_ specifies that the default charset must be ``ISO-8859-1``. Requests follows the specification in this case. If you require a different encoding, you can manually set the :attr:`Response.encoding ` @@ -921,7 +921,7 @@ it should apply to. :: >>> s = requests.Session() - >>> s.mount('http://www.github.com', MyAdapter()) + >>> s.mount('https://github.com/', MyAdapter()) The mount call registers a specific instance of a Transport Adapter to a prefix. Once mounted, any HTTP request made using that session whose URL starts @@ -959,7 +959,7 @@ library to use SSLv3:: num_pools=connections, maxsize=maxsize, block=block, ssl_version=ssl.PROTOCOL_SSLv3) -.. _`described here`: http://www.kennethreitz.org/essays/the-future-of-python-http +.. _`described here`: https://www.kennethreitz.org/essays/the-future-of-python-http .. _`urllib3`: https://github.com/shazow/urllib3 .. _blocking-or-nonblocking: @@ -1003,7 +1003,7 @@ The **connect** timeout is the number of seconds Requests will wait for your client to establish a connection to a remote machine (corresponding to the `connect()`_) call on the socket. It's a good practice to set connect timeouts to slightly larger than a multiple of 3, which is the default `TCP packet -retransmission window `_. +retransmission window `_. Once your client has connected to the server and sent the HTTP request, the **read** timeout is the number of seconds the client will wait for the server @@ -1028,4 +1028,4 @@ coffee. r = requests.get('https://github.com', timeout=None) -.. _`connect()`: http://linux.die.net/man/2/connect +.. _`connect()`: https://linux.die.net/man/2/connect diff --git a/docs/user/authentication.rst b/docs/user/authentication.rst index 411f79fd8a..bff809861e 100644 --- a/docs/user/authentication.rst +++ b/docs/user/authentication.rst @@ -53,7 +53,7 @@ Another very popular form of HTTP Authentication is Digest Authentication, and Requests supports this out of the box as well:: >>> from requests.auth import HTTPDigestAuth - >>> url = 'http://httpbin.org/digest-auth/auth/user/pass' + >>> url = 'https://httpbin.org/digest-auth/auth/user/pass' >>> requests.get(url, auth=HTTPDigestAuth('user', 'pass')) @@ -122,7 +122,7 @@ To do so, subclass :class:`AuthBase ` and implement the ... # Implement my authentication ... return r ... - >>> url = 'http://httpbin.org/get' + >>> url = 'https://httpbin.org/get' >>> requests.get(url, auth=MyAuth()) @@ -134,7 +134,7 @@ authentication will additionally add hooks to provide further functionality. Further examples can be found under the `Requests organization`_ and in the ``auth.py`` file. -.. _OAuth: http://oauth.net/ +.. _OAuth: https://oauth.net/ .. _requests_oauthlib: https://github.com/requests/requests-oauthlib .. _requests-oauthlib OAuth2 documentation: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html .. _Web Application Flow: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#web-application-flow diff --git a/docs/user/install.rst b/docs/user/install.rst index 1dd9de8e5c..3888876ab2 100644 --- a/docs/user/install.rst +++ b/docs/user/install.rst @@ -18,7 +18,7 @@ To install Requests, simply run this simple command in your terminal of choice:: $ pipenv install requests If you don't have `pipenv `_ installed (tisk tisk!), head over to the Pipenv website for installation instructions. Or, if you prefer to just use pip and don't have it installed, -`this Python installation guide `_ +`this Python installation guide `_ can guide you through the process. Get the Source Code diff --git a/docs/user/intro.rst b/docs/user/intro.rst index e8395d9d0c..be9dfaa8b3 100644 --- a/docs/user/intro.rst +++ b/docs/user/intro.rst @@ -37,8 +37,8 @@ closed-source software. Requests is released under terms of `Apache2 License`_. -.. _`GPL Licensed`: http://www.opensource.org/licenses/gpl-license.php -.. _`Apache2 License`: http://opensource.org/licenses/Apache-2.0 +.. _`GPL Licensed`: https://opensource.org/licenses/gpl-license.php +.. _`Apache2 License`: https://opensource.org/licenses/Apache-2.0 Requests License diff --git a/docs/user/quickstart.rst b/docs/user/quickstart.rst index 699c0ffd9a..1a75b5ce01 100644 --- a/docs/user/quickstart.rst +++ b/docs/user/quickstart.rst @@ -39,15 +39,15 @@ get all the information we need from this object. Requests' simple API means that all forms of HTTP request are as obvious. For example, this is how you make an HTTP POST request:: - >>> r = requests.post('http://httpbin.org/post', data = {'key':'value'}) + >>> r = requests.post('https://httpbin.org/post', data = {'key':'value'}) Nice, right? What about the other HTTP request types: PUT, DELETE, HEAD and OPTIONS? These are all just as simple:: - >>> r = requests.put('http://httpbin.org/put', data = {'key':'value'}) - >>> r = requests.delete('http://httpbin.org/delete') - >>> r = requests.head('http://httpbin.org/get') - >>> r = requests.options('http://httpbin.org/get') + >>> r = requests.put('https://httpbin.org/put', data = {'key':'value'}) + >>> r = requests.delete('https://httpbin.org/delete') + >>> r = requests.head('https://httpbin.org/get') + >>> r = requests.options('https://httpbin.org/get') That's all well and good, but it's also only the start of what Requests can do. @@ -65,12 +65,12 @@ using the ``params`` keyword argument. As an example, if you wanted to pass following code:: >>> payload = {'key1': 'value1', 'key2': 'value2'} - >>> r = requests.get('http://httpbin.org/get', params=payload) + >>> r = requests.get('https://httpbin.org/get', params=payload) You can see that the URL has been correctly encoded by printing the URL:: >>> print(r.url) - http://httpbin.org/get?key2=value2&key1=value1 + https://httpbin.org/get?key2=value2&key1=value1 Note that any dictionary key whose value is ``None`` will not be added to the URL's query string. @@ -79,9 +79,9 @@ You can also pass a list of items as a value:: >>> payload = {'key1': 'value1', 'key2': ['value2', 'value3']} - >>> r = requests.get('http://httpbin.org/get', params=payload) + >>> r = requests.get('https://httpbin.org/get', params=payload) >>> print(r.url) - http://httpbin.org/get?key1=value1&key2=value2&key2=value3 + https://httpbin.org/get?key1=value1&key2=value2&key2=value3 Response Content ---------------- @@ -233,7 +233,7 @@ dictionary of data will automatically be form-encoded when the request is made:: >>> payload = {'key1': 'value1', 'key2': 'value2'} - >>> r = requests.post("http://httpbin.org/post", data=payload) + >>> r = requests.post("https://httpbin.org/post", data=payload) >>> print(r.text) { ... @@ -250,9 +250,9 @@ as values. This is particularly useful when the form has multiple elements that use the same key:: >>> payload_tuples = [('key1', 'value1'), ('key1', 'value2')] - >>> r1 = requests.post('http://httpbin.org/post', data=payload_tuples) + >>> r1 = requests.post('https://httpbin.org/post', data=payload_tuples) >>> payload_dict = {'key1': ['value1', 'value2']} - >>> r2 = requests.post('http://httpbin.org/post', data=payload_dict) + >>> r2 = requests.post('https://httpbin.org/post', data=payload_dict) >>> print(r1.text) { ... @@ -296,7 +296,7 @@ POST a Multipart-Encoded File Requests makes it simple to upload Multipart-encoded files:: - >>> url = 'http://httpbin.org/post' + >>> url = 'https://httpbin.org/post' >>> files = {'file': open('report.xls', 'rb')} >>> r = requests.post(url, files=files) @@ -311,7 +311,7 @@ Requests makes it simple to upload Multipart-encoded files:: You can set the filename, content_type and headers explicitly:: - >>> url = 'http://httpbin.org/post' + >>> url = 'https://httpbin.org/post' >>> files = {'file': ('report.xls', open('report.xls', 'rb'), 'application/vnd.ms-excel', {'Expires': '0'})} >>> r = requests.post(url, files=files) @@ -326,7 +326,7 @@ You can set the filename, content_type and headers explicitly:: If you want, you can send strings to be received as files:: - >>> url = 'http://httpbin.org/post' + >>> url = 'https://httpbin.org/post' >>> files = {'file': ('report.csv', 'some,data,to,send\nanother,row,to,send\n')} >>> r = requests.post(url, files=files) @@ -360,7 +360,7 @@ Response Status Codes We can check the response status code:: - >>> r = requests.get('http://httpbin.org/get') + >>> r = requests.get('https://httpbin.org/get') >>> r.status_code 200 @@ -374,7 +374,7 @@ If we made a bad request (a 4XX client error or 5XX server error response), we can raise it with :meth:`Response.raise_for_status() `:: - >>> bad_r = requests.get('http://httpbin.org/status/404') + >>> bad_r = requests.get('https://httpbin.org/status/404') >>> bad_r.status_code 404 @@ -410,7 +410,7 @@ We can view the server's response headers using a Python dictionary:: } The dictionary is special, though: it's made just for HTTP headers. According to -`RFC 7230 `_, HTTP Header names +`RFC 7230 `_, HTTP Header names are case-insensitive. So, we can access the headers using any capitalization we want:: @@ -424,7 +424,7 @@ So, we can access the headers using any capitalization we want:: It is also special in that the server could have sent the same header multiple times with different values, but requests combines them so they can be represented in the dictionary within a single mapping, as per -`RFC 7230 `_: +`RFC 7230 `_: A recipient MAY combine multiple header fields with the same field name into one "field-name: field-value" pair, without changing the semantics @@ -445,7 +445,7 @@ If a response contains some Cookies, you can quickly access them:: To send your own cookies to the server, you can use the ``cookies`` parameter:: - >>> url = 'http://httpbin.org/cookies' + >>> url = 'https://httpbin.org/cookies' >>> cookies = dict(cookies_are='working') >>> r = requests.get(url, cookies=cookies) @@ -460,7 +460,7 @@ also be passed in to requests:: >>> jar = requests.cookies.RequestsCookieJar() >>> jar.set('tasty_cookie', 'yum', domain='httpbin.org', path='/cookies') >>> jar.set('gross_cookie', 'blech', domain='httpbin.org', path='/elsewhere') - >>> url = 'http://httpbin.org/cookies' + >>> url = 'https://httpbin.org/cookies' >>> r = requests.get(url, cookies=jar) >>> r.text '{"cookies": {"tasty_cookie": "yum"}}' @@ -481,7 +481,7 @@ response. For example, GitHub redirects all HTTP requests to HTTPS:: - >>> r = requests.get('http://github.com') + >>> r = requests.get('https://github.com/') >>> r.url 'https://github.com/' @@ -496,7 +496,7 @@ For example, GitHub redirects all HTTP requests to HTTPS:: If you're using GET, OPTIONS, POST, PUT, PATCH or DELETE, you can disable redirection handling with the ``allow_redirects`` parameter:: - >>> r = requests.get('http://github.com', allow_redirects=False) + >>> r = requests.get('https://github.com/', allow_redirects=False) >>> r.status_code 301 @@ -506,7 +506,7 @@ redirection handling with the ``allow_redirects`` parameter:: If you're using HEAD, you can enable redirection as well:: - >>> r = requests.head('http://github.com', allow_redirects=True) + >>> r = requests.head('https://github.com/', allow_redirects=True) >>> r.url 'https://github.com/' @@ -523,7 +523,7 @@ seconds with the ``timeout`` parameter. Nearly all production code should use this parameter in nearly all requests. Failure to do so can cause your program to hang indefinitely:: - >>> requests.get('http://github.com', timeout=0.001) + >>> requests.get('https://github.com/', timeout=0.001) Traceback (most recent call last): File "", line 1, in requests.exceptions.Timeout: HTTPConnectionPool(host='github.com', port=80): Request timed out. (timeout=0.001) diff --git a/requests/__init__.py b/requests/__init__.py index a5b3c9c33f..098c21f076 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -22,7 +22,7 @@ ... or POST: >>> payload = dict(key1='value1', key2='value2') - >>> r = requests.post('http://httpbin.org/post', data=payload) + >>> r = requests.post('https://httpbin.org/post', data=payload) >>> print(r.text) { ... diff --git a/requests/api.py b/requests/api.py index 5f07a19fa0..abada96d46 100644 --- a/requests/api.py +++ b/requests/api.py @@ -49,7 +49,7 @@ def request(method, url, **kwargs): Usage:: >>> import requests - >>> req = requests.request('GET', 'http://httpbin.org/get') + >>> req = requests.request('GET', 'https://httpbin.org/get') """ diff --git a/requests/models.py b/requests/models.py index 086e03c1c2..4c8d631c7f 100644 --- a/requests/models.py +++ b/requests/models.py @@ -218,7 +218,7 @@ class Request(RequestHooksMixin): Usage:: >>> import requests - >>> req = requests.Request('GET', 'http://httpbin.org/get') + >>> req = requests.Request('GET', 'https://httpbin.org/get') >>> req.prepare() """ @@ -278,7 +278,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): Usage:: >>> import requests - >>> req = requests.Request('GET', 'http://httpbin.org/get') + >>> req = requests.Request('GET', 'https://httpbin.org/get') >>> r = req.prepare() diff --git a/requests/sessions.py b/requests/sessions.py index 27d0e9717d..b124d793d1 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -311,7 +311,7 @@ def rebuild_method(self, prepared_request, response): """ method = prepared_request.method - # http://tools.ietf.org/html/rfc7231#section-6.4.4 + # https://tools.ietf.org/html/rfc7231#section-6.4.4 if response.status_code == codes.see_other and method != 'HEAD': method = 'GET' @@ -337,13 +337,13 @@ class Session(SessionRedirectMixin): >>> import requests >>> s = requests.Session() - >>> s.get('http://httpbin.org/get') + >>> s.get('https://httpbin.org/get') Or as a context manager:: >>> with requests.Session() as s: - >>> s.get('http://httpbin.org/get') + >>> s.get('https://httpbin.org/get') """ diff --git a/requests/utils.py b/requests/utils.py index 6892713a3d..671973127f 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -176,7 +176,7 @@ def get_netrc_auth(url, raise_errors=False): loc = os.path.expanduser('~/{0}'.format(f)) except KeyError: # os.path.expanduser can fail when $HOME is undefined and - # getpwuid fails. See http://bugs.python.org/issue20164 & + # getpwuid fails. See https://bugs.python.org/issue20164 & # https://github.com/requests/requests/issues/1846 return