pyzotero 1.5.25__py3-none-any.whl → 1.5.27__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.
- _version.py +2 -2
- pyzotero/zotero.py +25 -8
- {pyzotero-1.5.25.dist-info → pyzotero-1.5.27.dist-info}/METADATA +6 -6
- pyzotero-1.5.27.dist-info/RECORD +10 -0
- {pyzotero-1.5.25.dist-info → pyzotero-1.5.27.dist-info}/WHEEL +1 -1
- pyzotero-1.5.25.dist-info/RECORD +0 -10
- {pyzotero-1.5.25.dist-info → pyzotero-1.5.27.dist-info}/AUTHORS +0 -0
- {pyzotero-1.5.25.dist-info → pyzotero-1.5.27.dist-info}/LICENSE.md +0 -0
- {pyzotero-1.5.25.dist-info → pyzotero-1.5.27.dist-info}/top_level.txt +0 -0
_version.py
CHANGED
pyzotero/zotero.py
CHANGED
|
@@ -25,7 +25,7 @@ import zipfile
|
|
|
25
25
|
from collections import OrderedDict
|
|
26
26
|
from functools import wraps
|
|
27
27
|
from pathlib import Path
|
|
28
|
-
from urllib.parse import parse_qsl, quote, urlencode, urlparse, urlunparse
|
|
28
|
+
from urllib.parse import parse_qs, parse_qsl, quote, urlencode, urlparse, urlunparse
|
|
29
29
|
|
|
30
30
|
import bibtexparser
|
|
31
31
|
import feedparser
|
|
@@ -43,10 +43,12 @@ timeout = 30
|
|
|
43
43
|
|
|
44
44
|
def build_url(base_url, path, args_dict=None):
|
|
45
45
|
"""Build a valid URL so we don't have to worry about string concatenation errors and
|
|
46
|
-
leading / trailing slashes etc
|
|
47
|
-
|
|
46
|
+
leading / trailing slashes etc.
|
|
47
|
+
Returns a list in the structure of urlparse.ParseResult"""
|
|
48
|
+
if base_url.endswith("/"):
|
|
49
|
+
base_url = base_url[:-1]
|
|
48
50
|
url_parts = list(urlparse(base_url))
|
|
49
|
-
url_parts[2]
|
|
51
|
+
url_parts[2] += path
|
|
50
52
|
if args_dict:
|
|
51
53
|
url_parts[4] = urlencode(args_dict)
|
|
52
54
|
return urlunparse(url_parts)
|
|
@@ -151,6 +153,11 @@ def retrieve(func):
|
|
|
151
153
|
"""
|
|
152
154
|
if kwargs:
|
|
153
155
|
self.add_parameters(**kwargs)
|
|
156
|
+
res = func(self, *args)
|
|
157
|
+
parsed = urlparse(res)
|
|
158
|
+
querydict = parse_qs(parsed.query)
|
|
159
|
+
if not querydict.get("locale"):
|
|
160
|
+
self.add_parameters(locale=self.locale)
|
|
154
161
|
retrieved = self._retrieve_data(func(self, *args))
|
|
155
162
|
# we now always have links in the header response
|
|
156
163
|
self.links = self._extract_links()
|
|
@@ -265,9 +272,13 @@ class Zotero:
|
|
|
265
272
|
api_key=None,
|
|
266
273
|
preserve_json_order=False,
|
|
267
274
|
locale="en-US",
|
|
275
|
+
local=False,
|
|
268
276
|
):
|
|
269
277
|
"""Store Zotero credentials"""
|
|
270
|
-
|
|
278
|
+
if not local:
|
|
279
|
+
self.endpoint = "https://api.zotero.org"
|
|
280
|
+
else:
|
|
281
|
+
self.endpoint = "http://localhost:23119/api"
|
|
271
282
|
if library_id and library_type:
|
|
272
283
|
self.library_id = library_id
|
|
273
284
|
# library_type determines whether query begins w. /users or /groups
|
|
@@ -363,7 +374,14 @@ class Zotero:
|
|
|
363
374
|
to self.templates as a new dict using the specified key
|
|
364
375
|
"""
|
|
365
376
|
# cache template and retrieval time for subsequent calls
|
|
366
|
-
|
|
377
|
+
try:
|
|
378
|
+
thetime = datetime.datetime.now(datetime.UTC).replace(
|
|
379
|
+
tzinfo=pytz.timezone("GMT")
|
|
380
|
+
)
|
|
381
|
+
except AttributeError:
|
|
382
|
+
thetime = thetime = datetime.datetime.utcnow().replace(
|
|
383
|
+
tzinfo=pytz.timezone("GMT")
|
|
384
|
+
)
|
|
367
385
|
self.templates[key] = {"tmplt": response.json(), "updated": thetime}
|
|
368
386
|
return copy.deepcopy(response.json())
|
|
369
387
|
|
|
@@ -585,14 +603,13 @@ class Zotero:
|
|
|
585
603
|
|
|
586
604
|
@backoff_check
|
|
587
605
|
def set_fulltext(self, itemkey, payload):
|
|
588
|
-
"""
|
|
606
|
+
"""
|
|
589
607
|
Set full-text data for an item
|
|
590
608
|
<itemkey> should correspond to an existing attachment item.
|
|
591
609
|
payload should be a dict containing three keys:
|
|
592
610
|
'content': the full-text content and either
|
|
593
611
|
For text documents, 'indexedChars' and 'totalChars' OR
|
|
594
612
|
For PDFs, 'indexedPages' and 'totalPages'.
|
|
595
|
-
|
|
596
613
|
"""
|
|
597
614
|
headers = self.default_headers()
|
|
598
615
|
headers.update({"Content-Type": "application/json"})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyzotero
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.27
|
|
4
4
|
Summary: Python wrapper for the Zotero API
|
|
5
5
|
Author-email: Stephan Hügel <urschrei@gmail.com>
|
|
6
6
|
License: # Blue Oak Model License
|
|
@@ -59,14 +59,14 @@ Requires-Python: >=3.8
|
|
|
59
59
|
Description-Content-Type: text/markdown
|
|
60
60
|
License-File: LICENSE.md
|
|
61
61
|
License-File: AUTHORS
|
|
62
|
-
Requires-Dist: feedparser
|
|
62
|
+
Requires-Dist: feedparser>=6.0.11
|
|
63
63
|
Requires-Dist: pytz
|
|
64
|
-
Requires-Dist: requests
|
|
64
|
+
Requires-Dist: requests>=2.21.0
|
|
65
65
|
Requires-Dist: bibtexparser
|
|
66
66
|
Provides-Extra: test
|
|
67
|
-
Requires-Dist: pytest
|
|
68
|
-
Requires-Dist: httpretty
|
|
69
|
-
Requires-Dist: python-dateutil
|
|
67
|
+
Requires-Dist: pytest>=7.4.2; extra == "test"
|
|
68
|
+
Requires-Dist: httpretty; extra == "test"
|
|
69
|
+
Requires-Dist: python-dateutil; extra == "test"
|
|
70
70
|
|
|
71
71
|
[](https://pypi.python.org/pypi/Pyzotero/) [](http://pyzotero.readthedocs.org/en/latest/?badge=latest) [](https://pypi.python.org/pypi/Pyzotero) [](https://anaconda.org/conda-forge/pyzotero) [](https://pepy.tech/project/pyzotero)
|
|
72
72
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
_version.py,sha256=18YFcLGl3tefAmuTyEetbx1KY48NF0tP49vnY60y_4A,413
|
|
2
|
+
pyzotero/__init__.py,sha256=5QI4Jou9L-YJAf_oN9TgRXVKgt_Unc39oADo2Ch8bLI,243
|
|
3
|
+
pyzotero/zotero.py,sha256=-0d3B7jmxoagqTIWBcBpTlp8cHL9BFajF9X3nDsjowg,75432
|
|
4
|
+
pyzotero/zotero_errors.py,sha256=UPhAmf2K05cnoeIl2wjufWQedepg7vBKb-ShU0TdlL4,2582
|
|
5
|
+
pyzotero-1.5.27.dist-info/AUTHORS,sha256=ZMicxg7lRScOYbxzMPznlzMbmrFIUIHwg-NvljEMbRQ,110
|
|
6
|
+
pyzotero-1.5.27.dist-info/LICENSE.md,sha256=bhy1CPMj1zWffD9YifFmSeBzPylsrhb1qP8OCEx5Etw,1550
|
|
7
|
+
pyzotero-1.5.27.dist-info/METADATA,sha256=xWQ7mz8QpLE5slWP66JOKM-tmEVLEZQ0mPLRE2yHYa4,7205
|
|
8
|
+
pyzotero-1.5.27.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
9
|
+
pyzotero-1.5.27.dist-info/top_level.txt,sha256=BOPNkPk5VtNDCy_li7Xftx6k0zG8STGxh-KgckcxLEw,18
|
|
10
|
+
pyzotero-1.5.27.dist-info/RECORD,,
|
pyzotero-1.5.25.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
_version.py,sha256=3Tmg9jbpC9bPlRJbsezp5XYxDyx0BRakSgsZ8sjAdqw,413
|
|
2
|
-
pyzotero/__init__.py,sha256=5QI4Jou9L-YJAf_oN9TgRXVKgt_Unc39oADo2Ch8bLI,243
|
|
3
|
-
pyzotero/zotero.py,sha256=sBJYuJuJqM-MLJOiY0y4Jxgz4o6_WA4tiOKxxWSpF7c,74835
|
|
4
|
-
pyzotero/zotero_errors.py,sha256=UPhAmf2K05cnoeIl2wjufWQedepg7vBKb-ShU0TdlL4,2582
|
|
5
|
-
pyzotero-1.5.25.dist-info/AUTHORS,sha256=ZMicxg7lRScOYbxzMPznlzMbmrFIUIHwg-NvljEMbRQ,110
|
|
6
|
-
pyzotero-1.5.25.dist-info/LICENSE.md,sha256=bhy1CPMj1zWffD9YifFmSeBzPylsrhb1qP8OCEx5Etw,1550
|
|
7
|
-
pyzotero-1.5.25.dist-info/METADATA,sha256=RPHcbi6bbybP4avSGLTR1NXAIA5QJwRybUBIJPW5fqs,7211
|
|
8
|
-
pyzotero-1.5.25.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
|
9
|
-
pyzotero-1.5.25.dist-info/top_level.txt,sha256=BOPNkPk5VtNDCy_li7Xftx6k0zG8STGxh-KgckcxLEw,18
|
|
10
|
-
pyzotero-1.5.25.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|