1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 cryptography,
6 fetchFromGitHub,
7 keyring,
8 pytestCheckHook,
9 pythonOlder,
10 playwright,
11 setuptools,
12 setuptools-scm,
13}:
14
15buildPythonPackage rec {
16 pname = "pycookiecheat";
17 version = "0.7.0";
18 pyproject = true;
19
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "n8henrie";
24 repo = "pycookiecheat";
25 rev = "refs/tags/v${version}";
26 hash = "sha256-x568e4M7fz93hq0y06Grz9GlrjGV38GxWd+PhNiAyBY=";
27 };
28
29 pythonRelaxDeps = [
30 "cryptography"
31 "keyring"
32 ];
33
34 build-system = [
35 setuptools
36 setuptools-scm
37 ];
38
39
40 dependencies = [
41 cryptography
42 keyring
43 ];
44
45 nativeCheckInputs = [
46 playwright
47 pytestCheckHook
48 ];
49
50 pythonImportsCheck = [ "pycookiecheat" ];
51
52 preCheck = ''
53 export HOME=$(mktemp -d)
54 '';
55
56 disabledTests = [
57 # Tests want to use playwright executable
58 "test_fake_cookie"
59 "test_firefox_cookies"
60 "test_firefox_get_default_profile"
61 "test_firefox_no_cookies"
62 "test_load_firefox_cookie_db"
63 "test_no_cookies"
64 "test_warns_for_string_browser"
65 ] ++ lib.optionals stdenv.isDarwin [ "test_slack_config" ];
66
67 meta = with lib; {
68 description = "Borrow cookies from your browser's authenticated session for use in Python scripts";
69 homepage = "https://github.com/n8henrie/pycookiecheat";
70 changelog = "https://github.com/n8henrie/pycookiecheat/blob/v${version}/CHANGELOG.md";
71 license = licenses.mit;
72 maintainers = with maintainers; [
73 fab
74 n8henrie
75 ];
76 };
77}