1{
2 lib,
3 buildPythonPackage,
4 fake-useragent,
5 faker,
6 fetchFromGitHub,
7 pytest-mock,
8 pytestCheckHook,
9 pythonOlder,
10 scrapy,
11}:
12
13buildPythonPackage rec {
14 pname = "scrapy-fake-useragent";
15 version = "1.4.4";
16 format = "setuptools";
17
18 disabled = pythonOlder "3.7";
19
20 # PyPi tarball is corrupted
21 src = fetchFromGitHub {
22 owner = "alecxe";
23 repo = pname;
24 rev = "59c20d38c58c76618164760d546aa5b989a79b8b"; # no tags
25 hash = "sha256-khQMOQrrdHokvNqfaMWqXV7AzwGxTuxaLsZoLkNpZ3k=";
26 };
27
28 postPatch = ''
29 substituteInPlace pytest.ini \
30 --replace " --cov=scrapy_fake_useragent --cov-report=term --cov-report=html --fulltrace" ""
31 '';
32
33 propagatedBuildInputs = [
34 fake-useragent
35 faker
36 ];
37
38 nativeCheckInputs = [
39 pytest-mock
40 pytestCheckHook
41 scrapy
42 ];
43
44 pythonImportsCheck = [ "scrapy_fake_useragent" ];
45
46 disabledTests = [
47 # AttributeError: 'RetryUserAgentMiddleware' object has no attribute 'EXCEPTIONS_TO_RETRY'
48 "test_random_ua_set_on_exception"
49 ];
50
51 meta = with lib; {
52 description = "Random User-Agent middleware based on fake-useragent";
53 homepage = "https://github.com/alecxe/scrapy-fake-useragent";
54 changelog = "https://github.com/alecxe/scrapy-fake-useragent/blob/master/CHANGELOG.rst";
55 license = licenses.mit;
56 maintainers = with maintainers; [ ];
57 };
58}