2021-01-17 22:32:36 +00:00
|
|
|
{ lib
|
|
|
|
, backoff
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2021-07-06 16:35:42 +01:00
|
|
|
, parameterized
|
2021-01-17 22:32:36 +00:00
|
|
|
, pytestCheckHook
|
2021-07-06 16:35:42 +01:00
|
|
|
, pythonOlder
|
2021-01-17 22:32:36 +00:00
|
|
|
, requests
|
|
|
|
, requests-mock
|
2021-07-06 16:35:42 +01:00
|
|
|
, responses
|
|
|
|
, rich
|
|
|
|
, types-requests
|
2021-01-17 22:32:36 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "censys";
|
2021-07-06 16:35:42 +01:00
|
|
|
version = "2.0.3";
|
|
|
|
disabled = pythonOlder "3.6";
|
2021-01-17 22:32:36 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "censys";
|
|
|
|
repo = "censys-python";
|
2021-07-06 16:35:42 +01:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0ga5f6xv6rylfvalnl3cflr0w30r771gb05n5cjhxisb8an0qcb6";
|
2021-01-17 22:32:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
backoff
|
|
|
|
requests
|
2021-07-06 16:35:42 +01:00
|
|
|
rich
|
|
|
|
types-requests
|
2021-01-17 22:32:36 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
2021-07-06 16:35:42 +01:00
|
|
|
parameterized
|
2021-01-17 22:32:36 +00:00
|
|
|
pytestCheckHook
|
|
|
|
requests-mock
|
2021-07-06 16:35:42 +01:00
|
|
|
responses
|
2021-01-17 22:32:36 +00:00
|
|
|
];
|
|
|
|
|
2021-07-06 16:35:42 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "rich==10.3.0" "rich" \
|
|
|
|
--replace "types-requests==0.1.11" "types-requests"
|
|
|
|
substituteInPlace pytest.ini --replace \
|
|
|
|
" --cov -rs -p no:warnings" ""
|
|
|
|
'';
|
|
|
|
|
2021-01-17 22:32:36 +00:00
|
|
|
# The tests want to write a configuration file
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
mkdir -p $HOME
|
2021-07-06 16:35:42 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-17 22:32:36 +00:00
|
|
|
pythonImportsCheck = [ "censys" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python API wrapper for the Censys Search Engine (censys.io)";
|
|
|
|
homepage = "https://github.com/censys/censys-python";
|
|
|
|
license = with licenses; [ asl20 ];
|
2021-07-06 16:35:42 +01:00
|
|
|
maintainers = with maintainers; [ fab ];
|
2021-01-17 22:32:36 +00:00
|
|
|
};
|
|
|
|
}
|