1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 certifi, 6 chardet, 7 charset-normalizer, 8 fetchPypi, 9 idna, 10 pysocks, 11 pytest-mock, 12 pytest-xdist, 13 pytestCheckHook, 14 pythonOlder, 15 urllib3, 16}: 17 18buildPythonPackage rec { 19 pname = "requests"; 20 version = "2.32.3"; 21 format = "setuptools"; 22 23 disabled = pythonOlder "3.7"; 24 25 __darwinAllowLocalNetworking = true; 26 27 src = fetchPypi { 28 inherit pname version; 29 hash = "sha256-VTZUF3NOsYJVWQqf+euX6eHaho1MzWQCOZ6vaK8gp2A="; 30 }; 31 32 patches = [ 33 # https://github.com/psf/requests/issues/6730 34 # https://github.com/psf/requests/pull/6731 35 ./ca-load-regression.patch 36 ]; 37 38 dependencies = [ 39 certifi 40 charset-normalizer 41 idna 42 urllib3 43 ]; 44 45 optional-dependencies = { 46 security = [ ]; 47 socks = [ pysocks ]; 48 use_chardet_on_py3 = [ chardet ]; 49 }; 50 51 nativeCheckInputs = [ 52 pytest-mock 53 pytest-xdist 54 pytestCheckHook 55 ] ++ optional-dependencies.socks; 56 57 disabledTests = 58 [ 59 # Disable tests that require network access and use httpbin 60 "requests.api.request" 61 "requests.models.PreparedRequest" 62 "requests.sessions.Session" 63 "requests" 64 "test_redirecting_to_bad_url" 65 "test_requests_are_updated_each_time" 66 "test_should_bypass_proxies_pass_only_hostname" 67 "test_urllib3_pool_connection_closed" 68 "test_urllib3_retries" 69 "test_use_proxy_from_environment" 70 "TestRequests" 71 "TestTimeout" 72 ] 73 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ 74 # Fatal Python error: Aborted 75 "test_basic_response" 76 "test_text_response" 77 ]; 78 79 disabledTestPaths = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ 80 # Fatal Python error: Aborted 81 "tests/test_lowlevel.py" 82 ]; 83 84 pythonImportsCheck = [ "requests" ]; 85 86 meta = with lib; { 87 description = "HTTP library for Python"; 88 homepage = "http://docs.python-requests.org/"; 89 changelog = "https://github.com/psf/requests/blob/v${version}/HISTORY.md"; 90 license = licenses.asl20; 91 maintainers = with maintainers; [ fab ]; 92 }; 93}