Skip to content

Commit 9e421c2

Browse files
committed
Add trust_per_page config docs chapter
1 parent 366dfb1 commit 9e421c2

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

docs/source/optional_configuration.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,25 @@ client.set_timeout(
3030
```
3131

3232
_Timeouts support integer and float values, you can also set either value to `None` to disable timeout for connect or read separately_
33+
34+
## Trust Discogs per page value
35+
36+
When accessing paginated results by index (e.g. `results[42]`),
37+
python3-discogs-client uses the `per_page` value from the API response to
38+
calculate which page contains the item directly. This is fast, but assumes the
39+
API always returns exactly `per_page` items per page.
40+
41+
If the API returns fewer items per page than the reported `per_page` value,
42+
this calculation can be off. In such cases, disable this behaviour to fall
43+
back to a sequential page walk:
44+
45+
```python
46+
>>> import discogs_client
47+
>>> d = discogs_client.Client('ExampleApplication/0.1')
48+
>>> d.trust_per_page = False
49+
```
50+
51+
:::{attention}
52+
The sequential fallback is slower for large result sets, as it must fetch pages
53+
one by one until it reaches the requested index.
54+
:::

0 commit comments

Comments
 (0)