karakeep-python-api 1.9.1__tar.gz → 1.10.0__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.9.1/karakeep_python_api.egg-info → karakeep_python_api-1.10.0}/PKG-INFO +2 -2
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/README.md +1 -1
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api/datatypes.py +25 -1
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api/karakeep_api.py +15 -2
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api/openapi_reference.json +108 -2
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0/karakeep_python_api.egg-info}/PKG-INFO +2 -2
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/setup.py +1 -1
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/tests/test_karakeep_api.py +97 -0
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/LICENSE +0 -0
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/MANIFEST.in +0 -0
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api/__init__.py +0 -0
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api/__main__.py +0 -0
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api.egg-info/SOURCES.txt +0 -0
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api.egg-info/dependency_links.txt +0 -0
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api.egg-info/entry_points.txt +0 -0
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api.egg-info/requires.txt +0 -0
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api.egg-info/top_level.txt +0 -0
- {karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/setup.cfg +0 -0
{karakeep_python_api-1.9.1/karakeep_python_api.egg-info → karakeep_python_api-1.10.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: karakeep_python_api
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.10.0
|
|
4
4
|
Summary: Community python client for the Karakeep API.
|
|
5
5
|
Home-page: https://github.com/thiswillbeyourgithub/karakeep_python_api/
|
|
6
6
|
Keywords: rss,karakeep,hoarder,data-hoarding,python,api,feeds,openapi
|
|
@@ -146,7 +146,7 @@ This package can be used as a Python library or as a command-line interface (CLI
|
|
|
146
146
|
|
|
147
147
|
The client can be configured using the following environment variables:
|
|
148
148
|
|
|
149
|
-
* `KARAKEEP_PYTHON_API_ENDPOINT`: **Required**. The full URL of your Karakeep API, including the `/api/v1/` path (e.g., `https://karakeep.domain.com/api/v1/` or `https://try.karakeep.
|
|
149
|
+
* `KARAKEEP_PYTHON_API_ENDPOINT`: **Required**. The full URL of your Karakeep API, including the `/api/v1/` path (e.g., `https://karakeep.domain.com/api/v1/` or `https://try.karakeep.com/api/v1/`).
|
|
150
150
|
* `KARAKEEP_PYTHON_API_KEY`: **Required**. Your Karakeep API key (Bearer token).
|
|
151
151
|
* `KARAKEEP_PYTHON_API_VERIFY_SSL`: Set to `false` to disable SSL certificate verification (default: `true`).
|
|
152
152
|
* `KARAKEEP_PYTHON_API_VERBOSE`: Set to `true` to enable verbose debug logging for the client and CLI (default: `false`).
|
|
@@ -114,7 +114,7 @@ This package can be used as a Python library or as a command-line interface (CLI
|
|
|
114
114
|
|
|
115
115
|
The client can be configured using the following environment variables:
|
|
116
116
|
|
|
117
|
-
* `KARAKEEP_PYTHON_API_ENDPOINT`: **Required**. The full URL of your Karakeep API, including the `/api/v1/` path (e.g., `https://karakeep.domain.com/api/v1/` or `https://try.karakeep.
|
|
117
|
+
* `KARAKEEP_PYTHON_API_ENDPOINT`: **Required**. The full URL of your Karakeep API, including the `/api/v1/` path (e.g., `https://karakeep.domain.com/api/v1/` or `https://try.karakeep.com/api/v1/`).
|
|
118
118
|
* `KARAKEEP_PYTHON_API_KEY`: **Required**. Your Karakeep API key (Bearer token).
|
|
119
119
|
* `KARAKEEP_PYTHON_API_VERIFY_SSL`: Set to `false` to disable SSL certificate verification (default: `true`).
|
|
120
120
|
* `KARAKEEP_PYTHON_API_VERBOSE`: Set to `true` to enable verbose debug logging for the client and CLI (default: `false`).
|
|
@@ -107,6 +107,9 @@ class BookmarkAsset(BaseModel):
|
|
|
107
107
|
"unknown",
|
|
108
108
|
]
|
|
109
109
|
fileName: Optional[str] = None
|
|
110
|
+
# Size in bytes of the stored asset. Defaults to None because servers older
|
|
111
|
+
# than the spec revision that introduced it do not send the key at all.
|
|
112
|
+
size: Optional[float] = None
|
|
110
113
|
|
|
111
114
|
|
|
112
115
|
class UploadedAsset(BaseModel):
|
|
@@ -211,14 +214,35 @@ class Highlight(BaseModel):
|
|
|
211
214
|
endOffset: float
|
|
212
215
|
color: Optional[Literal["yellow", "red", "green", "blue"]] = "yellow"
|
|
213
216
|
text: Optional[str]
|
|
217
|
+
# prefix/suffix hold the text right before/after the highlighted span. The
|
|
218
|
+
# server uses them as context to re-anchor the highlight if the offsets drift
|
|
219
|
+
# (e.g. after a re-crawl changed the content). The spec marks them required
|
|
220
|
+
# but nullable; they default to None here so responses from older servers,
|
|
221
|
+
# which do not send these keys, still validate.
|
|
222
|
+
prefix: Optional[str] = None
|
|
223
|
+
suffix: Optional[str] = None
|
|
214
224
|
note: Optional[str]
|
|
215
225
|
id: str
|
|
216
226
|
userId: str
|
|
217
227
|
createdAt: str
|
|
218
228
|
|
|
219
229
|
|
|
230
|
+
class HighlightBookmarkInfo(BaseModel):
|
|
231
|
+
title: Optional[str]
|
|
232
|
+
url: Optional[str]
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
class HighlightWithBookmark(Highlight):
|
|
236
|
+
# Returned by GET /highlights only: each highlight embeds a short summary of
|
|
237
|
+
# its bookmark so callers can display it without one extra request per
|
|
238
|
+
# highlight. Subclassing Highlight avoids duplicating its fields and keeps
|
|
239
|
+
# isinstance(h, Highlight) true for existing callers. Defaults to None so
|
|
240
|
+
# older servers that return plain Highlight objects still validate.
|
|
241
|
+
bookmark: Optional[HighlightBookmarkInfo] = None
|
|
242
|
+
|
|
243
|
+
|
|
220
244
|
class PaginatedHighlights(BaseModel):
|
|
221
|
-
highlights: list[
|
|
245
|
+
highlights: list[HighlightWithBookmark]
|
|
222
246
|
nextCursor: Optional[str] = ""
|
|
223
247
|
|
|
224
248
|
|
{karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api/karakeep_api.py
RENAMED
|
@@ -192,7 +192,7 @@ class KarakeepAPI:
|
|
|
192
192
|
"""
|
|
193
193
|
|
|
194
194
|
# Version reflects the client library version, updated by bumpver
|
|
195
|
-
VERSION: str = "1.
|
|
195
|
+
VERSION: str = "1.10.0"
|
|
196
196
|
|
|
197
197
|
def __init__(
|
|
198
198
|
self,
|
|
@@ -2126,7 +2126,9 @@ class KarakeepAPI:
|
|
|
2126
2126
|
cursor: Pagination cursor for the next page (optional).
|
|
2127
2127
|
|
|
2128
2128
|
Returns:
|
|
2129
|
-
datatypes.PaginatedHighlights: Paginated list of highlights.
|
|
2129
|
+
datatypes.PaginatedHighlights: Paginated list of highlights. Each item is a
|
|
2130
|
+
datatypes.HighlightWithBookmark, i.e. a Highlight plus a ``bookmark`` field
|
|
2131
|
+
holding the bookmark's title and url (None on servers predating it).
|
|
2130
2132
|
If response validation is disabled, returns the raw API response (dict/list).
|
|
2131
2133
|
|
|
2132
2134
|
Raises:
|
|
@@ -2152,6 +2154,8 @@ class KarakeepAPI:
|
|
|
2152
2154
|
color: Optional[Literal["yellow", "red", "green", "blue"]] = "yellow",
|
|
2153
2155
|
text: Optional[str] = None,
|
|
2154
2156
|
note: Optional[str] = None,
|
|
2157
|
+
prefix: Optional[str] = None,
|
|
2158
|
+
suffix: Optional[str] = None,
|
|
2155
2159
|
) -> Union[datatypes.Highlight, dict[str, Any], list[Any]]:
|
|
2156
2160
|
"""
|
|
2157
2161
|
Create a new highlight on a bookmark. Corresponds to POST /highlights.
|
|
@@ -2163,6 +2167,8 @@ class KarakeepAPI:
|
|
|
2163
2167
|
color: The color of the highlight ("yellow", "red", "green", "blue"). Default is "yellow".
|
|
2164
2168
|
text: Optional text content of the highlight.
|
|
2165
2169
|
note: Optional note associated with the highlight.
|
|
2170
|
+
prefix: Optional text immediately preceding the highlight, used by the server as context to re-anchor it if the offsets drift.
|
|
2171
|
+
suffix: Optional text immediately following the highlight, same purpose as prefix.
|
|
2166
2172
|
|
|
2167
2173
|
Returns:
|
|
2168
2174
|
datatypes.Highlight: The created highlight object.
|
|
@@ -2181,6 +2187,13 @@ class KarakeepAPI:
|
|
|
2181
2187
|
"text": text,
|
|
2182
2188
|
"note": note,
|
|
2183
2189
|
}
|
|
2190
|
+
# prefix/suffix are only sent when given: they are optional in the spec,
|
|
2191
|
+
# and omitting them keeps the request body identical to before for
|
|
2192
|
+
# servers that predate these fields.
|
|
2193
|
+
if prefix is not None:
|
|
2194
|
+
highlight_data["prefix"] = prefix
|
|
2195
|
+
if suffix is not None:
|
|
2196
|
+
highlight_data["suffix"] = suffix
|
|
2184
2197
|
|
|
2185
2198
|
response_data = self._call("POST", "highlights", data=highlight_data)
|
|
2186
2199
|
|
{karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api/openapi_reference.json
RENAMED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"url": "{address}/api/v1",
|
|
49
49
|
"variables": {
|
|
50
50
|
"address": {
|
|
51
|
-
"default": "https://try.karakeep.
|
|
51
|
+
"default": "https://try.karakeep.com",
|
|
52
52
|
"description": "The address of the Karakeep server"
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -465,6 +465,10 @@
|
|
|
465
465
|
"fileName": {
|
|
466
466
|
"type": "string",
|
|
467
467
|
"nullable": true
|
|
468
|
+
},
|
|
469
|
+
"size": {
|
|
470
|
+
"type": "number",
|
|
471
|
+
"nullable": true
|
|
468
472
|
}
|
|
469
473
|
},
|
|
470
474
|
"required": [
|
|
@@ -665,6 +669,14 @@
|
|
|
665
669
|
"type": "string",
|
|
666
670
|
"nullable": true
|
|
667
671
|
},
|
|
672
|
+
"prefix": {
|
|
673
|
+
"type": "string",
|
|
674
|
+
"nullable": true
|
|
675
|
+
},
|
|
676
|
+
"suffix": {
|
|
677
|
+
"type": "string",
|
|
678
|
+
"nullable": true
|
|
679
|
+
},
|
|
668
680
|
"note": {
|
|
669
681
|
"type": "string",
|
|
670
682
|
"nullable": true
|
|
@@ -685,6 +697,8 @@
|
|
|
685
697
|
"startOffset",
|
|
686
698
|
"endOffset",
|
|
687
699
|
"text",
|
|
700
|
+
"prefix",
|
|
701
|
+
"suffix",
|
|
688
702
|
"note",
|
|
689
703
|
"id",
|
|
690
704
|
"userId",
|
|
@@ -728,7 +742,7 @@
|
|
|
728
742
|
"highlights": {
|
|
729
743
|
"type": "array",
|
|
730
744
|
"items": {
|
|
731
|
-
"$ref": "#/components/schemas/
|
|
745
|
+
"$ref": "#/components/schemas/HighlightWithBookmark"
|
|
732
746
|
}
|
|
733
747
|
},
|
|
734
748
|
"nextCursor": {
|
|
@@ -742,6 +756,86 @@
|
|
|
742
756
|
"nextCursor"
|
|
743
757
|
]
|
|
744
758
|
},
|
|
759
|
+
"HighlightWithBookmark": {
|
|
760
|
+
"type": "object",
|
|
761
|
+
"properties": {
|
|
762
|
+
"bookmarkId": {
|
|
763
|
+
"type": "string"
|
|
764
|
+
},
|
|
765
|
+
"startOffset": {
|
|
766
|
+
"type": "number"
|
|
767
|
+
},
|
|
768
|
+
"endOffset": {
|
|
769
|
+
"type": "number"
|
|
770
|
+
},
|
|
771
|
+
"color": {
|
|
772
|
+
"type": "string",
|
|
773
|
+
"enum": [
|
|
774
|
+
"yellow",
|
|
775
|
+
"red",
|
|
776
|
+
"green",
|
|
777
|
+
"blue"
|
|
778
|
+
],
|
|
779
|
+
"default": "yellow"
|
|
780
|
+
},
|
|
781
|
+
"text": {
|
|
782
|
+
"type": "string",
|
|
783
|
+
"nullable": true
|
|
784
|
+
},
|
|
785
|
+
"prefix": {
|
|
786
|
+
"type": "string",
|
|
787
|
+
"nullable": true
|
|
788
|
+
},
|
|
789
|
+
"suffix": {
|
|
790
|
+
"type": "string",
|
|
791
|
+
"nullable": true
|
|
792
|
+
},
|
|
793
|
+
"note": {
|
|
794
|
+
"type": "string",
|
|
795
|
+
"nullable": true
|
|
796
|
+
},
|
|
797
|
+
"id": {
|
|
798
|
+
"type": "string"
|
|
799
|
+
},
|
|
800
|
+
"userId": {
|
|
801
|
+
"type": "string"
|
|
802
|
+
},
|
|
803
|
+
"createdAt": {
|
|
804
|
+
"type": "string",
|
|
805
|
+
"format": "date-time"
|
|
806
|
+
},
|
|
807
|
+
"bookmark": {
|
|
808
|
+
"type": "object",
|
|
809
|
+
"properties": {
|
|
810
|
+
"title": {
|
|
811
|
+
"type": "string",
|
|
812
|
+
"nullable": true
|
|
813
|
+
},
|
|
814
|
+
"url": {
|
|
815
|
+
"type": "string",
|
|
816
|
+
"nullable": true
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
"required": [
|
|
820
|
+
"title",
|
|
821
|
+
"url"
|
|
822
|
+
]
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
"required": [
|
|
826
|
+
"bookmarkId",
|
|
827
|
+
"startOffset",
|
|
828
|
+
"endOffset",
|
|
829
|
+
"text",
|
|
830
|
+
"prefix",
|
|
831
|
+
"suffix",
|
|
832
|
+
"note",
|
|
833
|
+
"id",
|
|
834
|
+
"userId",
|
|
835
|
+
"createdAt",
|
|
836
|
+
"bookmark"
|
|
837
|
+
]
|
|
838
|
+
},
|
|
745
839
|
"UploadedAsset": {
|
|
746
840
|
"type": "object",
|
|
747
841
|
"properties": {
|
|
@@ -2383,6 +2477,10 @@
|
|
|
2383
2477
|
"fileName": {
|
|
2384
2478
|
"type": "string",
|
|
2385
2479
|
"nullable": true
|
|
2480
|
+
},
|
|
2481
|
+
"size": {
|
|
2482
|
+
"type": "number",
|
|
2483
|
+
"nullable": true
|
|
2386
2484
|
}
|
|
2387
2485
|
},
|
|
2388
2486
|
"required": [
|
|
@@ -3609,6 +3707,14 @@
|
|
|
3609
3707
|
"type": "string",
|
|
3610
3708
|
"nullable": true
|
|
3611
3709
|
},
|
|
3710
|
+
"prefix": {
|
|
3711
|
+
"type": "string",
|
|
3712
|
+
"nullable": true
|
|
3713
|
+
},
|
|
3714
|
+
"suffix": {
|
|
3715
|
+
"type": "string",
|
|
3716
|
+
"nullable": true
|
|
3717
|
+
},
|
|
3612
3718
|
"note": {
|
|
3613
3719
|
"type": "string",
|
|
3614
3720
|
"nullable": true
|
{karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0/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.
|
|
3
|
+
Version: 1.10.0
|
|
4
4
|
Summary: Community python client for the Karakeep API.
|
|
5
5
|
Home-page: https://github.com/thiswillbeyourgithub/karakeep_python_api/
|
|
6
6
|
Keywords: rss,karakeep,hoarder,data-hoarding,python,api,feeds,openapi
|
|
@@ -146,7 +146,7 @@ This package can be used as a Python library or as a command-line interface (CLI
|
|
|
146
146
|
|
|
147
147
|
The client can be configured using the following environment variables:
|
|
148
148
|
|
|
149
|
-
* `KARAKEEP_PYTHON_API_ENDPOINT`: **Required**. The full URL of your Karakeep API, including the `/api/v1/` path (e.g., `https://karakeep.domain.com/api/v1/` or `https://try.karakeep.
|
|
149
|
+
* `KARAKEEP_PYTHON_API_ENDPOINT`: **Required**. The full URL of your Karakeep API, including the `/api/v1/` path (e.g., `https://karakeep.domain.com/api/v1/` or `https://try.karakeep.com/api/v1/`).
|
|
150
150
|
* `KARAKEEP_PYTHON_API_KEY`: **Required**. Your Karakeep API key (Bearer token).
|
|
151
151
|
* `KARAKEEP_PYTHON_API_VERIFY_SSL`: Set to `false` to disable SSL certificate verification (default: `true`).
|
|
152
152
|
* `KARAKEEP_PYTHON_API_VERBOSE`: Set to `true` to enable verbose debug logging for the client and CLI (default: `false`).
|
|
@@ -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.
|
|
10
|
+
version="1.10.0",
|
|
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",
|
|
@@ -140,6 +140,103 @@ def test_bookmark_requires_embedding_status():
|
|
|
140
140
|
)
|
|
141
141
|
|
|
142
142
|
|
|
143
|
+
def test_bookmark_asset_parses_optional_size():
|
|
144
|
+
"""``BookmarkAsset.size`` (bytes, nullable) was added by the newer spec.
|
|
145
|
+
|
|
146
|
+
It must be parsed when present and default to ``None`` when an older server
|
|
147
|
+
omits the key, instead of being silently dropped or raising.
|
|
148
|
+
"""
|
|
149
|
+
with_size = datatypes.BookmarkAsset.model_validate(
|
|
150
|
+
{"id": "a1", "assetType": "pdf", "fileName": "doc.pdf", "size": 1234}
|
|
151
|
+
)
|
|
152
|
+
assert with_size.size == 1234
|
|
153
|
+
without_size = datatypes.BookmarkAsset.model_validate(
|
|
154
|
+
{"id": "a2", "assetType": "screenshot"}
|
|
155
|
+
)
|
|
156
|
+
assert without_size.size is None
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def test_highlight_parses_prefix_and_suffix():
|
|
160
|
+
"""``Highlight.prefix``/``suffix`` (context around the span) were added by the newer spec.
|
|
161
|
+
|
|
162
|
+
They must be parsed when present and default to ``None`` when an older server
|
|
163
|
+
omits them, so the client keeps working against both server versions.
|
|
164
|
+
"""
|
|
165
|
+
base = {
|
|
166
|
+
"bookmarkId": "bm1",
|
|
167
|
+
"startOffset": 10,
|
|
168
|
+
"endOffset": 20,
|
|
169
|
+
"color": "yellow",
|
|
170
|
+
"text": "highlighted",
|
|
171
|
+
"note": None,
|
|
172
|
+
"id": "h1",
|
|
173
|
+
"userId": "u1",
|
|
174
|
+
"createdAt": "2026-07-05T08:00:02.000Z",
|
|
175
|
+
}
|
|
176
|
+
new = datatypes.Highlight.model_validate(
|
|
177
|
+
{**base, "prefix": "text before ", "suffix": " text after"}
|
|
178
|
+
)
|
|
179
|
+
assert new.prefix == "text before "
|
|
180
|
+
assert new.suffix == " text after"
|
|
181
|
+
old = datatypes.Highlight.model_validate(base)
|
|
182
|
+
assert old.prefix is None and old.suffix is None
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def test_paginated_highlights_parse_embedded_bookmark():
|
|
186
|
+
"""GET /highlights now embeds ``bookmark: {title, url}`` in each highlight.
|
|
187
|
+
|
|
188
|
+
The items must parse as ``HighlightWithBookmark`` (still a ``Highlight``) with
|
|
189
|
+
the bookmark summary kept, and items from older servers without the key must
|
|
190
|
+
still validate with ``bookmark`` set to ``None``.
|
|
191
|
+
"""
|
|
192
|
+
item = {
|
|
193
|
+
"bookmarkId": "bm1",
|
|
194
|
+
"startOffset": 0,
|
|
195
|
+
"endOffset": 4,
|
|
196
|
+
"text": "abcd",
|
|
197
|
+
"note": None,
|
|
198
|
+
"id": "h1",
|
|
199
|
+
"userId": "u1",
|
|
200
|
+
"createdAt": "2026-07-05T08:00:02.000Z",
|
|
201
|
+
}
|
|
202
|
+
page = datatypes.PaginatedHighlights.model_validate(
|
|
203
|
+
{
|
|
204
|
+
"highlights": [
|
|
205
|
+
{**item, "bookmark": {"title": "T", "url": "https://example.com"}},
|
|
206
|
+
item,
|
|
207
|
+
],
|
|
208
|
+
"nextCursor": None,
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
first, second = page.highlights
|
|
212
|
+
assert isinstance(first, datatypes.HighlightWithBookmark)
|
|
213
|
+
assert isinstance(first, datatypes.Highlight)
|
|
214
|
+
assert first.bookmark.title == "T"
|
|
215
|
+
assert first.bookmark.url == "https://example.com"
|
|
216
|
+
assert second.bookmark is None
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def test_create_highlight_sends_prefix_suffix_only_when_given(monkeypatch):
|
|
220
|
+
"""prefix/suffix must be in the POST body when given and absent otherwise.
|
|
221
|
+
|
|
222
|
+
Omitting them when unset keeps the request identical to what older servers
|
|
223
|
+
(which do not know these fields) received before.
|
|
224
|
+
"""
|
|
225
|
+
calls = _capture_call(monkeypatch)
|
|
226
|
+
client = KarakeepAPI.__new__(KarakeepAPI)
|
|
227
|
+
# Skip response validation: the fake _call returns a dummy payload.
|
|
228
|
+
client.disable_response_validation = True
|
|
229
|
+
|
|
230
|
+
client.create_a_new_highlight(bookmark_id="bm1", start_offset=0, end_offset=5)
|
|
231
|
+
client.create_a_new_highlight(
|
|
232
|
+
bookmark_id="bm1", start_offset=0, end_offset=5, prefix="pre", suffix="suf"
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
assert "prefix" not in calls[0]["data"] and "suffix" not in calls[0]["data"]
|
|
236
|
+
assert calls[1]["data"]["prefix"] == "pre"
|
|
237
|
+
assert calls[1]["data"]["suffix"] == "suf"
|
|
238
|
+
|
|
239
|
+
|
|
143
240
|
def _readable_chunk(*, content, start, end, total, next_cursor, version="v1"):
|
|
144
241
|
"""Build a GET /bookmarks/{id}/content payload for the offline chunking tests."""
|
|
145
242
|
return {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api.egg-info/requires.txt
RENAMED
|
File without changes
|
{karakeep_python_api-1.9.1 → karakeep_python_api-1.10.0}/karakeep_python_api.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|