Skip to content
Myr

faq.rst

This file

Path

docs/community/faq.rst

89 lines · 3.6 KiB

Last changed by

Merge pull request #6642 from nateprewitt/drop_python_37Nate Prewittbefore adoption7a13c04

History of this file

Take it

The walk stopped after 200 commits: lines older than 8c211a9 point at it.

Merge pull request #5681 from mateusduboli/5677Ian Stapleton Cordascobefore adoption8c211a9

lines 1–13why, one step back
1.. _faq:
23Frequently Asked Questions4==========================56This part of the documentation answers common questions about Requests.78Encoded Data?9-------------1011Requests automatically decompresses gzip-encoded responses, and does12its best to decode response content to unicode when possible.13

Add support for brotli decoding (#5783)Дилян Палаузовbefore adoption5351469

lines 14–16why, one step back
14When either the `brotli <https://pypi.org/project/Brotli/>`_ or `brotlicffi <https://pypi.org/project/brotlicffi/>`_
15package is installed, requests also decodes Brotli-encoded responses.16

Merge pull request #5681 from mateusduboli/5677Ian Stapleton Cordascobefore adoption8c211a9

lines 17–24why, one step back
17You can get direct access to the raw response (and even the socket),
18if needed as well.192021Custom User-Agents?22-------------------2324Requests allows you to easily override User-Agent strings, along with

Merge pull request #6612 from miketheman/fix-docs-urlsIan Stapleton Cordascobefore adoption72eccc8

line 25why, one step back
25any other HTTP Header. See :ref:`documentation about headers <custom-headers>`.

Merge pull request #5681 from mateusduboli/5677Ian Stapleton Cordascobefore adoption8c211a9

lines 26–57why, one step back
26
272829Why not Httplib2?30-----------------3132Chris Adams gave an excellent summary on33`Hacker News <http://news.ycombinator.com/item?id=2884406>`_:3435 httplib2 is part of why you should use requests: it's far more respectable36 as a client but not as well documented and it still takes way too much code37 for basic operations. I appreciate what httplib2 is trying to do, that38 there's a ton of hard low-level annoyances in building a modern HTTP39 client, but really, just use requests instead. Kenneth Reitz is very40 motivated and he gets the degree to which simple things should be simple41 whereas httplib2 feels more like an academic exercise than something42 people should use to build production systems[1].4344 Disclosure: I'm listed in the requests AUTHORS file but can claim credit45 for, oh, about 0.0001% of the awesomeness.4647 1. http://code.google.com/p/httplib2/issues/detail?id=96 is a good example:48 an annoying bug which affect many people, there was a fix available for49 months, which worked great when I applied it in a fork and pounded a couple50 TB of data through it, but it took over a year to make it into trunk and51 even longer to make it onto PyPI where any other project which required "52 httplib2" would get the working version.535455Python 3 Support?56-----------------57

Merge pull request #6642 from nateprewitt/drop_python_37Nate Prewittbefore adoption7a13c04

line 58why, one step back
58Yes! Requests officially supports Python 3.8+ and PyPy.

Merge pull request #5681 from mateusduboli/5677Ian Stapleton Cordascobefore adoption8c211a9

lines 59–62why, one step back
59
60Python 2 Support?61-----------------62

Farewell, sweet Concorde!Nate Prewittbefore adoption8bce583

lines 63–65why, one step back
63No! As of Requests 2.28.0, Requests no longer supports Python 2.7. Users who
64have been unable to migrate should pin to `requests<2.28`. Full information65can be found in `psf/requests#6023 <https://github.com/psf/requests/issues/6023>`_.

Merge pull request #5681 from mateusduboli/5677Ian Stapleton Cordascobefore adoption8c211a9

line 66why, one step back
66

Farewell, sweet Concorde!Nate Prewittbefore adoption8bce583

line 67why, one step back
67It is *highly* recommended users migrate to Python 3.8+ now since Python

Merge pull request #5681 from mateusduboli/5677Ian Stapleton Cordascobefore adoption8c211a9

lines 68–85why, one step back
682.7 is no longer receiving bug fixes or security updates as of January 1, 2020.
6970What are "hostname doesn't match" errors?71-----------------------------------------7273These errors occur when :ref:`SSL certificate verification <verification>`74fails to match the certificate the server responds with to the hostname75Requests thinks it's contacting. If you're certain the server's SSL setup is76correct (for example, because you can visit the site with your browser) and77you're using Python 2.7, a possible explanation is that you need78Server-Name-Indication.7980`Server-Name-Indication`_, or SNI, is an official extension to SSL where the81client tells the server what hostname it is contacting. This is important82when servers are using `Virtual Hosting`_. When such servers are hosting83more than one SSL site they need to be able to return the appropriate84certificate based on the hostname the client is connecting to.85

Farewell, sweet Concorde!Nate Prewittbefore adoption8bce583

line 86why, one step back
86Python 3 already includes native support for SNI in their SSL modules.

Merge pull request #5681 from mateusduboli/5677Ian Stapleton Cordascobefore adoption8c211a9

lines 87–89why, one step back
87
88.. _`Server-Name-Indication`: https://en.wikipedia.org/wiki/Server_Name_Indication89.. _`virtual hosting`: https://en.wikipedia.org/wiki/Virtual_hosting