pyzotero 1.6.16__py3-none-any.whl → 1.6.17__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
|
@@ -43,11 +43,9 @@ from .filetransport import Client as File_Client
|
|
|
43
43
|
# Avoid hanging the application if there's no server response
|
|
44
44
|
timeout = 30
|
|
45
45
|
|
|
46
|
-
NOT_MODIFIED = 304
|
|
47
46
|
ONE_HOUR = 3600
|
|
48
47
|
DEFAULT_NUM_ITEMS = 50
|
|
49
48
|
DEFAULT_ITEM_LIMIT = 100
|
|
50
|
-
TOO_MANY_REQUESTS = 429
|
|
51
49
|
|
|
52
50
|
|
|
53
51
|
def build_url(base_url, path, args_dict=None):
|
|
@@ -451,8 +449,6 @@ class Zotero:
|
|
|
451
449
|
Returns a JSON document
|
|
452
450
|
"""
|
|
453
451
|
full_url = build_url(self.endpoint, request)
|
|
454
|
-
# The API doesn't return this any more, so we have to cheat
|
|
455
|
-
self.self_link = request
|
|
456
452
|
# ensure that we wait if there's an active backoff
|
|
457
453
|
self._check_backoff()
|
|
458
454
|
# don't set locale if the url already contains it
|
|
@@ -485,6 +481,8 @@ class Zotero:
|
|
|
485
481
|
timeout=timeout,
|
|
486
482
|
)
|
|
487
483
|
self.request.encoding = "utf-8"
|
|
484
|
+
# The API doesn't return this any more, so we have to cheat
|
|
485
|
+
self.self_link = self.request.url
|
|
488
486
|
except httpx.UnsupportedProtocol:
|
|
489
487
|
# File URI handler logic
|
|
490
488
|
fc = File_Client()
|
|
@@ -518,15 +516,12 @@ class Zotero:
|
|
|
518
516
|
fragment = f"{parsed[2]}?{parsed[4]}"
|
|
519
517
|
extracted[key] = fragment
|
|
520
518
|
# add a 'self' link
|
|
521
|
-
parsed =
|
|
522
|
-
# strip 'format' query parameter
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
)
|
|
526
|
-
# rebuild url fragment
|
|
527
|
-
# this is a death march
|
|
519
|
+
parsed = urlparse(str(self.self_link))
|
|
520
|
+
# strip 'format' query parameter and rebuild query string
|
|
521
|
+
query_params = [(k, v) for k, v in parse_qsl(parsed.query) if k != "format"]
|
|
522
|
+
# rebuild url fragment with just path and query (consistent with other links)
|
|
528
523
|
extracted["self"] = urlunparse(
|
|
529
|
-
|
|
524
|
+
("", "", parsed.path, "", urlencode(query_params), "")
|
|
530
525
|
)
|
|
531
526
|
except KeyError:
|
|
532
527
|
# No links present, because it's a single item
|
|
@@ -572,7 +567,7 @@ class Zotero:
|
|
|
572
567
|
)
|
|
573
568
|
if backoff:
|
|
574
569
|
self._set_backoff(backoff)
|
|
575
|
-
return req.status_code == NOT_MODIFIED
|
|
570
|
+
return req.status_code == httpx.codes.NOT_MODIFIED
|
|
576
571
|
# Still plenty of life left in't
|
|
577
572
|
return False
|
|
578
573
|
|
|
@@ -1647,7 +1642,7 @@ def error_handler(zot, req, exc=None):
|
|
|
1647
1642
|
|
|
1648
1643
|
if error_codes.get(req.status_code):
|
|
1649
1644
|
# check to see whether its 429
|
|
1650
|
-
if req.status_code == TOO_MANY_REQUESTS:
|
|
1645
|
+
if req.status_code == httpx.codes.TOO_MANY_REQUESTS:
|
|
1651
1646
|
# try to get backoff or delay duration
|
|
1652
1647
|
delay = req.headers.get("backoff") or req.headers.get("retry-after")
|
|
1653
1648
|
if not delay:
|
|
@@ -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=2Mjvr15sHRHR1MCeifniIXVtqqC4n-P_kDr8Z5Vdkhw,76427
|
|
4
|
+
pyzotero/zotero_errors.py,sha256=6obx9-pBO0z1bxt33vuzDluELvA5kSLCsfc-uGc3KNw,2660
|
|
5
|
+
pyzotero-1.6.17.dist-info/WHEEL,sha256=n2u5OFBbdZvCiUKAmfnY1Po2j3FB_NWfuUlt5WiAjrk,79
|
|
6
|
+
pyzotero-1.6.17.dist-info/METADATA,sha256=3h20funfN9wdaduCVZ8IBFFUB1K4IlH_Tlrj-OD7BmA,7292
|
|
7
|
+
pyzotero-1.6.17.dist-info/RECORD,,
|
pyzotero-1.6.16.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=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,,
|