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
|
2022-02-10 20:34:41 +00:00
|
|
|
, isPy27
|
|
|
|
, isPy3k
|
|
|
|
, pysocks
|
2021-03-09 03:18:52 +00:00
|
|
|
, pytest-mock
|
|
|
|
, pytest-xdist
|
|
|
|
, pytestCheckHook
|
2021-09-18 10:52:07 +00:00
|
|
|
, trustme
|
2022-02-10 20:34:41 +00:00
|
|
|
, urllib3
|
2021-03-09 03:18:52 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "requests";
|
2022-02-10 20:34:41 +00:00
|
|
|
version = "2.27.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-02-10 20:34:41 +00:00
|
|
|
hash = "sha256-aNfFb9WomZiHco7zBKbRLtx7508c+kdxT8i0FFJcmmE=";
|
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
|
2022-02-10 20:34:41 +00:00
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace ",<3" ""
|
2021-04-26 19:14:03 +00:00
|
|
|
'';
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
certifi
|
|
|
|
idna
|
|
|
|
urllib3
|
2021-12-06 16:07:01 +00:00
|
|
|
chardet
|
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 = [
|
2022-02-10 20:34:41 +00:00
|
|
|
pysocks
|
2021-03-09 03:18:52 +00:00
|
|
|
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"
|
|
|
|
];
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"requests"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2022-02-10 20:34:41 +00:00
|
|
|
description = "HTTP library for Python";
|
|
|
|
homepage = "http://docs.python-requests.org/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2021-03-09 03:18:52 +00:00
|
|
|
maintainers = with maintainers; [ fab ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|