recapi 0.4.14__tar.gz → 0.4.15__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.
- {recapi-0.4.14/recapi.egg-info → recapi-0.4.15}/PKG-INFO +6 -6
- {recapi-0.4.14 → recapi-0.4.15}/README.md +5 -5
- {recapi-0.4.14 → recapi-0.4.15}/pyproject.toml +1 -1
- {recapi-0.4.14 → recapi-0.4.15}/recapi/client.py +3 -3
- {recapi-0.4.14 → recapi-0.4.15/recapi.egg-info}/PKG-INFO +6 -6
- {recapi-0.4.14 → recapi-0.4.15}/LICENSE +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/recapi/__init__.py +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/recapi/async_client.py +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/recapi/history.py +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/recapi/py.typed +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/recapi.egg-info/SOURCES.txt +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/recapi.egg-info/dependency_links.txt +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/recapi.egg-info/top_level.txt +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/setup.cfg +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/tests/test_async_client.py +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/tests/test_client.py +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/tests/test_client_vectors.py +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/tests/test_history.py +0 -0
- {recapi-0.4.14 → recapi-0.4.15}/tests/test_stores.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: recapi
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.15
|
|
4
4
|
Summary: Python client for the recapi recommendation API: per-user history, event batching, retries, popular fallback.
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Homepage, https://recapi.io
|
|
@@ -49,7 +49,7 @@ Your recapi API serves the same library, for servers that can't reach PyPI
|
|
|
49
49
|
(the dashboard's quick start shows the line with your API's address):
|
|
50
50
|
|
|
51
51
|
```sh
|
|
52
|
-
pip install https://api.<your-domain>/sdk/python/recapi-0.4.
|
|
52
|
+
pip install https://api.<your-domain>/sdk/python/recapi-0.4.15-py3-none-any.whl
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
To work on the library itself, install it from a checkout of recapi's repository
|
|
@@ -66,12 +66,12 @@ client = recapi.Client("rk_sec_…", "https://api.example.com")
|
|
|
66
66
|
|
|
67
67
|
# Describe your items (a product, an article, a video…), 1,000 per request.
|
|
68
68
|
# metadata is yours (up to 2 KB) and comes back with the item in every list.
|
|
69
|
-
item = {"item_id": "
|
|
69
|
+
item = {"item_id": "item_4471", "tags": ["sports"], "title": "Cup final highlights"}
|
|
70
70
|
item["metadata"] = {"name": "Cup final highlights", "url": "/videos/42"}
|
|
71
71
|
client.upsert_items([item])
|
|
72
72
|
|
|
73
73
|
# The user opened an item (level 3). Queued and sent in the background.
|
|
74
|
-
client.track("
|
|
74
|
+
client.track("item_4471", "view", user_id="user-881")
|
|
75
75
|
|
|
76
76
|
# Recommendations for that user. If recapi is slow or failing or a limit is
|
|
77
77
|
# reached, this returns popular items instead (result.fallback is True), and an
|
|
@@ -122,7 +122,7 @@ items of the lists before it unless `allow_repeats=True`.
|
|
|
122
122
|
```python
|
|
123
123
|
similar, for_you = client.recommend_lists(
|
|
124
124
|
[
|
|
125
|
-
{"placement": "product", "count": 4, "context_item_id": "
|
|
125
|
+
{"placement": "product", "count": 4, "context_item_id": "item_4471"},
|
|
126
126
|
{"placement": "for_you", "count": 8},
|
|
127
127
|
],
|
|
128
128
|
user_id="user-881",
|
|
@@ -230,7 +230,7 @@ tried, and clicks and experiments counted against that one list. Render the
|
|
|
230
230
|
recommendations in the browser with the JS library (the script tag in the
|
|
231
231
|
dashboard's quick start), or from a fragment the page cache leaves out: an
|
|
232
232
|
uncached view called by AJAX that runs `recommend()`. Never cache a
|
|
233
|
-
`recommend()` result across visitors. The dashboard's
|
|
233
|
+
`recommend()` result across visitors. The dashboard's Home warns when
|
|
234
234
|
one recommendation id collects the events of many users ("Page caches").
|
|
235
235
|
|
|
236
236
|
## Reference
|
|
@@ -26,7 +26,7 @@ Your recapi API serves the same library, for servers that can't reach PyPI
|
|
|
26
26
|
(the dashboard's quick start shows the line with your API's address):
|
|
27
27
|
|
|
28
28
|
```sh
|
|
29
|
-
pip install https://api.<your-domain>/sdk/python/recapi-0.4.
|
|
29
|
+
pip install https://api.<your-domain>/sdk/python/recapi-0.4.15-py3-none-any.whl
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
To work on the library itself, install it from a checkout of recapi's repository
|
|
@@ -43,12 +43,12 @@ client = recapi.Client("rk_sec_…", "https://api.example.com")
|
|
|
43
43
|
|
|
44
44
|
# Describe your items (a product, an article, a video…), 1,000 per request.
|
|
45
45
|
# metadata is yours (up to 2 KB) and comes back with the item in every list.
|
|
46
|
-
item = {"item_id": "
|
|
46
|
+
item = {"item_id": "item_4471", "tags": ["sports"], "title": "Cup final highlights"}
|
|
47
47
|
item["metadata"] = {"name": "Cup final highlights", "url": "/videos/42"}
|
|
48
48
|
client.upsert_items([item])
|
|
49
49
|
|
|
50
50
|
# The user opened an item (level 3). Queued and sent in the background.
|
|
51
|
-
client.track("
|
|
51
|
+
client.track("item_4471", "view", user_id="user-881")
|
|
52
52
|
|
|
53
53
|
# Recommendations for that user. If recapi is slow or failing or a limit is
|
|
54
54
|
# reached, this returns popular items instead (result.fallback is True), and an
|
|
@@ -99,7 +99,7 @@ items of the lists before it unless `allow_repeats=True`.
|
|
|
99
99
|
```python
|
|
100
100
|
similar, for_you = client.recommend_lists(
|
|
101
101
|
[
|
|
102
|
-
{"placement": "product", "count": 4, "context_item_id": "
|
|
102
|
+
{"placement": "product", "count": 4, "context_item_id": "item_4471"},
|
|
103
103
|
{"placement": "for_you", "count": 8},
|
|
104
104
|
],
|
|
105
105
|
user_id="user-881",
|
|
@@ -207,7 +207,7 @@ tried, and clicks and experiments counted against that one list. Render the
|
|
|
207
207
|
recommendations in the browser with the JS library (the script tag in the
|
|
208
208
|
dashboard's quick start), or from a fragment the page cache leaves out: an
|
|
209
209
|
uncached view called by AJAX that runs `recommend()`. Never cache a
|
|
210
|
-
`recommend()` result across visitors. The dashboard's
|
|
210
|
+
`recommend()` result across visitors. The dashboard's Home warns when
|
|
211
211
|
one recommendation id collects the events of many users ("Page caches").
|
|
212
212
|
|
|
213
213
|
## Reference
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "recapi"
|
|
7
|
-
version = "0.4.
|
|
7
|
+
version = "0.4.15"
|
|
8
8
|
description = "Python client for the recapi recommendation API: per-user history, event batching, retries, popular fallback."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -30,7 +30,7 @@ from typing import Any, Protocol
|
|
|
30
30
|
|
|
31
31
|
from .history import History, is_id
|
|
32
32
|
|
|
33
|
-
__version__ = "0.4.
|
|
33
|
+
__version__ = "0.4.15"
|
|
34
34
|
|
|
35
35
|
log = logging.getLogger("recapi")
|
|
36
36
|
Tags = Sequence[str] | None
|
|
@@ -193,8 +193,8 @@ class Item:
|
|
|
193
193
|
metadata: dict[str, Any] | None = field(default=None, hash=False)
|
|
194
194
|
#: Why the item is listed, a reason code to turn into a label for
|
|
195
195
|
#: visitors: "for_you", "similar", "next", "bought_together",
|
|
196
|
-
#: "trending", "popular", "new", "explore" or "
|
|
197
|
-
#: "Reason codes"), None when the API sent none. New codes may be
|
|
196
|
+
#: "trending", "popular", "new", "explore", "more" or "viewed_earlier"
|
|
197
|
+
#: (docs/api.md "Reason codes"), None when the API sent none. New codes may be
|
|
198
198
|
#: added: show nothing for an unknown one.
|
|
199
199
|
why: str | None = None
|
|
200
200
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: recapi
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.15
|
|
4
4
|
Summary: Python client for the recapi recommendation API: per-user history, event batching, retries, popular fallback.
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Homepage, https://recapi.io
|
|
@@ -49,7 +49,7 @@ Your recapi API serves the same library, for servers that can't reach PyPI
|
|
|
49
49
|
(the dashboard's quick start shows the line with your API's address):
|
|
50
50
|
|
|
51
51
|
```sh
|
|
52
|
-
pip install https://api.<your-domain>/sdk/python/recapi-0.4.
|
|
52
|
+
pip install https://api.<your-domain>/sdk/python/recapi-0.4.15-py3-none-any.whl
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
To work on the library itself, install it from a checkout of recapi's repository
|
|
@@ -66,12 +66,12 @@ client = recapi.Client("rk_sec_…", "https://api.example.com")
|
|
|
66
66
|
|
|
67
67
|
# Describe your items (a product, an article, a video…), 1,000 per request.
|
|
68
68
|
# metadata is yours (up to 2 KB) and comes back with the item in every list.
|
|
69
|
-
item = {"item_id": "
|
|
69
|
+
item = {"item_id": "item_4471", "tags": ["sports"], "title": "Cup final highlights"}
|
|
70
70
|
item["metadata"] = {"name": "Cup final highlights", "url": "/videos/42"}
|
|
71
71
|
client.upsert_items([item])
|
|
72
72
|
|
|
73
73
|
# The user opened an item (level 3). Queued and sent in the background.
|
|
74
|
-
client.track("
|
|
74
|
+
client.track("item_4471", "view", user_id="user-881")
|
|
75
75
|
|
|
76
76
|
# Recommendations for that user. If recapi is slow or failing or a limit is
|
|
77
77
|
# reached, this returns popular items instead (result.fallback is True), and an
|
|
@@ -122,7 +122,7 @@ items of the lists before it unless `allow_repeats=True`.
|
|
|
122
122
|
```python
|
|
123
123
|
similar, for_you = client.recommend_lists(
|
|
124
124
|
[
|
|
125
|
-
{"placement": "product", "count": 4, "context_item_id": "
|
|
125
|
+
{"placement": "product", "count": 4, "context_item_id": "item_4471"},
|
|
126
126
|
{"placement": "for_you", "count": 8},
|
|
127
127
|
],
|
|
128
128
|
user_id="user-881",
|
|
@@ -230,7 +230,7 @@ tried, and clicks and experiments counted against that one list. Render the
|
|
|
230
230
|
recommendations in the browser with the JS library (the script tag in the
|
|
231
231
|
dashboard's quick start), or from a fragment the page cache leaves out: an
|
|
232
232
|
uncached view called by AJAX that runs `recommend()`. Never cache a
|
|
233
|
-
`recommend()` result across visitors. The dashboard's
|
|
233
|
+
`recommend()` result across visitors. The dashboard's Home warns when
|
|
234
234
|
one recommendation id collects the events of many users ("Page caches").
|
|
235
235
|
|
|
236
236
|
## Reference
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|