Skip to content

Commit

Permalink
More format string replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
urschrei committed Dec 28, 2024
1 parent a47f407 commit ad2baf8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pyzotero/zotero.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def _extract_links(self):
try:
for key, value in self.request.links.items():
parsed = urlparse(value["url"])
fragment = "{path}?{query}".format(path=parsed[2], query=parsed[4])
fragment = f"{parsed[2]}?{parsed[4]}"
extracted[key] = fragment
# add a 'self' link
parsed = list(urlparse(self.self_link))
Expand Down Expand Up @@ -985,15 +985,15 @@ def item_template(self, itemtype, linkmode=None):
"""Get a template for a new item"""
# if we have a template and it hasn't been updated since we stored it
template_name = "{}_{}_{}".format(*["item_template", itemtype, linkmode or ""])
query_string = "/items/new?itemType={i}".format(i=itemtype)
query_string = f"/items/new?itemType={itemtype}"
if self.templates.get(template_name) and not self._updated(
query_string, self.templates[template_name], template_name
):
return copy.deepcopy(self.templates[template_name]["tmplt"])

# Set linkMode parameter for API request if itemtype is attachment
if itemtype == "attachment":
query_string = "{}&linkMode={}".format(query_string, linkmode)
query_string = f"{query_string}&linkMode={linkmode}"

# otherwise perform a normal request and cache the response
retrieved = self._retrieve_data(query_string)
Expand Down

0 comments on commit ad2baf8

Please sign in to comment.