1{ lib
2, brotli
3, buildPythonPackage
4, certifi
5, cryptography
6, python-dateutil
7, fetchpatch
8, fetchPypi
9, idna
10, mock
11, pyopenssl
12, pysocks
13, pytest-freezegun
14, pytest-timeout
15, pytestCheckHook
16, tornado
17, trustme
18}:
19
20buildPythonPackage rec {
21 pname = "urllib3";
22 version = "1.26.2";
23
24 src = fetchPypi {
25 inherit pname version;
26 sha256 = "19188f96923873c92ccb987120ec4acaa12f0461fa9ce5d3d0772bc965a39e08";
27 };
28
29 patches = [
30 (fetchpatch {
31 name = "CVE-2021-28363.patch";
32 url = "https://github.com/urllib3/urllib3/commit/8d65ea1ecf6e2cdc27d42124e587c1b83a3118b0.patch";
33 sha256 = "1lqhrd11p03iv14bp89rh67ynf000swmwsfvr3jpfdycdqr3ka9q";
34 })
35 ];
36
37 propagatedBuildInputs = [
38 brotli
39 certifi
40 cryptography
41 idna
42 pyopenssl
43 pysocks
44 ];
45
46 checkInputs = [
47 python-dateutil
48 mock
49 pytest-freezegun
50 pytest-timeout
51 pytestCheckHook
52 tornado
53 trustme
54 ];
55
56 # Tests in urllib3 are mostly timeout-based instead of event-based and
57 # are therefore inherently flaky. On your own machine, the tests will
58 # typically build fine, but on a loaded cluster such as Hydra random
59 # timeouts will occur.
60 #
61 # The urllib3 test suite has two different timeouts in their test suite
62 # (see `test/__init__.py`):
63 # - SHORT_TIMEOUT
64 # - LONG_TIMEOUT
65 # When CI is in the env, LONG_TIMEOUT will be significantly increased.
66 # Still, failures can occur and for that reason tests are disabled.
67 doCheck = false;
68
69 preCheck = ''
70 export CI # Increases LONG_TIMEOUT
71 '';
72
73 pythonImportsCheck = [ "urllib3" ];
74
75 meta = with lib; {
76 description = "Powerful, sanity-friendly HTTP client for Python";
77 homepage = "https://github.com/shazow/urllib3";
78 license = licenses.mit;
79 maintainers = with maintainers; [ fab ];
80 };
81}