Skip to content
Myr

Merge pull request #4805 from jdufresne/https

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

Prefer https:// for URLs throughout project

authored by Nate Prewitt · committed by GitHub · parents 8f20b7d, b0ad249 · 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

20 files+90 added−90 removed

modified:_appveyor/install.ps1+1 added-1 removed
224 unmodified lines
225 InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON226 InstallPip $env:PYTHON227}228229main229main
modified:docs/_templates/sidebarintro.html+6 added-6 removed
modified:docs/_templates/sidebarlogo.html+6 added-6 removed
modified:docs/community/out-there.rst+5 added-5 removed
13 unmodified lines
141516Articles & 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 lines
156model methods (e.g. ``__repr__``) are typically the exception to this rule.157158Thanks for helping to make the world a better place!159160.. _PEP 8: http://pep8.org160.. _PEP 8: https://pep8.org/161.. _line continuations: https://www.python.org/dev/peps/pep-0008/#indentation162163Documentation Contributions164---------------------------
44 unmodified lines
modified:docs/dev/philosophy.rst+2 added-2 removed
7 unmodified lines
89Management Style10~~~~~~~~~~~~~~~~1112`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.1314`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.1516Values
8 unmodified lines
25~~~~~~~~~~~~~~~~~~~2627For 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.2829Requests 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.29Requests 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.3031Standard Library?32~~~~~~~~~~~~~~~~~33
14 unmodified lines
modified:docs/user/advanced.rst+21 added-21 removed
23 unmodified lines
24Let's persist some cookies across requests::2526 s = requests.Session()2728 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')3031 print(r.text)32 # '{"cookies": {"sessioncookie": "123456789"}}'33
5 unmodified lines
39 s.auth = ('user', 'pass')40 s.headers.update({'x-test': 'true'})4142 # 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'})444546Any dictionaries that you pass to a request method will be merged with the47session-level values that are set. The method-level parameters override session
4 unmodified lines
52with the first request, but not the second::5354 s = requests.Session()5556 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"}}'5960 r = s.get('http://httpbin.org/cookies')60 r = s.get('https://httpbin.org/cookies')61 print(r.text)62 # '{"cookies": {}}'6364
3 unmodified lines
6869Sessions can also be used as context managers::7071 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')7374This will make sure the session is closed as soon as the ``with`` block is75exited, even if unhandled exceptions occurred.76
19 unmodified lines
96The ``Response`` object contains all of the information returned by the server and97also contains the ``Request`` object you created originally. Here is a simple98request to get some very important information from Wikipedia's servers::99100 >>> r = requests.get('http://en.wikipedia.org/wiki/Monty_Python')100 >>> r = requests.get('https://en.wikipedia.org/wiki/Monty_Python')101102If we want to access the headers the server sent back to us, we do this::103104 >>> r.headers
217 unmodified lines
322inefficiency with connections. If you find yourself partially reading request323bodies (or not reading them at all) while using ``stream=True``, you should324make the request within a ``with`` statement to ensure it's always closed::325326 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.328329.. _keep-alive:330
61 unmodified lines
392 <input type="file" name="images" multiple="true" required="true"/>393394To do that, just set files to a list of tuples of ``(form_field_name, file_info)``::395396 >>> 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 lines
454 return r455456Let's print some request method arguments at runtime::457458 >>> 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]>461462You can add multiple hooks to a single request. Let's call two hooks at once::463464 >>> 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 True467468You can also add hooks to a ``Session`` instance. Any hooks you add will then469be called on every request made to the session. For example::470471 >>> 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]>476477A ``Session`` can have multiple hooks, which will be called in the order478they are added.
49 unmodified lines
528529 import json530 import requests531532 r = requests.get('http://httpbin.org/stream/20', stream=True)532 r = requests.get('https://httpbin.org/stream/20', stream=True)533534 for line in r.iter_lines():535536 # filter out keep-alive new lines
5 unmodified lines
542:meth:`Response.iter_lines() <requests.Response.iter_lines>` or543:meth:`Response.iter_content() <requests.Response.iter_content>`, you'll want544to provide a fallback encoding in the event the server doesn't provide one::545546 r = requests.get('http://httpbin.org/stream/20', stream=True)546 r = requests.get('https://httpbin.org/stream/20', stream=True)547548 if r.encoding is None:549 r.encoding = 'utf-8'550
105 unmodified lines
656657The only time Requests will not do this is if no explicit charset658is present in the HTTP headers **and** the ``Content-Type``659header 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>`_ specifies661that the default charset must be ``ISO-8859-1``. Requests follows the662specification in this case. If you require a different encoding, you can663manually set the :attr:`Response.encoding <requests.Response.encoding>`664property, or use the raw :attr:`Response.content <requests.Response.content>`.
255 unmodified lines
920921::922923 >>> s = requests.Session()924 >>> s.mount('http://www.github.com', MyAdapter())924 >>> s.mount('https://github.com/', MyAdapter())925926The mount call registers a specific instance of a Transport Adapter to a927prefix. Once mounted, any HTTP request made using that session whose URL starts928with the given prefix will use the given Transport Adapter.
29 unmodified lines
958 self.poolmanager = PoolManager(959 num_pools=connections, maxsize=maxsize,960 block=block, ssl_version=ssl.PROTOCOL_SSLv3)961962.. _`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/urllib3964965.. _blocking-or-nonblocking:966
35 unmodified lines
1002The **connect** timeout is the number of seconds Requests will wait for your1003client to establish a connection to a remote machine (corresponding to the1004`connect()`_) call on the socket. It's a good practice to set connect timeouts1005to slightly larger than a multiple of 3, which is the default `TCP packet1006retransmission window <http://www.hjp.at/doc/rfc/rfc2988.txt>`_.1006retransmission window <https://www.hjp.at/doc/rfc/rfc2988.txt>`_.10071008Once 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 server1010to send a response. (Specifically, it's the number of seconds that the client
16 unmodified lines
1027::10281029 r = requests.get('https://github.com', timeout=None)10301031.. _`connect()`: http://linux.die.net/man/2/connect1031.. _`connect()`: https://linux.die.net/man/2/connect
modified:docs/user/authentication.rst+3 added-3 removed
51 unmodified lines
52Another very popular form of HTTP Authentication is Digest Authentication,53and Requests supports this out of the box as well::5455 >>> 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]>5960
60 unmodified lines
121 ... 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]>128129When an authentication handler is attached to a request,
3 unmodified lines
133134Further examples can be found under the `Requests organization`_ and in the135``auth.py`` file.136137.. _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-flow
5 unmodified lines
modified:docs/user/install.rst+1 added-1 removed
16 unmodified lines
1718 $ pipenv install requests1920If 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/>`_22can guide you through the process.2324Get the Source Code25-------------------
18 unmodified lines
modified:docs/user/intro.rst+2 added-2 removed
35 unmodified lines
36closed-source software.3738Requests is released under terms of `Apache2 License`_.3940.. _`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.0424344Requests License45----------------
2 unmodified lines
modified:docs/user/quickstart.rst+25 added-25 removed
37 unmodified lines
3839Requests' simple API means that all forms of HTTP request are as obvious. For40example, this is how you make an HTTP POST request::4142 >>> r = requests.post('http://httpbin.org/post', data = {'key':'value'})42 >>> r = requests.post('https://httpbin.org/post', data = {'key':'value'})4344Nice, right? What about the other HTTP request types: PUT, DELETE, HEAD and45OPTIONS? These are all just as simple::4647 >>> 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')5152That's all well and good, but it's also only the start of what Requests can53do.54
9 unmodified lines
64``key1=value1`` and ``key2=value2`` to ``httpbin.org/get``, you would use the65following code::6667 >>> 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)6970You can see that the URL has been correctly encoded by printing the URL::7172 >>> print(r.url)73 http://httpbin.org/get?key2=value2&key1=value173 https://httpbin.org/get?key2=value2&key1=value17475Note that any dictionary key whose value is ``None`` will not be added to the76URL's query string.7778You can also pass a list of items as a value::7980 >>> payload = {'key1': 'value1', 'key2': ['value2', 'value3']}8182 >>> 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=value38586Response Content87----------------88
143 unmodified lines
232dictionary of data will automatically be form-encoded when the request is made::233234 >>> payload = {'key1': 'value1', 'key2': 'value2'}235236 >>> 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 lines
249as values. This is particularly useful when the form has multiple elements that250use the same key::251252 >>> 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 lines
295-----------------------------296297Requests makes it simple to upload Multipart-encoded files::298299 >>> url = 'http://httpbin.org/post'299 >>> url = 'https://httpbin.org/post'300 >>> files = {'file': open('report.xls', 'rb')}301302 >>> r = requests.post(url, files=files)303 >>> r.text
6 unmodified lines
310 }311312You can set the filename, content_type and headers explicitly::313314 >>> 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'})}316317 >>> r = requests.post(url, files=files)318 >>> r.text
6 unmodified lines
325 }326327If you want, you can send strings to be received as files::328329 >>> 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')}331332 >>> r = requests.post(url, files=files)333 >>> r.text
25 unmodified lines
359---------------------360361We can check the response status code::362363 >>> r = requests.get('http://httpbin.org/get')363 >>> r = requests.get('https://httpbin.org/get')364 >>> r.status_code365 200366367Requests also comes with a built-in status code lookup object for easy
5 unmodified lines
373If we made a bad request (a 4XX client error or 5XX server error response), we374can raise it with375:meth:`Response.raise_for_status() <requests.Response.raise_for_status>`::376377 >>> bad_r = requests.get('http://httpbin.org/status/404')377 >>> bad_r = requests.get('https://httpbin.org/status/404')378 >>> bad_r.status_code379 404380381 >>> bad_r.raise_for_status()
27 unmodified lines
409 'content-type': 'application/json'410 }411412The 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 names414are case-insensitive.415416So, we can access the headers using any capitalization we want::417
5 unmodified lines
423424It is also special in that the server could have sent the same header multiple425times with different values, but requests combines them so they can be426represented 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>`_:428429 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 combined
12 unmodified lines
444445To send your own cookies to the server, you can use the ``cookies``446parameter::447448 >>> url = 'http://httpbin.org/cookies'448 >>> url = 'https://httpbin.org/cookies'449 >>> cookies = dict(cookies_are='working')450451 >>> r = requests.get(url, cookies=cookies)452 >>> r.text
6 unmodified lines
459460 >>> 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 lines
480response.481482For example, GitHub redirects all HTTP requests to HTTPS::483484 >>> r = requests.get('http://github.com')484 >>> r = requests.get('https://github.com/')485486 >>> r.url487 'https://github.com/'488
6 unmodified lines
495496If you're using GET, OPTIONS, POST, PUT, PATCH or DELETE, you can disable497redirection handling with the ``allow_redirects`` parameter::498499 >>> r = requests.get('http://github.com', allow_redirects=False)499 >>> r = requests.get('https://github.com/', allow_redirects=False)500501 >>> r.status_code502 301503
1 unmodified line
505 []506507If you're using HEAD, you can enable redirection as well::508509 >>> r = requests.head('http://github.com', allow_redirects=True)509 >>> r = requests.head('https://github.com/', allow_redirects=True)510511 >>> r.url512 'https://github.com/'513
8 unmodified lines
522seconds with the ``timeout`` parameter. Nearly all production code should use523this parameter in nearly all requests. Failure to do so can cause your program524to hang indefinitely::525526 >>> 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 lines
modified:docs/api.rst+5 added-5 removed
137 unmodified lines
138139 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')143144* All request hooks have been removed except 'response'.145146* Authentication helpers have been broken out into separate modules. See
37 unmodified lines
184 requests_log = logging.getLogger("urllib3")185 requests_log.setLevel(logging.DEBUG)186 requests_log.propagate = True187188 requests.get('http://httpbin.org/headers')188 requests.get('https://httpbin.org/headers')189190191192Licensing
3 unmodified lines
196license from the ISC_ license to the `Apache 2.0`_ license. The Apache 2.0197license ensures that contributions to Requests are also covered by the Apache1982.0 license.199200.. _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.0202203204Migrating to 2.x205----------------
6 unmodified lines
212For more details on the changes in this release including new APIs, links213to the relevant GitHub issues and some of the bug fixes, read Cory's blog_214on the subject.215216.. _blog: http://lukasa.co.uk/2013/09/Requests_20/216.. _blog: https://lukasa.co.uk/2013/09/Requests_20/217218219API Changes220~~~~~~~~~~~
40 unmodified lines
modified:requests/__init__.py+1 added-1 removed
20 unmodified lines
2122... or POST:2324 >>> 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 lines
modified:requests/api.py+1 added-1 removed
47 unmodified lines
4849 Usage::5051 >>> import requests52 >>> req = requests.request('GET', 'http://httpbin.org/get')52 >>> req = requests.request('GET', 'https://httpbin.org/get')53 <Response [200]>54 """5556 # By using the 'with' statement we are sure the session is closed, thus we
102 unmodified lines
modified:requests/models.py+2 added-2 removed
216 unmodified lines
217218 Usage::219220 >>> 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 lines
277278 Usage::279280 >>> 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]>284285 >>> s = requests.Session()
671 unmodified lines
modified:requests/sessions.py+3 added-3 removed
309 unmodified lines
310 based on certain specs or browser behavior.311 """312 method = prepared_request.method313314 # 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'317318 # Do what the browsers do, despite standards...
17 unmodified lines
336 Basic Usage::337338 >>> import requests339 >>> s = requests.Session()340 >>> s.get('http://httpbin.org/get')340 >>> s.get('https://httpbin.org/get')341 <Response [200]>342343 Or as a context manager::344345 >>> with requests.Session() as s:346 >>> s.get('http://httpbin.org/get')346 >>> s.get('https://httpbin.org/get')347 <Response [200]>348 """349350 __attrs__ = [
411 unmodified lines
modified:requests/utils.py+1 added-1 removed
174 unmodified lines
175 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 return182183 if os.path.exists(loc):
797 unmodified lines
modified: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/34build: off56environment:
23 unmodified lines
30 PYTHON_ARCH: "64"31 TOXENV: "py37"3233install: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 }3738 # Prepend newly installed Python to the PATH of this build (this cannot be
19 unmodified lines
modified:HISTORY.md+1 added-1 removed
644 unmodified lines
645646**Bugfixes**647648- 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>)6506512.5.2 (2015-02-23)652------------------653
949 unmodified lines
modified:LICENSE+1 added-1 removed
2 unmodified lines
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 at67 http://www.apache.org/licenses/LICENSE-2.07 https://www.apache.org/licenses/LICENSE-2.089 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