2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fake-useragent,
|
|
|
|
faker,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pytest-mock,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
scrapy,
|
2023-08-22 20:05:09 +00:00
|
|
|
}:
|
2020-06-18 07:06:33 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "scrapy-fake-useragent";
|
2020-09-25 04:45:31 +00:00
|
|
|
version = "1.4.4";
|
2023-08-22 20:05:09 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-06-18 07:06:33 +00:00
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
# PyPi tarball is corrupted
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "alecxe";
|
|
|
|
repo = pname;
|
|
|
|
rev = "59c20d38c58c76618164760d546aa5b989a79b8b"; # no tags
|
2023-08-22 20:05:09 +00:00
|
|
|
hash = "sha256-khQMOQrrdHokvNqfaMWqXV7AzwGxTuxaLsZoLkNpZ3k=";
|
2020-06-18 07:06:33 +00:00
|
|
|
};
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pytest.ini \
|
|
|
|
--replace " --cov=scrapy_fake_useragent --cov-report=term --cov-report=html --fulltrace" ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
fake-useragent
|
|
|
|
faker
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pytest-mock
|
|
|
|
pytestCheckHook
|
|
|
|
scrapy
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "scrapy_fake_useragent" ];
|
2020-06-18 07:06:33 +00:00
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
disabledTests = [
|
|
|
|
# AttributeError: 'RetryUserAgentMiddleware' object has no attribute 'EXCEPTIONS_TO_RETRY'
|
|
|
|
"test_random_ua_set_on_exception"
|
|
|
|
];
|
2020-06-18 07:06:33 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-06-18 07:06:33 +00:00
|
|
|
description = "Random User-Agent middleware based on fake-useragent";
|
|
|
|
homepage = "https://github.com/alecxe/scrapy-fake-useragent";
|
2023-08-22 20:05:09 +00:00
|
|
|
changelog = "https://github.com/alecxe/scrapy-fake-useragent/blob/master/CHANGELOG.rst";
|
2020-10-27 00:29:36 +00:00
|
|
|
license = licenses.mit;
|
2023-08-22 20:05:09 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-06-18 07:06:33 +00:00
|
|
|
};
|
|
|
|
}
|