@@ -0,0 +1,50 @@
1+{ lib
2+, backoff
3+, buildPythonPackage
4+, fetchFromGitHub
5+, pytestCheckHook
6+, requests
7+, pytestcov
8+, requests-mock
9+, parameterized
10+}:
11+
12+buildPythonPackage rec {
13+ pname = "censys";
14+ version = "1.1.0";
15+
16+ src = fetchFromGitHub {
17+ owner = "censys";
18+ repo = "censys-python";
19+ rev = "v${version}";
20+ sha256 = "0vvd13g48i4alnqil98zc09zi5kv6l2s3kdfyg5syjxvq4lfd476";
21+ };
22+
23+ propagatedBuildInputs = [
24+ backoff
25+ requests
26+ ];
27+
28+ checkInputs = [
29+ pytestcov
30+ pytestCheckHook
31+ requests-mock
32+ parameterized
33+ ];
34+
35+ # The tests want to write a configuration file
36+ preCheck = ''
37+ export HOME=$(mktemp -d)
38+ mkdir -p $HOME
39+ '';
40+ # All other tests require an API key
41+ pytestFlagsArray = [ "tests/test_config.py" ];
42+ pythonImportsCheck = [ "censys" ];
43+
44+ meta = with lib; {
45+ description = "Python API wrapper for the Censys Search Engine (censys.io)";
46+ homepage = "https://github.com/censys/censys-python";
47+ license = with licenses; [ asl20 ];
48+ maintainers = [ maintainers.fab ];
49+ };
50+}