karakeep-python-api 1.2.2__tar.gz → 1.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {karakeep_python_api-1.2.2/karakeep_python_api.egg-info → karakeep_python_api-1.2.4}/PKG-INFO +13 -10
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/README.md +12 -9
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api/__main__.py +0 -21
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api/datatypes.py +2 -0
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api/karakeep_api.py +89 -13
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api/openapi_reference.json +172 -5
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4/karakeep_python_api.egg-info}/PKG-INFO +13 -10
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/setup.py +1 -1
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/LICENSE +0 -0
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/MANIFEST.in +0 -0
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api/__init__.py +0 -0
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api.egg-info/SOURCES.txt +0 -0
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api.egg-info/dependency_links.txt +0 -0
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api.egg-info/entry_points.txt +0 -0
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api.egg-info/requires.txt +0 -0
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api.egg-info/top_level.txt +0 -0
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/setup.cfg +0 -0
- {karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/tests/test_karakeep_api.py +0 -0
{karakeep_python_api-1.2.2/karakeep_python_api.egg-info → karakeep_python_api-1.2.4}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: karakeep_python_api
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.4
|
|
4
4
|
Summary: Community python client for the Karakeep API.
|
|
5
5
|
Home-page: https://github.com/thiswillbeyourgithub/karakeep_python_api/
|
|
6
6
|
License: GPLv3
|
|
@@ -116,6 +116,7 @@ Methods or CLI commands marked with ❌ should be used with caution as their beh
|
|
|
116
116
|
| `get_a_single_asset` | ✅ | ❌ | Tested in PDF asset lifecycle test. |
|
|
117
117
|
| `get_current_user_info` | ✅ | ❌ | Pytest: Tested indirectly during client init. CLI not directly tested. |
|
|
118
118
|
| `get_current_user_stats` | ✅ | ✅ | |
|
|
119
|
+
| `update_user` | ❌ | ❌ | |
|
|
119
120
|
|
|
120
121
|
## Installation
|
|
121
122
|
|
|
@@ -248,15 +249,17 @@ Community Scripts are a bunch of scripts made to solve specific issues. They are
|
|
|
248
249
|
|
|
249
250
|
They can be found in the [./community_scripts](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts) folder. Don't hesitate to submit yours, the contribution guidelines are in the community_scripts directory README.md file.
|
|
250
251
|
|
|
251
|
-
| Community Script | Description |
|
|
252
|
-
|
|
253
|
-
|
|
|
254
|
-
|
|
|
255
|
-
|
|
|
256
|
-
|
|
|
257
|
-
|
|
|
258
|
-
|
|
|
259
|
-
|
|
|
252
|
+
| Community Script | Description |
|
|
253
|
+
|----------------|--------------------------------------------------------------------------------------------------------------|
|
|
254
|
+
| [Karakeep-Time-Tagger](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-time-tagger) | Automatically adds time-to-read tags (`0-5m`, `5-10m`, etc.) to bookmarks based on content length analysis. Includes systemd service and timer files for automated periodic execution. |
|
|
255
|
+
| [Karakeep-List-To-Tag](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-list-to-tag) | Converts a Karakeep list into tags by adding a specified tag to all bookmarks within that list. |
|
|
256
|
+
| [Omnivore2Karakeep-Highlights](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/omnivore2karakeep-highlights) | Imports highlights from Omnivore export data to Karakeep, with intelligent position detection and bookmark matching. Supports dry-run mode for testing. |
|
|
257
|
+
| [Omnivore2Karakeep-Archived](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/omnivore2karakeep-archived) | (Should not be needed anymore) Fixes the archived status of bookmarks imported from Omnivore by reading export data and updating Karakeep accordingly. |
|
|
258
|
+
| [pocket2karakeep-archived](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/pocket2karakeep-archived) by [@youenchene](https://github.com/youenchene) | (Should not be needed anymore) Fixes the archived status of bookmarks imported from Pocket by reading export data and updating Karakeep accordingly. |
|
|
259
|
+
| [Karakeep-Archive-Before-Date](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-archive-before-date) by [@youenchene](https://github.com/youenchene) | Allow you to archive all not archived post before a given date |
|
|
260
|
+
| [Freshrss-To-Karakeep](https://github.com/thiswillbeyourgithub/freshrss_to_karakeep) | Syncs some links from Freshrss to Karakeep |
|
|
261
|
+
| [Karanki (WIP)](https://github.com/thiswillbeyourgithub/Karanki) | Bidirectional sync between anki notes and highlights |
|
|
262
|
+
| [Karakeep-remove-ai-tags](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-remove-ai-tags) by [@youenchene](https://github.com/youenchene) | Remove all tags attached by AI and not human attached |
|
|
260
263
|
|
|
261
264
|
## Development
|
|
262
265
|
|
|
@@ -81,6 +81,7 @@ Methods or CLI commands marked with ❌ should be used with caution as their beh
|
|
|
81
81
|
| `get_a_single_asset` | ✅ | ❌ | Tested in PDF asset lifecycle test. |
|
|
82
82
|
| `get_current_user_info` | ✅ | ❌ | Pytest: Tested indirectly during client init. CLI not directly tested. |
|
|
83
83
|
| `get_current_user_stats` | ✅ | ✅ | |
|
|
84
|
+
| `update_user` | ❌ | ❌ | |
|
|
84
85
|
|
|
85
86
|
## Installation
|
|
86
87
|
|
|
@@ -213,15 +214,17 @@ Community Scripts are a bunch of scripts made to solve specific issues. They are
|
|
|
213
214
|
|
|
214
215
|
They can be found in the [./community_scripts](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts) folder. Don't hesitate to submit yours, the contribution guidelines are in the community_scripts directory README.md file.
|
|
215
216
|
|
|
216
|
-
| Community Script | Description |
|
|
217
|
-
|
|
218
|
-
|
|
|
219
|
-
|
|
|
220
|
-
|
|
|
221
|
-
|
|
|
222
|
-
|
|
|
223
|
-
|
|
|
224
|
-
|
|
|
217
|
+
| Community Script | Description |
|
|
218
|
+
|----------------|--------------------------------------------------------------------------------------------------------------|
|
|
219
|
+
| [Karakeep-Time-Tagger](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-time-tagger) | Automatically adds time-to-read tags (`0-5m`, `5-10m`, etc.) to bookmarks based on content length analysis. Includes systemd service and timer files for automated periodic execution. |
|
|
220
|
+
| [Karakeep-List-To-Tag](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-list-to-tag) | Converts a Karakeep list into tags by adding a specified tag to all bookmarks within that list. |
|
|
221
|
+
| [Omnivore2Karakeep-Highlights](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/omnivore2karakeep-highlights) | Imports highlights from Omnivore export data to Karakeep, with intelligent position detection and bookmark matching. Supports dry-run mode for testing. |
|
|
222
|
+
| [Omnivore2Karakeep-Archived](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/omnivore2karakeep-archived) | (Should not be needed anymore) Fixes the archived status of bookmarks imported from Omnivore by reading export data and updating Karakeep accordingly. |
|
|
223
|
+
| [pocket2karakeep-archived](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/pocket2karakeep-archived) by [@youenchene](https://github.com/youenchene) | (Should not be needed anymore) Fixes the archived status of bookmarks imported from Pocket by reading export data and updating Karakeep accordingly. |
|
|
224
|
+
| [Karakeep-Archive-Before-Date](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-archive-before-date) by [@youenchene](https://github.com/youenchene) | Allow you to archive all not archived post before a given date |
|
|
225
|
+
| [Freshrss-To-Karakeep](https://github.com/thiswillbeyourgithub/freshrss_to_karakeep) | Syncs some links from Freshrss to Karakeep |
|
|
226
|
+
| [Karanki (WIP)](https://github.com/thiswillbeyourgithub/Karanki) | Bidirectional sync between anki notes and highlights |
|
|
227
|
+
| [Karakeep-remove-ai-tags](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-remove-ai-tags) by [@youenchene](https://github.com/youenchene) | Remove all tags attached by AI and not human attached |
|
|
225
228
|
|
|
226
229
|
## Development
|
|
227
230
|
|
|
@@ -184,12 +184,6 @@ def cli(
|
|
|
184
184
|
"The URL must include the API path, e.g., 'https://your-instance.com/api/v1/'."
|
|
185
185
|
)
|
|
186
186
|
|
|
187
|
-
# Handle verbose environment variable manually since Click's is_flag=True + envvar
|
|
188
|
-
# treats any non-empty value (including "false") as True
|
|
189
|
-
if not verbose: # Only check env var if not already set via CLI flag
|
|
190
|
-
env_verbose = os.environ.get("KARAKEEP_PYTHON_API_VERBOSE", "").lower()
|
|
191
|
-
verbose = env_verbose in ("true", "1", "yes")
|
|
192
|
-
|
|
193
187
|
# Store common API parameters in the context for commands to use
|
|
194
188
|
ctx.obj["API_ENDPOINT"] = resolved_api_endpoint # Store the resolved endpoint
|
|
195
189
|
ctx.obj["API_KEY"] = resolved_api_key # Store the resolved key
|
|
@@ -200,21 +194,6 @@ def cli(
|
|
|
200
194
|
)
|
|
201
195
|
ctx.obj["ENSURE_ASCII"] = ensure_ascii # Store the ensure_ascii flag
|
|
202
196
|
|
|
203
|
-
# --- Configure Logger ---
|
|
204
|
-
log_level = "DEBUG" if verbose else "INFO"
|
|
205
|
-
logger.remove() # Remove default handler
|
|
206
|
-
if verbose:
|
|
207
|
-
logger.add(
|
|
208
|
-
sys.stderr,
|
|
209
|
-
level=log_level,
|
|
210
|
-
format="<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>",
|
|
211
|
-
)
|
|
212
|
-
logger.debug("Verbose logging enabled with detailed format.")
|
|
213
|
-
else:
|
|
214
|
-
logger.add(sys.stderr, level=log_level) # Default format for INFO
|
|
215
|
-
logger.debug("Logger configured for level: {}", log_level)
|
|
216
|
-
logger.debug("CLI context initialized.")
|
|
217
|
-
|
|
218
197
|
|
|
219
198
|
def create_click_command(
|
|
220
199
|
api_method_name: str, api_method: Callable
|
|
@@ -51,6 +51,7 @@ class ContentTypeLink(BaseModel):
|
|
|
51
51
|
videoAssetId: Optional[str] = None
|
|
52
52
|
favicon: Optional[str] = None
|
|
53
53
|
htmlContent: Optional[str] = None
|
|
54
|
+
contentAssetId: Optional[str] = None
|
|
54
55
|
crawledAt: Optional[str] = None
|
|
55
56
|
author: Optional[str] = None
|
|
56
57
|
publisher: Optional[str] = None
|
|
@@ -81,6 +82,7 @@ class ContentTypeAsset(BaseModel):
|
|
|
81
82
|
class BookmarkAsset(BaseModel):
|
|
82
83
|
id: str
|
|
83
84
|
assetType: Literal[
|
|
85
|
+
"linkHtmlContent",
|
|
84
86
|
"screenshot",
|
|
85
87
|
"assetScreenshot",
|
|
86
88
|
"bannerImage",
|
|
@@ -85,7 +85,7 @@ class KarakeepAPI:
|
|
|
85
85
|
"""
|
|
86
86
|
|
|
87
87
|
# Version reflects the client library version, updated by bumpver
|
|
88
|
-
VERSION: str = "1.2.
|
|
88
|
+
VERSION: str = "1.2.4"
|
|
89
89
|
|
|
90
90
|
def __init__(
|
|
91
91
|
self,
|
|
@@ -93,7 +93,7 @@ class KarakeepAPI:
|
|
|
93
93
|
api_endpoint: Optional[str] = None,
|
|
94
94
|
openapi_spec_path: Optional[str] = None, # Allow None, default handled below
|
|
95
95
|
verify_ssl: bool = True,
|
|
96
|
-
verbose: bool =
|
|
96
|
+
verbose: Optional[bool] = None,
|
|
97
97
|
disable_response_validation: Optional[bool] = None,
|
|
98
98
|
rate_limit: Union[
|
|
99
99
|
float, int
|
|
@@ -113,8 +113,8 @@ class KarakeepAPI:
|
|
|
113
113
|
The loaded spec is available via the `openapi_spec` attribute.
|
|
114
114
|
verify_ssl: Whether to verify SSL certificates (default: True).
|
|
115
115
|
Can be overridden with KARAKEEP_PYTHON_API_VERIFY_SSL environment variable (true/false).
|
|
116
|
-
verbose: Enable verbose logging (default
|
|
117
|
-
|
|
116
|
+
verbose: Enable verbose logging. If None (default), reads from KARAKEEP_PYTHON_API_VERBOSE environment variable.
|
|
117
|
+
If True or False, uses the explicit value regardless of environment variable.
|
|
118
118
|
disable_response_validation: If True, skip Pydantic validation of API responses and return raw data.
|
|
119
119
|
Defaults to False. Can be overridden by setting the
|
|
120
120
|
KARAKEEP_PYTHON_API_DISABLE_RESPONSE_VALIDATION environment variable to "true".
|
|
@@ -122,6 +122,32 @@ class KarakeepAPI:
|
|
|
122
122
|
Defaults to 0.0 (no explicit rate limiting).
|
|
123
123
|
Can be overridden with KARAKEEP_PYTHON_API_RATE_LIMIT environment variable.
|
|
124
124
|
"""
|
|
125
|
+
# --- Verbose Setting and Logger Configuration ---
|
|
126
|
+
# Handle verbose environment variable if not explicitly provided
|
|
127
|
+
if verbose is None:
|
|
128
|
+
env_verbose = os.environ.get("KARAKEEP_PYTHON_API_VERBOSE", "").lower()
|
|
129
|
+
self.verbose = env_verbose in ("true", "1", "yes")
|
|
130
|
+
verbose_mess = f"Verbose set to {self.verbose} from KARAKEEP_PYTHON_API_VERBOSE environment variable."
|
|
131
|
+
else:
|
|
132
|
+
self.verbose = verbose
|
|
133
|
+
verbose_mess = f"Verbose explicitly set to {self.verbose} via argument."
|
|
134
|
+
|
|
135
|
+
# Configure logger based on verbose setting
|
|
136
|
+
log_level = "DEBUG" if self.verbose else "INFO"
|
|
137
|
+
logger.remove() # Remove default handler
|
|
138
|
+
if self.verbose:
|
|
139
|
+
logger.add(
|
|
140
|
+
sys.stderr,
|
|
141
|
+
level=log_level,
|
|
142
|
+
format="<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>",
|
|
143
|
+
)
|
|
144
|
+
logger.debug("Verbose logging enabled with detailed format.")
|
|
145
|
+
else:
|
|
146
|
+
logger.add(sys.stderr, level=log_level) # Default format for INFO
|
|
147
|
+
|
|
148
|
+
logger.debug(verbose_mess)
|
|
149
|
+
logger.debug("Logger configured for level: {}", log_level)
|
|
150
|
+
|
|
125
151
|
# --- API Key Validation ---
|
|
126
152
|
resolved_api_key = api_key or os.environ.get("KARAKEEP_PYTHON_API_KEY")
|
|
127
153
|
if not resolved_api_key:
|
|
@@ -210,7 +236,6 @@ class KarakeepAPI:
|
|
|
210
236
|
# raise APIError(f"Failed to load OpenAPI spec: {openapi_spec_path}") from e
|
|
211
237
|
|
|
212
238
|
self.verify_ssl = verify_ssl
|
|
213
|
-
self.verbose = verbose
|
|
214
239
|
|
|
215
240
|
# --- Rate Limit Setting ---
|
|
216
241
|
# Argument takes precedence over environment variable
|
|
@@ -253,10 +278,6 @@ class KarakeepAPI:
|
|
|
253
278
|
f"Response validation set to {not self.disable_response_validation} via environment variable (KARAKEEP_PYTHON_API_DISABLE_RESPONSE_VALIDATION={env_disable_validation})."
|
|
254
279
|
)
|
|
255
280
|
|
|
256
|
-
# Logger configuration is now handled by the calling application (e.g., __main__.py)
|
|
257
|
-
# or defaults to loguru's standard setup if KarakeepAPI is used as a library.
|
|
258
|
-
# self.verbose is still used for conditional logging within the class methods.
|
|
259
|
-
|
|
260
281
|
logger.debug("KarakeepAPI client initialized.")
|
|
261
282
|
logger.debug(f" Endpoint: {self.api_endpoint}")
|
|
262
283
|
logger.debug(f" Verify SSL: {self.verify_ssl}")
|
|
@@ -736,6 +757,7 @@ class KarakeepAPI:
|
|
|
736
757
|
note: Optional[str] = None,
|
|
737
758
|
summary: Optional[str] = None,
|
|
738
759
|
createdAt: Optional[str] = None, # ISO 8601 format string
|
|
760
|
+
crawlPriority: Optional[Literal["low", "normal"]] = None,
|
|
739
761
|
# Link specific
|
|
740
762
|
url: Optional[str] = None,
|
|
741
763
|
precrawledArchiveId: Optional[str] = None,
|
|
@@ -760,6 +782,7 @@ class KarakeepAPI:
|
|
|
760
782
|
note: Optional note content for the bookmark.
|
|
761
783
|
summary: Optional summary content for the bookmark.
|
|
762
784
|
createdAt: Optional creation timestamp override (ISO 8601 format string).
|
|
785
|
+
crawlPriority: Optional either 'low' or 'normal'.
|
|
763
786
|
|
|
764
787
|
--- Link Type Specific ---
|
|
765
788
|
url: The URL for the link bookmark. Required if type='link'.
|
|
@@ -800,6 +823,8 @@ class KarakeepAPI:
|
|
|
800
823
|
request_body["summary"] = summary
|
|
801
824
|
if createdAt is not None:
|
|
802
825
|
request_body["createdAt"] = createdAt
|
|
826
|
+
if crawlPriority is not None:
|
|
827
|
+
request_body["crawlPriority"] = crawlPriority
|
|
803
828
|
|
|
804
829
|
# Add type-specific fields and perform validation
|
|
805
830
|
if type == "link":
|
|
@@ -1340,7 +1365,7 @@ class KarakeepAPI:
|
|
|
1340
1365
|
Create a new list (manual or smart). Corresponds to POST /lists.
|
|
1341
1366
|
|
|
1342
1367
|
Args:
|
|
1343
|
-
name: The name of the list (required, max
|
|
1368
|
+
name: The name of the list (required, max 100 characters).
|
|
1344
1369
|
icon: The icon for the list (required).
|
|
1345
1370
|
description: Optional description for the list (max 100 characters).
|
|
1346
1371
|
parent_id: Optional parent list ID for nested lists.
|
|
@@ -1449,8 +1474,8 @@ class KarakeepAPI:
|
|
|
1449
1474
|
|
|
1450
1475
|
Args:
|
|
1451
1476
|
list_id: The ID (string) of the list to update.
|
|
1452
|
-
name: Optional new name for the list (1-
|
|
1453
|
-
description: Optional new description for the list (0-
|
|
1477
|
+
name: Optional new name for the list (1-100 characters).
|
|
1478
|
+
description: Optional new description for the list (0-500 characters, can be None to clear).
|
|
1454
1479
|
icon: Optional new icon for the list.
|
|
1455
1480
|
parent_id: Optional new parent list ID (can be None to remove parent relationship).
|
|
1456
1481
|
query: Optional new query string for smart lists (minimum 1 character).
|
|
@@ -1945,7 +1970,7 @@ class KarakeepAPI:
|
|
|
1945
1970
|
Get information about the current authenticated user. Corresponds to GET /users/me.
|
|
1946
1971
|
|
|
1947
1972
|
Returns:
|
|
1948
|
-
dict: A dictionary containing user information ('id', 'name', 'email').
|
|
1973
|
+
dict: A dictionary containing user information ('id', 'name', 'email', 'localUser').
|
|
1949
1974
|
Validation is not performed on this response type by default.
|
|
1950
1975
|
|
|
1951
1976
|
Raises:
|
|
@@ -1971,6 +1996,57 @@ class KarakeepAPI:
|
|
|
1971
1996
|
# No Pydantic validation applied here as the spec defines a simple dict response
|
|
1972
1997
|
return response_data
|
|
1973
1998
|
|
|
1999
|
+
@optional_typecheck
|
|
2000
|
+
def update_user(
|
|
2001
|
+
self,
|
|
2002
|
+
user_id: str,
|
|
2003
|
+
role: Optional[Literal["user", "admin"]] = None,
|
|
2004
|
+
bookmark_quota: Optional[int] = None,
|
|
2005
|
+
storage_quota: Optional[int] = None,
|
|
2006
|
+
browser_crawling_enabled: Optional[bool] = None,
|
|
2007
|
+
) -> Dict[str, Any]:
|
|
2008
|
+
"""
|
|
2009
|
+
Update a user's role, bookmark quota, or storage quota. Admin access required.
|
|
2010
|
+
Corresponds to PUT /admin/users/{userId}.
|
|
2011
|
+
|
|
2012
|
+
Args:
|
|
2013
|
+
user_id: The ID of the user to update.
|
|
2014
|
+
role: Optional new role for the user ("user", "admin").
|
|
2015
|
+
bookmark_quota: Optional new bookmark quota (minimum 0, can be None for unlimited).
|
|
2016
|
+
storage_quota: Optional new storage quota in bytes (minimum 0, can be None for unlimited).
|
|
2017
|
+
browser_crawling_enabled: Optional boolean to enable/disable browser crawling for the user.
|
|
2018
|
+
|
|
2019
|
+
Returns:
|
|
2020
|
+
dict: A dictionary containing success status.
|
|
2021
|
+
Example: `{"success": True}`
|
|
2022
|
+
Validation is not performed on this response type by default.
|
|
2023
|
+
|
|
2024
|
+
Raises:
|
|
2025
|
+
ValueError: If no fields are provided to update.
|
|
2026
|
+
APIError: If the API request fails (e.g., 400 bad request, 401 unauthorized, 403 forbidden, 404 user not found).
|
|
2027
|
+
"""
|
|
2028
|
+
# Construct update_data from provided arguments, excluding None values
|
|
2029
|
+
update_data = {}
|
|
2030
|
+
if role is not None:
|
|
2031
|
+
update_data["role"] = role
|
|
2032
|
+
if bookmark_quota is not None:
|
|
2033
|
+
update_data["bookmarkQuota"] = bookmark_quota
|
|
2034
|
+
if storage_quota is not None:
|
|
2035
|
+
update_data["storageQuota"] = storage_quota
|
|
2036
|
+
if browser_crawling_enabled is not None:
|
|
2037
|
+
update_data["browserCrawlingEnabled"] = browser_crawling_enabled
|
|
2038
|
+
|
|
2039
|
+
# Ensure at least one field is being updated
|
|
2040
|
+
if not update_data:
|
|
2041
|
+
raise ValueError("At least one field must be provided to update.")
|
|
2042
|
+
|
|
2043
|
+
endpoint = f"admin/users/{user_id}"
|
|
2044
|
+
response_data = self._call("PUT", endpoint, data=update_data)
|
|
2045
|
+
|
|
2046
|
+
# Response schema is a simple dict with success field, return as dict
|
|
2047
|
+
# No Pydantic validation applied here as the spec defines a simple dict response
|
|
2048
|
+
return response_data
|
|
2049
|
+
|
|
1974
2050
|
@optional_typecheck
|
|
1975
2051
|
def upload_a_new_asset(
|
|
1976
2052
|
self, file: str
|
{karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api/openapi_reference.json
RENAMED
|
@@ -686,6 +686,13 @@
|
|
|
686
686
|
"createdAt": {
|
|
687
687
|
"type": "string",
|
|
688
688
|
"nullable": true
|
|
689
|
+
},
|
|
690
|
+
"crawlPriority": {
|
|
691
|
+
"type": "string",
|
|
692
|
+
"enum": [
|
|
693
|
+
"low",
|
|
694
|
+
"normal"
|
|
695
|
+
]
|
|
689
696
|
}
|
|
690
697
|
}
|
|
691
698
|
},
|
|
@@ -1806,12 +1813,12 @@
|
|
|
1806
1813
|
"name": {
|
|
1807
1814
|
"type": "string",
|
|
1808
1815
|
"minLength": 1,
|
|
1809
|
-
"maxLength":
|
|
1816
|
+
"maxLength": 100
|
|
1810
1817
|
},
|
|
1811
1818
|
"description": {
|
|
1812
1819
|
"type": "string",
|
|
1813
1820
|
"minLength": 0,
|
|
1814
|
-
"maxLength":
|
|
1821
|
+
"maxLength": 500
|
|
1815
1822
|
},
|
|
1816
1823
|
"icon": {
|
|
1817
1824
|
"type": "string"
|
|
@@ -1999,13 +2006,13 @@
|
|
|
1999
2006
|
"name": {
|
|
2000
2007
|
"type": "string",
|
|
2001
2008
|
"minLength": 1,
|
|
2002
|
-
"maxLength":
|
|
2009
|
+
"maxLength": 100
|
|
2003
2010
|
},
|
|
2004
2011
|
"description": {
|
|
2005
2012
|
"type": "string",
|
|
2006
2013
|
"nullable": true,
|
|
2007
2014
|
"minLength": 0,
|
|
2008
|
-
"maxLength":
|
|
2015
|
+
"maxLength": 500
|
|
2009
2016
|
},
|
|
2010
2017
|
"icon": {
|
|
2011
2018
|
"type": "string"
|
|
@@ -2996,10 +3003,14 @@
|
|
|
2996
3003
|
"email": {
|
|
2997
3004
|
"type": "string",
|
|
2998
3005
|
"nullable": true
|
|
3006
|
+
},
|
|
3007
|
+
"localUser": {
|
|
3008
|
+
"type": "boolean"
|
|
2999
3009
|
}
|
|
3000
3010
|
},
|
|
3001
3011
|
"required": [
|
|
3002
|
-
"id"
|
|
3012
|
+
"id",
|
|
3013
|
+
"localUser"
|
|
3003
3014
|
]
|
|
3004
3015
|
}
|
|
3005
3016
|
}
|
|
@@ -3274,6 +3285,162 @@
|
|
|
3274
3285
|
}
|
|
3275
3286
|
}
|
|
3276
3287
|
}
|
|
3288
|
+
},
|
|
3289
|
+
"/admin/users/{userId}": {
|
|
3290
|
+
"put": {
|
|
3291
|
+
"description": "Update a user's role, bookmark quota, or storage quota. Admin access required.",
|
|
3292
|
+
"summary": "Update user",
|
|
3293
|
+
"tags": [
|
|
3294
|
+
"Admin"
|
|
3295
|
+
],
|
|
3296
|
+
"security": [
|
|
3297
|
+
{
|
|
3298
|
+
"bearerAuth": []
|
|
3299
|
+
}
|
|
3300
|
+
],
|
|
3301
|
+
"parameters": [
|
|
3302
|
+
{
|
|
3303
|
+
"schema": {
|
|
3304
|
+
"type": "string",
|
|
3305
|
+
"description": "The ID of the user to update",
|
|
3306
|
+
"example": "user_123"
|
|
3307
|
+
},
|
|
3308
|
+
"required": true,
|
|
3309
|
+
"name": "userId",
|
|
3310
|
+
"in": "path"
|
|
3311
|
+
}
|
|
3312
|
+
],
|
|
3313
|
+
"requestBody": {
|
|
3314
|
+
"content": {
|
|
3315
|
+
"application/json": {
|
|
3316
|
+
"schema": {
|
|
3317
|
+
"type": "object",
|
|
3318
|
+
"properties": {
|
|
3319
|
+
"role": {
|
|
3320
|
+
"type": "string",
|
|
3321
|
+
"enum": [
|
|
3322
|
+
"user",
|
|
3323
|
+
"admin"
|
|
3324
|
+
]
|
|
3325
|
+
},
|
|
3326
|
+
"bookmarkQuota": {
|
|
3327
|
+
"type": "integer",
|
|
3328
|
+
"nullable": true,
|
|
3329
|
+
"minimum": 0
|
|
3330
|
+
},
|
|
3331
|
+
"storageQuota": {
|
|
3332
|
+
"type": "integer",
|
|
3333
|
+
"nullable": true,
|
|
3334
|
+
"minimum": 0
|
|
3335
|
+
},
|
|
3336
|
+
"browserCrawlingEnabled": {
|
|
3337
|
+
"type": "boolean",
|
|
3338
|
+
"nullable": true
|
|
3339
|
+
}
|
|
3340
|
+
},
|
|
3341
|
+
"description": "User update data",
|
|
3342
|
+
"example": {
|
|
3343
|
+
"role": "admin",
|
|
3344
|
+
"bookmarkQuota": 1000,
|
|
3345
|
+
"storageQuota": 5000000000
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
},
|
|
3351
|
+
"responses": {
|
|
3352
|
+
"200": {
|
|
3353
|
+
"description": "User updated successfully",
|
|
3354
|
+
"content": {
|
|
3355
|
+
"application/json": {
|
|
3356
|
+
"schema": {
|
|
3357
|
+
"type": "object",
|
|
3358
|
+
"properties": {
|
|
3359
|
+
"success": {
|
|
3360
|
+
"type": "boolean"
|
|
3361
|
+
}
|
|
3362
|
+
},
|
|
3363
|
+
"required": [
|
|
3364
|
+
"success"
|
|
3365
|
+
]
|
|
3366
|
+
}
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
},
|
|
3370
|
+
"400": {
|
|
3371
|
+
"description": "Bad request - Invalid input data or cannot update own user",
|
|
3372
|
+
"content": {
|
|
3373
|
+
"application/json": {
|
|
3374
|
+
"schema": {
|
|
3375
|
+
"type": "object",
|
|
3376
|
+
"properties": {
|
|
3377
|
+
"error": {
|
|
3378
|
+
"type": "string"
|
|
3379
|
+
}
|
|
3380
|
+
},
|
|
3381
|
+
"required": [
|
|
3382
|
+
"error"
|
|
3383
|
+
]
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
},
|
|
3388
|
+
"401": {
|
|
3389
|
+
"description": "Unauthorized - Authentication required",
|
|
3390
|
+
"content": {
|
|
3391
|
+
"application/json": {
|
|
3392
|
+
"schema": {
|
|
3393
|
+
"type": "object",
|
|
3394
|
+
"properties": {
|
|
3395
|
+
"error": {
|
|
3396
|
+
"type": "string"
|
|
3397
|
+
}
|
|
3398
|
+
},
|
|
3399
|
+
"required": [
|
|
3400
|
+
"error"
|
|
3401
|
+
]
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
},
|
|
3406
|
+
"403": {
|
|
3407
|
+
"description": "Forbidden - Admin access required",
|
|
3408
|
+
"content": {
|
|
3409
|
+
"application/json": {
|
|
3410
|
+
"schema": {
|
|
3411
|
+
"type": "object",
|
|
3412
|
+
"properties": {
|
|
3413
|
+
"error": {
|
|
3414
|
+
"type": "string"
|
|
3415
|
+
}
|
|
3416
|
+
},
|
|
3417
|
+
"required": [
|
|
3418
|
+
"error"
|
|
3419
|
+
]
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
},
|
|
3424
|
+
"404": {
|
|
3425
|
+
"description": "User not found",
|
|
3426
|
+
"content": {
|
|
3427
|
+
"application/json": {
|
|
3428
|
+
"schema": {
|
|
3429
|
+
"type": "object",
|
|
3430
|
+
"properties": {
|
|
3431
|
+
"error": {
|
|
3432
|
+
"type": "string"
|
|
3433
|
+
}
|
|
3434
|
+
},
|
|
3435
|
+
"required": [
|
|
3436
|
+
"error"
|
|
3437
|
+
]
|
|
3438
|
+
}
|
|
3439
|
+
}
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3277
3444
|
}
|
|
3278
3445
|
}
|
|
3279
3446
|
}
|
{karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4/karakeep_python_api.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: karakeep_python_api
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.4
|
|
4
4
|
Summary: Community python client for the Karakeep API.
|
|
5
5
|
Home-page: https://github.com/thiswillbeyourgithub/karakeep_python_api/
|
|
6
6
|
License: GPLv3
|
|
@@ -116,6 +116,7 @@ Methods or CLI commands marked with ❌ should be used with caution as their beh
|
|
|
116
116
|
| `get_a_single_asset` | ✅ | ❌ | Tested in PDF asset lifecycle test. |
|
|
117
117
|
| `get_current_user_info` | ✅ | ❌ | Pytest: Tested indirectly during client init. CLI not directly tested. |
|
|
118
118
|
| `get_current_user_stats` | ✅ | ✅ | |
|
|
119
|
+
| `update_user` | ❌ | ❌ | |
|
|
119
120
|
|
|
120
121
|
## Installation
|
|
121
122
|
|
|
@@ -248,15 +249,17 @@ Community Scripts are a bunch of scripts made to solve specific issues. They are
|
|
|
248
249
|
|
|
249
250
|
They can be found in the [./community_scripts](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts) folder. Don't hesitate to submit yours, the contribution guidelines are in the community_scripts directory README.md file.
|
|
250
251
|
|
|
251
|
-
| Community Script | Description |
|
|
252
|
-
|
|
253
|
-
|
|
|
254
|
-
|
|
|
255
|
-
|
|
|
256
|
-
|
|
|
257
|
-
|
|
|
258
|
-
|
|
|
259
|
-
|
|
|
252
|
+
| Community Script | Description |
|
|
253
|
+
|----------------|--------------------------------------------------------------------------------------------------------------|
|
|
254
|
+
| [Karakeep-Time-Tagger](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-time-tagger) | Automatically adds time-to-read tags (`0-5m`, `5-10m`, etc.) to bookmarks based on content length analysis. Includes systemd service and timer files for automated periodic execution. |
|
|
255
|
+
| [Karakeep-List-To-Tag](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-list-to-tag) | Converts a Karakeep list into tags by adding a specified tag to all bookmarks within that list. |
|
|
256
|
+
| [Omnivore2Karakeep-Highlights](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/omnivore2karakeep-highlights) | Imports highlights from Omnivore export data to Karakeep, with intelligent position detection and bookmark matching. Supports dry-run mode for testing. |
|
|
257
|
+
| [Omnivore2Karakeep-Archived](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/omnivore2karakeep-archived) | (Should not be needed anymore) Fixes the archived status of bookmarks imported from Omnivore by reading export data and updating Karakeep accordingly. |
|
|
258
|
+
| [pocket2karakeep-archived](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/pocket2karakeep-archived) by [@youenchene](https://github.com/youenchene) | (Should not be needed anymore) Fixes the archived status of bookmarks imported from Pocket by reading export data and updating Karakeep accordingly. |
|
|
259
|
+
| [Karakeep-Archive-Before-Date](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-archive-before-date) by [@youenchene](https://github.com/youenchene) | Allow you to archive all not archived post before a given date |
|
|
260
|
+
| [Freshrss-To-Karakeep](https://github.com/thiswillbeyourgithub/freshrss_to_karakeep) | Syncs some links from Freshrss to Karakeep |
|
|
261
|
+
| [Karanki (WIP)](https://github.com/thiswillbeyourgithub/Karanki) | Bidirectional sync between anki notes and highlights |
|
|
262
|
+
| [Karakeep-remove-ai-tags](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-remove-ai-tags) by [@youenchene](https://github.com/youenchene) | Remove all tags attached by AI and not human attached |
|
|
260
263
|
|
|
261
264
|
## Development
|
|
262
265
|
|
|
@@ -7,7 +7,7 @@ with open("README.md", "r") as readme:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="karakeep_python_api",
|
|
10
|
-
version="1.2.
|
|
10
|
+
version="1.2.4",
|
|
11
11
|
description="Community python client for the Karakeep API.", # Simplified description
|
|
12
12
|
long_description=long_description,
|
|
13
13
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api.egg-info/requires.txt
RENAMED
|
File without changes
|
{karakeep_python_api-1.2.2 → karakeep_python_api-1.2.4}/karakeep_python_api.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|