pyzotero 1.7.4__py3-none-any.whl → 1.7.6__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 +10 -4
- {pyzotero-1.7.4.dist-info → pyzotero-1.7.6.dist-info}/METADATA +1 -1
- {pyzotero-1.7.4.dist-info → pyzotero-1.7.6.dist-info}/RECORD +5 -5
- {pyzotero-1.7.4.dist-info → pyzotero-1.7.6.dist-info}/WHEEL +0 -0
- {pyzotero-1.7.4.dist-info → pyzotero-1.7.6.dist-info}/entry_points.txt +0 -0
pyzotero/zotero.py
CHANGED
|
@@ -796,12 +796,12 @@ class Zotero:
|
|
|
796
796
|
"""Dump a file attachment to disk, with optional filename and path"""
|
|
797
797
|
if not filename:
|
|
798
798
|
filename = self.item(itemkey)["data"]["filename"]
|
|
799
|
-
pth = Path(path) / filename if path else filename
|
|
799
|
+
pth = Path(path) / filename if path else Path(filename)
|
|
800
800
|
file = self.file(itemkey)
|
|
801
801
|
if self.snapshot:
|
|
802
802
|
self.snapshot = False
|
|
803
|
-
pth
|
|
804
|
-
with
|
|
803
|
+
pth = pth.parent / (pth.name + ".zip")
|
|
804
|
+
with pth.open("wb") as f:
|
|
805
805
|
f.write(file)
|
|
806
806
|
|
|
807
807
|
@retrieve
|
|
@@ -1492,7 +1492,7 @@ class Zotero:
|
|
|
1492
1492
|
|
|
1493
1493
|
@backoff_check
|
|
1494
1494
|
def addto_collection(self, collection, payload):
|
|
1495
|
-
"""Add
|
|
1495
|
+
"""Add item to a collection
|
|
1496
1496
|
Accepts two arguments:
|
|
1497
1497
|
The collection ID, and an item dict
|
|
1498
1498
|
"""
|
|
@@ -1879,6 +1879,12 @@ class Zupload:
|
|
|
1879
1879
|
msg,
|
|
1880
1880
|
)
|
|
1881
1881
|
return None # Don't do anything if payload comes with keys
|
|
1882
|
+
# Set contentType for each attachment if not already provided
|
|
1883
|
+
for item in self.payload:
|
|
1884
|
+
if not item.get("contentType"):
|
|
1885
|
+
filepath = str(self.basedir.joinpath(item["filename"]))
|
|
1886
|
+
detected_type = mimetypes.guess_type(filepath)[0]
|
|
1887
|
+
item["contentType"] = detected_type or "application/octet-stream"
|
|
1882
1888
|
liblevel = "/{t}/{u}/items"
|
|
1883
1889
|
# Create one or more new attachments
|
|
1884
1890
|
headers = {"Zotero-Write-Token": token(), "Content-Type": "application/json"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
pyzotero/__init__.py,sha256=5QI4Jou9L-YJAf_oN9TgRXVKgt_Unc39oADo2Ch8bLI,243
|
|
2
2
|
pyzotero/cli.py,sha256=dsq4QFqs4vig7CpORQYWD96smM8Z00BbaVh8AsLjhmg,16243
|
|
3
3
|
pyzotero/filetransport.py,sha256=umLik1LLmrpgaNmyjvtBoqqcaMgIq79PYsTvN5vG-gY,5530
|
|
4
|
-
pyzotero/zotero.py,sha256=
|
|
4
|
+
pyzotero/zotero.py,sha256=nUgch-YvNHiQb8qR7Pz9ntgNJv76XDcvINvCs56vvFc,76877
|
|
5
5
|
pyzotero/zotero_errors.py,sha256=6obx9-pBO0z1bxt33vuzDluELvA5kSLCsfc-uGc3KNw,2660
|
|
6
|
-
pyzotero-1.7.
|
|
7
|
-
pyzotero-1.7.
|
|
8
|
-
pyzotero-1.7.
|
|
9
|
-
pyzotero-1.7.
|
|
6
|
+
pyzotero-1.7.6.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
7
|
+
pyzotero-1.7.6.dist-info/entry_points.txt,sha256=MzN7IMRj_oPNmDCsseYFPum3bHWE1gFxywhlbFbcn2k,48
|
|
8
|
+
pyzotero-1.7.6.dist-info/METADATA,sha256=oPlV0BYolZ8TXTWJjtnChKeA4Rxcf1rx2crVENVlRhY,9962
|
|
9
|
+
pyzotero-1.7.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|