2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
2021-09-18 10:52:07 +00:00
|
|
|
, brotli
|
|
|
|
, brotlicffi
|
2021-03-09 03:18:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, certifi
|
|
|
|
, chardet
|
2021-09-18 10:52:07 +00:00
|
|
|
, charset-normalizer
|
2021-03-09 03:18:52 +00:00
|
|
|
, fetchPypi
|
|
|
|
, idna
|
|
|
|
, pytest-mock
|
|
|
|
, pytest-xdist
|
|
|
|
, pytestCheckHook
|
|
|
|
, urllib3
|
|
|
|
, isPy27
|
2021-09-18 10:52:07 +00:00
|
|
|
, isPy3k
|
|
|
|
, trustme
|
2021-03-09 03:18:52 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "requests";
|
2021-09-18 10:52:07 +00:00
|
|
|
version = "2.26.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-09-18 10:52:07 +00:00
|
|
|
sha256 = "sha256-uKpY+M95P/2HgtPYyxnmbvNverpDU+7IWedGeLAbB6c=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
patches = [
|
|
|
|
# Use the default NixOS CA bundle from the certifi package
|
|
|
|
./0001-Prefer-NixOS-Nix-default-CA-bundles-over-certifi.patch
|
|
|
|
];
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2021-04-26 19:14:03 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Use latest idna
|
|
|
|
substituteInPlace setup.py --replace ",<3" ""
|
|
|
|
'';
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
propagatedBuildInputs = [
|
2021-09-18 10:52:07 +00:00
|
|
|
brotlicffi
|
2021-03-09 03:18:52 +00:00
|
|
|
certifi
|
2021-09-18 10:52:07 +00:00
|
|
|
charset-normalizer
|
2021-03-09 03:18:52 +00:00
|
|
|
chardet
|
|
|
|
idna
|
|
|
|
urllib3
|
2021-09-18 10:52:07 +00:00
|
|
|
] ++ lib.optionals (isPy3k) [
|
|
|
|
brotlicffi
|
|
|
|
charset-normalizer
|
|
|
|
] ++ lib.optionals (isPy27) [
|
|
|
|
brotli
|
2021-03-09 03:18:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
pytest-mock
|
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
2021-09-18 10:52:07 +00:00
|
|
|
trustme
|
2021-03-09 03:18:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# AttributeError: 'KeywordMapping' object has no attribute 'get'
|
|
|
|
doCheck = !isPy27;
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# Disable tests that require network access and use httpbin
|
|
|
|
"requests.api.request"
|
|
|
|
"requests.models.PreparedRequest"
|
|
|
|
"requests.sessions.Session"
|
|
|
|
"requests"
|
|
|
|
"test_redirecting_to_bad_url"
|
|
|
|
"test_requests_are_updated_each_time"
|
|
|
|
"test_should_bypass_proxies_pass_only_hostname"
|
|
|
|
"test_urllib3_pool_connection_closed"
|
|
|
|
"test_urllib3_retries"
|
|
|
|
"test_use_proxy_from_environment"
|
|
|
|
"TestRequests"
|
|
|
|
"TestTimeout"
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "requests" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2021-03-09 03:18:52 +00:00
|
|
|
description = "Simple HTTP library for Python";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://docs.python-requests.org/en/latest/";
|
|
|
|
license = licenses.asl20;
|
2021-03-09 03:18:52 +00:00
|
|
|
maintainers = with maintainers; [ fab ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|