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