2021-02-17 20:56:00 +00:00
|
|
|
{ lib
|
2021-08-27 01:04:16 +01:00
|
|
|
, brotli
|
|
|
|
, brotlicffi
|
2021-02-17 20:56:00 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, certifi
|
|
|
|
, chardet
|
2021-08-12 23:01:24 +01:00
|
|
|
, charset-normalizer
|
2021-02-17 20:56:00 +00:00
|
|
|
, fetchPypi
|
|
|
|
, idna
|
2022-01-03 21:29:04 +00:00
|
|
|
, isPy27
|
|
|
|
, isPy3k
|
|
|
|
, pysocks
|
2021-02-17 20:56:00 +00:00
|
|
|
, pytest-mock
|
|
|
|
, pytest-xdist
|
|
|
|
, pytestCheckHook
|
2021-08-27 01:04:16 +01:00
|
|
|
, trustme
|
2022-01-03 21:29:04 +00:00
|
|
|
, urllib3
|
2021-02-17 20:56:00 +00:00
|
|
|
}:
|
2017-09-05 10:16:41 +01:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "requests";
|
2022-01-07 21:23:16 +00:00
|
|
|
version = "2.27.1";
|
2017-09-05 10:16:41 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-01-07 21:23:16 +00:00
|
|
|
hash = "sha256-aNfFb9WomZiHco7zBKbRLtx7508c+kdxT8i0FFJcmmE=";
|
2017-09-05 10:16:41 +01:00
|
|
|
};
|
|
|
|
|
2021-08-12 23:01:24 +01:00
|
|
|
patches = [
|
|
|
|
# Use the default NixOS CA bundle from the certifi package
|
|
|
|
./0001-Prefer-NixOS-Nix-default-CA-bundles-over-certifi.patch
|
|
|
|
];
|
2021-05-17 04:43:11 +01:00
|
|
|
|
2021-03-24 15:00:59 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Use latest idna
|
2022-01-03 21:29:04 +00:00
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace ",<3" ""
|
2021-03-24 15:00:59 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-17 20:56:00 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
certifi
|
|
|
|
idna
|
|
|
|
urllib3
|
2021-10-10 23:27:13 +01:00
|
|
|
chardet
|
2021-08-27 01:04:16 +01:00
|
|
|
] ++ lib.optionals (isPy3k) [
|
|
|
|
brotlicffi
|
|
|
|
charset-normalizer
|
|
|
|
] ++ lib.optionals (isPy27) [
|
|
|
|
brotli
|
2021-02-17 20:56:00 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
2022-01-03 21:29:04 +00:00
|
|
|
pysocks
|
2021-02-17 20:56:00 +00:00
|
|
|
pytest-mock
|
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
2021-08-12 23:01:24 +01:00
|
|
|
trustme
|
2021-02-17 20:56:00 +00:00
|
|
|
];
|
|
|
|
|
2021-03-04 07:43:37 +00:00
|
|
|
# AttributeError: 'KeywordMapping' object has no attribute 'get'
|
2021-03-04 11:34:04 +00:00
|
|
|
doCheck = !isPy27;
|
2021-03-04 07:43:37 +00:00
|
|
|
|
2021-02-17 20:56:00 +00:00
|
|
|
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"
|
|
|
|
];
|
|
|
|
|
2022-01-03 21:29:04 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"requests"
|
|
|
|
];
|
2017-09-05 10:16:41 +01:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2022-01-03 21:29:04 +00:00
|
|
|
description = "HTTP library for Python";
|
|
|
|
homepage = "http://docs.python-requests.org/";
|
2017-09-05 10:16:41 +01:00
|
|
|
license = licenses.asl20;
|
2021-02-17 20:56:00 +00:00
|
|
|
maintainers = with maintainers; [ fab ];
|
2017-09-05 10:16:41 +01:00
|
|
|
};
|
|
|
|
}
|