Skip to content

Commit

Permalink
Merge pull request #31 from daizutabi/30-zotero
Browse files Browse the repository at this point in the history
30 zotero
  • Loading branch information
daizutabi committed Apr 12, 2024
2 parents b2b5f21 + bea9481 commit 330a84a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/panpdf/filters/zotero.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ def get_items_zotxt(keys: list[str]) -> list[dict] | None:
urls = [get_url_zotxt(key) for key in keys]

try:
asyncio.run(gather([urls[0]], get_csl))
asyncio.run(gather([urls[0]], get_csl_json))
except ClientError:
return None

return [ref for ref in asyncio.run(gather(urls, get_csl)) if ref]
return [ref for ref in asyncio.run(gather(urls, get_csl_json)) if ref]


def get_url_zotxt(key: str, host: str = "localhost", port: int = 23119) -> str:
return f"http://{host}:{port}/zotxt/items?betterbibtexkey={key}"


async def get_csl(response: ClientResponse) -> dict:
async def get_csl_json(response: ClientResponse) -> dict:
if response.status != 200: # noqa: PLR2004
return {}

Expand Down

0 comments on commit 330a84a

Please sign in to comment.