Skip to content

Commit

Permalink
Fix upload / attachment methods
Browse files Browse the repository at this point in the history
  • Loading branch information
urschrei committed Jan 7, 2025
1 parent d8dfff2 commit 5e0d4a7
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/pyzotero/zotero.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def set_fulltext(self, itemkey, payload):
),
),
headers=headers,
content=json.dumps(payload),
data=json.dumps(payload),
)

def new_fulltext(self, since):
Expand Down Expand Up @@ -1047,7 +1047,7 @@ def _attachment_template(self, attachment_type):
linked_file
linked_url
"""
return self.item_template("attachment&linkMode=" + attachment_type)
return self.item_template("attachment", linkmode=attachment_type)

def _attachment(self, payload, parentid=None):
"""
Expand Down Expand Up @@ -1097,7 +1097,7 @@ def saved_search(self, name, conditions):
"/{t}/{u}/searches".format(t=self.library_type, u=self.library_id),
),
headers=headers,
content=json.dumps(payload),
data=json.dumps(payload),
)
self.request = req
try:
Expand Down Expand Up @@ -1299,7 +1299,7 @@ def create_items(self, payload, parentid=None, last_modified=None):
self.endpoint,
"/{t}/{u}/items".format(t=self.library_type, u=self.library_id),
),
content=to_send,
data=to_send,
headers=dict(headers),
)
self.request = req
Expand Down Expand Up @@ -1330,7 +1330,7 @@ def create_items(self, payload, parentid=None, last_modified=None):
t=self.library_type, u=self.library_id, v=value
),
),
content=payload,
data=payload,
headers=dict(uheaders),
)
self.request = presp
Expand Down Expand Up @@ -1374,7 +1374,7 @@ def create_collections(self, payload, last_modified=None):
"/{t}/{u}/collections".format(t=self.library_type, u=self.library_id),
),
headers=headers,
content=json.dumps(payload),
data=json.dumps(payload),
)
self.request = req
try:
Expand Down Expand Up @@ -1407,7 +1407,7 @@ def update_collection(self, payload, last_modified=None):
),
),
headers=headers,
content=json.dumps(payload),
data=json.dumps(payload),
)

def attachment_simple(self, files, parentid=None):
Expand Down Expand Up @@ -1465,7 +1465,7 @@ def update_item(self, payload, last_modified=None):
),
),
headers=headers,
content=json.dumps(to_send),
data=json.dumps(to_send),
)

def update_items(self, payload):
Expand All @@ -1483,7 +1483,7 @@ def update_items(self, payload):
self.endpoint,
"/{t}/{u}/items/".format(t=self.library_type, u=self.library_id),
),
content=json.dumps(chunk),
data=json.dumps(chunk),
)
self.request = req
try:
Expand Down Expand Up @@ -1512,7 +1512,7 @@ def update_collections(self, payload):
t=self.library_type, u=self.library_id
),
),
content=json.dumps(chunk),
data=json.dumps(chunk),
)
self.request = req
try:
Expand Down Expand Up @@ -1543,7 +1543,7 @@ def addto_collection(self, collection, payload):
t=self.library_type, u=self.library_id, i=ident
),
),
content=json.dumps({"collections": modified_collections}),
data=json.dumps({"collections": modified_collections}),
headers=headers,
)

Expand All @@ -1568,7 +1568,7 @@ def deletefrom_collection(self, collection, payload):
t=self.library_type, u=self.library_id, i=ident
),
),
content=json.dumps({"collections": modified_collections}),
data=json.dumps({"collections": modified_collections}),
headers=headers,
)

Expand Down Expand Up @@ -1932,14 +1932,14 @@ def _create_prelim(self):
child["parentItem"] = self.parentid
to_send = json.dumps(self.payload)
self.zinstance._check_backoff()
req = self.client.post(
req = self.zinstance.client.post(
url=build_url(
self.zinstance.endpoint,
liblevel.format(
t=self.zinstance.library_type, u=self.zinstance.library_id
),
),
content=to_send,
data=to_send,
headers=headers,
)
try:
Expand Down Expand Up @@ -1988,7 +1988,7 @@ def _get_auth(self, attachment, reg_key, md5=None):
i=reg_key,
),
),
content=data,
data=data,
headers=auth_headers,
)
try:
Expand Down Expand Up @@ -2052,7 +2052,7 @@ def _register_upload(self, authdata, reg_key):
i=reg_key,
),
),
content=reg_data,
data=reg_data,
headers=dict(reg_headers),
)
try:
Expand Down

0 comments on commit 5e0d4a7

Please sign in to comment.