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.8.0";
18 pyproject = true;
19
20 disabled = pythonOlder "3.9";
21
22 src = fetchFromGitHub {
23 owner = "n8henrie";
24 repo = "pycookiecheat";
25 tag = "v${version}";
26 hash = "sha256-jOyTfh2ZhKW/pMU7T5tfxaM0l/g59N+mirnbc0FLPbQ=";
27 };
28
29 pythonRelaxDeps = [
30 "cryptography"
31 "keyring"
32 ];
33
34 build-system = [
35 setuptools
36 setuptools-scm
37 ];
38
39 dependencies = [
40 cryptography
41 keyring
42 ];
43
44 nativeCheckInputs = [
45 playwright
46 pytestCheckHook
47 ];
48
49 pythonImportsCheck = [ "pycookiecheat" ];
50
51 preCheck = ''
52 export HOME=$(mktemp -d)
53 '';
54
55 disabledTests = [
56 # Tests want to use playwright executable
57 "test_fake_cookie"
58 "test_firefox_cookies"
59 "test_firefox_get_default_profile"
60 "test_firefox_no_cookies"
61 "test_load_firefox_cookie_db"
62 "test_no_cookies"
63 "test_warns_for_string_browser"
64 ]
65 ++ lib.optionals stdenv.hostPlatform.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}