karakeep-python-api 1.2.1__tar.gz → 1.2.3__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.1/karakeep_python_api.egg-info → karakeep_python_api-1.2.3}/PKG-INFO +2 -2
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api/__main__.py +0 -21
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api/datatypes.py +2 -0
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api/karakeep_api.py +30 -9
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api/openapi_reference.json +153 -1
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3/karakeep_python_api.egg-info}/PKG-INFO +2 -2
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api.egg-info/requires.txt +1 -1
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/setup.py +2 -2
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/LICENSE +0 -0
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/MANIFEST.in +0 -0
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/README.md +0 -0
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api/__init__.py +0 -0
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api.egg-info/SOURCES.txt +0 -0
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api.egg-info/dependency_links.txt +0 -0
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api.egg-info/entry_points.txt +0 -0
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api.egg-info/top_level.txt +0 -0
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/setup.cfg +0 -0
- {karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/tests/test_karakeep_api.py +0 -0
{karakeep_python_api-1.2.1/karakeep_python_api.egg-info → karakeep_python_api-1.2.3}/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.3
|
|
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
|
|
@@ -12,7 +12,7 @@ Requires-Python: >=3.9
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: requests>=2.32.3
|
|
15
|
-
Requires-Dist: loguru
|
|
15
|
+
Requires-Dist: loguru>=0.7.3
|
|
16
16
|
Requires-Dist: pydantic>=2.0
|
|
17
17
|
Requires-Dist: click>=8.0
|
|
18
18
|
Provides-Extra: dev
|
|
@@ -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.3"
|
|
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}")
|
{karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api/openapi_reference.json
RENAMED
|
@@ -174,6 +174,10 @@
|
|
|
174
174
|
"type": "string",
|
|
175
175
|
"nullable": true
|
|
176
176
|
},
|
|
177
|
+
"contentAssetId": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"nullable": true
|
|
180
|
+
},
|
|
177
181
|
"crawledAt": {
|
|
178
182
|
"type": "string",
|
|
179
183
|
"nullable": true
|
|
@@ -291,6 +295,7 @@
|
|
|
291
295
|
"assetType": {
|
|
292
296
|
"type": "string",
|
|
293
297
|
"enum": [
|
|
298
|
+
"linkHtmlContent",
|
|
294
299
|
"screenshot",
|
|
295
300
|
"assetScreenshot",
|
|
296
301
|
"bannerImage",
|
|
@@ -1551,6 +1556,7 @@
|
|
|
1551
1556
|
"assetType": {
|
|
1552
1557
|
"type": "string",
|
|
1553
1558
|
"enum": [
|
|
1559
|
+
"linkHtmlContent",
|
|
1554
1560
|
"screenshot",
|
|
1555
1561
|
"assetScreenshot",
|
|
1556
1562
|
"bannerImage",
|
|
@@ -1584,6 +1590,7 @@
|
|
|
1584
1590
|
"assetType": {
|
|
1585
1591
|
"type": "string",
|
|
1586
1592
|
"enum": [
|
|
1593
|
+
"linkHtmlContent",
|
|
1587
1594
|
"screenshot",
|
|
1588
1595
|
"assetScreenshot",
|
|
1589
1596
|
"bannerImage",
|
|
@@ -3038,6 +3045,145 @@
|
|
|
3038
3045
|
},
|
|
3039
3046
|
"numHighlights": {
|
|
3040
3047
|
"type": "number"
|
|
3048
|
+
},
|
|
3049
|
+
"bookmarksByType": {
|
|
3050
|
+
"type": "object",
|
|
3051
|
+
"properties": {
|
|
3052
|
+
"link": {
|
|
3053
|
+
"type": "number"
|
|
3054
|
+
},
|
|
3055
|
+
"text": {
|
|
3056
|
+
"type": "number"
|
|
3057
|
+
},
|
|
3058
|
+
"asset": {
|
|
3059
|
+
"type": "number"
|
|
3060
|
+
}
|
|
3061
|
+
},
|
|
3062
|
+
"required": [
|
|
3063
|
+
"link",
|
|
3064
|
+
"text",
|
|
3065
|
+
"asset"
|
|
3066
|
+
]
|
|
3067
|
+
},
|
|
3068
|
+
"topDomains": {
|
|
3069
|
+
"type": "array",
|
|
3070
|
+
"items": {
|
|
3071
|
+
"type": "object",
|
|
3072
|
+
"properties": {
|
|
3073
|
+
"domain": {
|
|
3074
|
+
"type": "string"
|
|
3075
|
+
},
|
|
3076
|
+
"count": {
|
|
3077
|
+
"type": "number"
|
|
3078
|
+
}
|
|
3079
|
+
},
|
|
3080
|
+
"required": [
|
|
3081
|
+
"domain",
|
|
3082
|
+
"count"
|
|
3083
|
+
]
|
|
3084
|
+
},
|
|
3085
|
+
"maxItems": 10
|
|
3086
|
+
},
|
|
3087
|
+
"totalAssetSize": {
|
|
3088
|
+
"type": "number"
|
|
3089
|
+
},
|
|
3090
|
+
"assetsByType": {
|
|
3091
|
+
"type": "array",
|
|
3092
|
+
"items": {
|
|
3093
|
+
"type": "object",
|
|
3094
|
+
"properties": {
|
|
3095
|
+
"type": {
|
|
3096
|
+
"type": "string"
|
|
3097
|
+
},
|
|
3098
|
+
"count": {
|
|
3099
|
+
"type": "number"
|
|
3100
|
+
},
|
|
3101
|
+
"totalSize": {
|
|
3102
|
+
"type": "number"
|
|
3103
|
+
}
|
|
3104
|
+
},
|
|
3105
|
+
"required": [
|
|
3106
|
+
"type",
|
|
3107
|
+
"count",
|
|
3108
|
+
"totalSize"
|
|
3109
|
+
]
|
|
3110
|
+
}
|
|
3111
|
+
},
|
|
3112
|
+
"bookmarkingActivity": {
|
|
3113
|
+
"type": "object",
|
|
3114
|
+
"properties": {
|
|
3115
|
+
"thisWeek": {
|
|
3116
|
+
"type": "number"
|
|
3117
|
+
},
|
|
3118
|
+
"thisMonth": {
|
|
3119
|
+
"type": "number"
|
|
3120
|
+
},
|
|
3121
|
+
"thisYear": {
|
|
3122
|
+
"type": "number"
|
|
3123
|
+
},
|
|
3124
|
+
"byHour": {
|
|
3125
|
+
"type": "array",
|
|
3126
|
+
"items": {
|
|
3127
|
+
"type": "object",
|
|
3128
|
+
"properties": {
|
|
3129
|
+
"hour": {
|
|
3130
|
+
"type": "number"
|
|
3131
|
+
},
|
|
3132
|
+
"count": {
|
|
3133
|
+
"type": "number"
|
|
3134
|
+
}
|
|
3135
|
+
},
|
|
3136
|
+
"required": [
|
|
3137
|
+
"hour",
|
|
3138
|
+
"count"
|
|
3139
|
+
]
|
|
3140
|
+
}
|
|
3141
|
+
},
|
|
3142
|
+
"byDayOfWeek": {
|
|
3143
|
+
"type": "array",
|
|
3144
|
+
"items": {
|
|
3145
|
+
"type": "object",
|
|
3146
|
+
"properties": {
|
|
3147
|
+
"day": {
|
|
3148
|
+
"type": "number"
|
|
3149
|
+
},
|
|
3150
|
+
"count": {
|
|
3151
|
+
"type": "number"
|
|
3152
|
+
}
|
|
3153
|
+
},
|
|
3154
|
+
"required": [
|
|
3155
|
+
"day",
|
|
3156
|
+
"count"
|
|
3157
|
+
]
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
},
|
|
3161
|
+
"required": [
|
|
3162
|
+
"thisWeek",
|
|
3163
|
+
"thisMonth",
|
|
3164
|
+
"thisYear",
|
|
3165
|
+
"byHour",
|
|
3166
|
+
"byDayOfWeek"
|
|
3167
|
+
]
|
|
3168
|
+
},
|
|
3169
|
+
"tagUsage": {
|
|
3170
|
+
"type": "array",
|
|
3171
|
+
"items": {
|
|
3172
|
+
"type": "object",
|
|
3173
|
+
"properties": {
|
|
3174
|
+
"name": {
|
|
3175
|
+
"type": "string"
|
|
3176
|
+
},
|
|
3177
|
+
"count": {
|
|
3178
|
+
"type": "number"
|
|
3179
|
+
}
|
|
3180
|
+
},
|
|
3181
|
+
"required": [
|
|
3182
|
+
"name",
|
|
3183
|
+
"count"
|
|
3184
|
+
]
|
|
3185
|
+
},
|
|
3186
|
+
"maxItems": 10
|
|
3041
3187
|
}
|
|
3042
3188
|
},
|
|
3043
3189
|
"required": [
|
|
@@ -3046,7 +3192,13 @@
|
|
|
3046
3192
|
"numArchived",
|
|
3047
3193
|
"numTags",
|
|
3048
3194
|
"numLists",
|
|
3049
|
-
"numHighlights"
|
|
3195
|
+
"numHighlights",
|
|
3196
|
+
"bookmarksByType",
|
|
3197
|
+
"topDomains",
|
|
3198
|
+
"totalAssetSize",
|
|
3199
|
+
"assetsByType",
|
|
3200
|
+
"bookmarkingActivity",
|
|
3201
|
+
"tagUsage"
|
|
3050
3202
|
]
|
|
3051
3203
|
}
|
|
3052
3204
|
}
|
{karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3/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.3
|
|
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
|
|
@@ -12,7 +12,7 @@ Requires-Python: >=3.9
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: requests>=2.32.3
|
|
15
|
-
Requires-Dist: loguru
|
|
15
|
+
Requires-Dist: loguru>=0.7.3
|
|
16
16
|
Requires-Dist: pydantic>=2.0
|
|
17
17
|
Requires-Dist: click>=8.0
|
|
18
18
|
Provides-Extra: dev
|
|
@@ -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.3",
|
|
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",
|
|
@@ -33,7 +33,7 @@ setup(
|
|
|
33
33
|
python_requires=">=3.9",
|
|
34
34
|
install_requires=[
|
|
35
35
|
"requests >= 2.32.3",
|
|
36
|
-
"loguru",
|
|
36
|
+
"loguru >= 0.7.3",
|
|
37
37
|
"pydantic >= 2.0", # For data validation and modeling based on datatypes.py
|
|
38
38
|
"click >= 8.0", # For the CLI
|
|
39
39
|
],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{karakeep_python_api-1.2.1 → karakeep_python_api-1.2.3}/karakeep_python_api.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|