pyzotero 1.6.15__py3-none-any.whl → 1.6.16__py3-none-any.whl
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.
pyzotero/zotero.py
CHANGED
|
@@ -46,6 +46,7 @@ timeout = 30
|
|
|
46
46
|
NOT_MODIFIED = 304
|
|
47
47
|
ONE_HOUR = 3600
|
|
48
48
|
DEFAULT_NUM_ITEMS = 50
|
|
49
|
+
DEFAULT_ITEM_LIMIT = 100
|
|
49
50
|
TOO_MANY_REQUESTS = 429
|
|
50
51
|
|
|
51
52
|
|
|
@@ -470,7 +471,7 @@ class Zotero:
|
|
|
470
471
|
params = {}
|
|
471
472
|
if not self.url_params:
|
|
472
473
|
self.url_params = {}
|
|
473
|
-
merged_params = {**
|
|
474
|
+
merged_params = {**self.url_params, **params}
|
|
474
475
|
# our incoming url might be from the "links" dict, in which case it will contain url parameters.
|
|
475
476
|
# Unfortunately, httpx doesn't like to merge query paramaters in the url string and passed params
|
|
476
477
|
# so we strip the url params, combining them with our existing url_params
|
|
@@ -580,7 +581,13 @@ class Zotero:
|
|
|
580
581
|
|
|
581
582
|
Also ensure that only valid format/content combinations are requested
|
|
582
583
|
"""
|
|
583
|
-
|
|
584
|
+
# Preserve constructor-level parameters (like locale) while allowing method-level overrides
|
|
585
|
+
if self.url_params is None:
|
|
586
|
+
self.url_params = {}
|
|
587
|
+
|
|
588
|
+
# Store existing params to preserve things like locale
|
|
589
|
+
preserved_params = self.url_params.copy()
|
|
590
|
+
|
|
584
591
|
# we want JSON by default
|
|
585
592
|
if not params.get("format"):
|
|
586
593
|
params["format"] = "json"
|
|
@@ -589,7 +596,7 @@ class Zotero:
|
|
|
589
596
|
params["format"] = "atom"
|
|
590
597
|
# TODO: rewrite format=atom, content=json request
|
|
591
598
|
if "limit" not in params or params.get("limit") == 0:
|
|
592
|
-
params["limit"] =
|
|
599
|
+
params["limit"] = DEFAULT_ITEM_LIMIT
|
|
593
600
|
# Need ability to request arbitrary number of results for version
|
|
594
601
|
# response
|
|
595
602
|
# -1 value is hack that works with current version
|
|
@@ -597,8 +604,10 @@ class Zotero:
|
|
|
597
604
|
del params["limit"]
|
|
598
605
|
# bib format can't have a limit
|
|
599
606
|
if params.get("format") == "bib":
|
|
600
|
-
|
|
601
|
-
|
|
607
|
+
params.pop("limit", None)
|
|
608
|
+
|
|
609
|
+
# Merge preserved params with new params (new params override existing ones)
|
|
610
|
+
self.url_params = {**preserved_params, **params}
|
|
602
611
|
|
|
603
612
|
def _build_query(self, query_string, no_params=False):
|
|
604
613
|
"""Set request parameters. Will always add the user ID if it hasn't
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pyzotero
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.16
|
|
4
4
|
Summary: Python wrapper for the Zotero API
|
|
5
5
|
Keywords: Zotero,DH
|
|
6
6
|
Author: Stephan Hügel
|
|
@@ -86,7 +86,7 @@ items = zot.top(limit=5)
|
|
|
86
86
|
# we've retrieved the latest five top-level items in our library
|
|
87
87
|
# we can print each item's item type and ID
|
|
88
88
|
for item in items:
|
|
89
|
-
print(
|
|
89
|
+
print(f"Item: {item['data']['itemType']} | Key: {item['data']['key']}")
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
# Documentation
|
|
@@ -95,8 +95,9 @@ Full documentation of available Pyzotero methods, code examples, and sample outp
|
|
|
95
95
|
|
|
96
96
|
# Installation
|
|
97
97
|
|
|
98
|
-
* Using [
|
|
99
|
-
* Using
|
|
98
|
+
* Using [uv][11]: `uv add pyzotero`
|
|
99
|
+
* Using [pip][10]: `pip install pyzotero`
|
|
100
|
+
* Using Anaconda:`conda install conda-forge::pyzotero`
|
|
100
101
|
* From a local clone, if you wish to install Pyzotero from a specific branch:
|
|
101
102
|
|
|
102
103
|
Example:
|
|
@@ -105,12 +106,13 @@ Example:
|
|
|
105
106
|
git clone git://github.com/urschrei/pyzotero.git
|
|
106
107
|
cd pyzotero
|
|
107
108
|
git checkout main
|
|
108
|
-
|
|
109
|
+
# specify --dev if you're planning on running tests
|
|
110
|
+
uv sync
|
|
109
111
|
```
|
|
110
112
|
|
|
111
113
|
## Testing
|
|
112
114
|
|
|
113
|
-
Run `pytest .` from the top-level directory.
|
|
115
|
+
Run `pytest .` from the top-level directory. This requires the `dev` dependency group to be installed: `uv sync --dev` / `pip install --group dev`
|
|
114
116
|
|
|
115
117
|
## Issues
|
|
116
118
|
|
|
@@ -118,14 +120,13 @@ The latest commits can be found on the [main branch][9], although new features a
|
|
|
118
120
|
|
|
119
121
|
## Pull Requests
|
|
120
122
|
|
|
121
|
-
Pull requests are welcomed. Please read the [contribution guidelines](CONTRIBUTING.md). In particular, please **base your PR on the `
|
|
123
|
+
Pull requests are welcomed. Please read the [contribution guidelines](CONTRIBUTING.md). In particular, please **base your PR on the `main` branch**.
|
|
122
124
|
|
|
123
125
|
## Versioning
|
|
124
126
|
|
|
125
127
|
As of v1.0.0, Pyzotero is versioned according to [Semver](http://semver.org); version increments are performed as follows:
|
|
126
128
|
|
|
127
129
|
|
|
128
|
-
|
|
129
130
|
1. MAJOR version will increment with incompatible API changes,
|
|
130
131
|
2. MINOR version will increment when functionality is added in a backwards-compatible manner, and
|
|
131
132
|
3. PATCH version will increment with backwards-compatible bug fixes.
|
|
@@ -149,5 +150,6 @@ Pyzotero is licensed under the [Blue Oak Model Licence 1.0.0][8]. See [LICENSE.m
|
|
|
149
150
|
[8]: https://opensource.org/license/blue-oak-model-license
|
|
150
151
|
[9]: https://github.com/urschrei/pyzotero/tree/main
|
|
151
152
|
[10]: http://www.pip-installer.org/en/latest/index.html
|
|
153
|
+
[11]: https://docs.astral.sh/uv
|
|
152
154
|
† This isn't strictly true: you only need an API key for personal libraries and non-public group libraries.
|
|
153
155
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pyzotero/__init__.py,sha256=5QI4Jou9L-YJAf_oN9TgRXVKgt_Unc39oADo2Ch8bLI,243
|
|
2
|
+
pyzotero/filetransport.py,sha256=umLik1LLmrpgaNmyjvtBoqqcaMgIq79PYsTvN5vG-gY,5530
|
|
3
|
+
pyzotero/zotero.py,sha256=wDKLPjNt-Eo1XUnLlgAscNKZkDI6J60_nVbplXsGk8A,76441
|
|
4
|
+
pyzotero/zotero_errors.py,sha256=6obx9-pBO0z1bxt33vuzDluELvA5kSLCsfc-uGc3KNw,2660
|
|
5
|
+
pyzotero-1.6.16.dist-info/WHEEL,sha256=pFCy50wRV2h7SjJ35YOsQUupaV45rMdgpNIvnXbG5bE,79
|
|
6
|
+
pyzotero-1.6.16.dist-info/METADATA,sha256=oFB4Mcb6MtVf9eyd2cOz0LCwpzrT-CU6uOIzwDvh3jU,7292
|
|
7
|
+
pyzotero-1.6.16.dist-info/RECORD,,
|
pyzotero-1.6.15.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
pyzotero/__init__.py,sha256=5QI4Jou9L-YJAf_oN9TgRXVKgt_Unc39oADo2Ch8bLI,243
|
|
2
|
-
pyzotero/filetransport.py,sha256=umLik1LLmrpgaNmyjvtBoqqcaMgIq79PYsTvN5vG-gY,5530
|
|
3
|
-
pyzotero/zotero.py,sha256=u3ELdw3aC7qXOWmzKpMILxL1ZNwFIMTnPzA5xEnqTfE,76032
|
|
4
|
-
pyzotero/zotero_errors.py,sha256=6obx9-pBO0z1bxt33vuzDluELvA5kSLCsfc-uGc3KNw,2660
|
|
5
|
-
pyzotero-1.6.15.dist-info/WHEEL,sha256=pFCy50wRV2h7SjJ35YOsQUupaV45rMdgpNIvnXbG5bE,79
|
|
6
|
-
pyzotero-1.6.15.dist-info/METADATA,sha256=wVagjGr1flontsTU3oEhZ1eCWhTBqvyvFLQN3nj0A48,7176
|
|
7
|
-
pyzotero-1.6.15.dist-info/RECORD,,
|
|
File without changes
|