pyzotero 1.5.25__py3-none-any.whl → 1.5.28__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.
_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.5.25'
16
- __version_tuple__ = version_tuple = (1, 5, 25)
15
+ __version__ = version = '1.5.28'
16
+ __version_tuple__ = version_tuple = (1, 5, 28)
pyzotero/zotero.py CHANGED
@@ -25,7 +25,7 @@ import zipfile
25
25
  from collections import OrderedDict
26
26
  from functools import wraps
27
27
  from pathlib import Path
28
- from urllib.parse import parse_qsl, quote, urlencode, urlparse, urlunparse
28
+ from urllib.parse import parse_qs, parse_qsl, quote, urlencode, urlparse, urlunparse
29
29
 
30
30
  import bibtexparser
31
31
  import feedparser
@@ -43,10 +43,12 @@ timeout = 30
43
43
 
44
44
  def build_url(base_url, path, args_dict=None):
45
45
  """Build a valid URL so we don't have to worry about string concatenation errors and
46
- leading / trailing slashes etc"""
47
- # Returns a list in the structure of urlparse.ParseResult"""
46
+ leading / trailing slashes etc.
47
+ Returns a list in the structure of urlparse.ParseResult"""
48
+ if base_url.endswith("/"):
49
+ base_url = base_url[:-1]
48
50
  url_parts = list(urlparse(base_url))
49
- url_parts[2] = path
51
+ url_parts[2] += path
50
52
  if args_dict:
51
53
  url_parts[4] = urlencode(args_dict)
52
54
  return urlunparse(url_parts)
@@ -265,9 +267,13 @@ class Zotero:
265
267
  api_key=None,
266
268
  preserve_json_order=False,
267
269
  locale="en-US",
270
+ local=False,
268
271
  ):
269
272
  """Store Zotero credentials"""
270
- self.endpoint = "https://api.zotero.org"
273
+ if not local:
274
+ self.endpoint = "https://api.zotero.org"
275
+ else:
276
+ self.endpoint = "http://localhost:23119/api"
271
277
  if library_id and library_type:
272
278
  self.library_id = library_id
273
279
  # library_type determines whether query begins w. /users or /groups
@@ -363,7 +369,14 @@ class Zotero:
363
369
  to self.templates as a new dict using the specified key
364
370
  """
365
371
  # cache template and retrieval time for subsequent calls
366
- thetime = datetime.datetime.utcnow().replace(tzinfo=pytz.timezone("GMT"))
372
+ try:
373
+ thetime = datetime.datetime.now(datetime.UTC).replace(
374
+ tzinfo=pytz.timezone("GMT")
375
+ )
376
+ except AttributeError:
377
+ thetime = thetime = datetime.datetime.utcnow().replace(
378
+ tzinfo=pytz.timezone("GMT")
379
+ )
367
380
  self.templates[key] = {"tmplt": response.json(), "updated": thetime}
368
381
  return copy.deepcopy(response.json())
369
382
 
@@ -585,14 +598,13 @@ class Zotero:
585
598
 
586
599
  @backoff_check
587
600
  def set_fulltext(self, itemkey, payload):
588
- """ "
601
+ """
589
602
  Set full-text data for an item
590
603
  <itemkey> should correspond to an existing attachment item.
591
604
  payload should be a dict containing three keys:
592
605
  'content': the full-text content and either
593
606
  For text documents, 'indexedChars' and 'totalChars' OR
594
607
  For PDFs, 'indexedPages' and 'totalPages'.
595
-
596
608
  """
597
609
  headers = self.default_headers()
598
610
  headers.update({"Content-Type": "application/json"})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyzotero
3
- Version: 1.5.25
3
+ Version: 1.5.28
4
4
  Summary: Python wrapper for the Zotero API
5
5
  Author-email: Stephan Hügel <urschrei@gmail.com>
6
6
  License: # Blue Oak Model License
@@ -59,14 +59,14 @@ Requires-Python: >=3.8
59
59
  Description-Content-Type: text/markdown
60
60
  License-File: LICENSE.md
61
61
  License-File: AUTHORS
62
- Requires-Dist: feedparser >=6.0.11
62
+ Requires-Dist: feedparser>=6.0.11
63
63
  Requires-Dist: pytz
64
- Requires-Dist: requests >=2.21.0
64
+ Requires-Dist: requests>=2.21.0
65
65
  Requires-Dist: bibtexparser
66
66
  Provides-Extra: test
67
- Requires-Dist: pytest >=7.4.2 ; extra == 'test'
68
- Requires-Dist: httpretty ; extra == 'test'
69
- Requires-Dist: python-dateutil ; extra == 'test'
67
+ Requires-Dist: pytest>=7.4.2; extra == "test"
68
+ Requires-Dist: httpretty; extra == "test"
69
+ Requires-Dist: python-dateutil; extra == "test"
70
70
 
71
71
  [![Supported Python versions](https://img.shields.io/pypi/pyversions/Pyzotero.svg?style=flat)](https://pypi.python.org/pypi/Pyzotero/) [![Docs](https://readthedocs.org/projects/pyzotero/badge/?version=latest)](http://pyzotero.readthedocs.org/en/latest/?badge=latest) [![PyPI Version](https://img.shields.io/pypi/v/Pyzotero.svg)](https://pypi.python.org/pypi/Pyzotero) [![Anaconda-Server Badge](https://anaconda.org/conda-forge/pyzotero/badges/version.svg)](https://anaconda.org/conda-forge/pyzotero) [![Downloads](https://pepy.tech/badge/pyzotero)](https://pepy.tech/project/pyzotero)
72
72
 
@@ -0,0 +1,10 @@
1
+ _version.py,sha256=0H-JgqeGiV_8mNGxbNI0y353Aqa7XZVSkG8ibJE_edo,413
2
+ pyzotero/__init__.py,sha256=5QI4Jou9L-YJAf_oN9TgRXVKgt_Unc39oADo2Ch8bLI,243
3
+ pyzotero/zotero.py,sha256=SIBYg38twZkZowO2MbZQXrF15IUJfnH0fBVF86xDr14,75234
4
+ pyzotero/zotero_errors.py,sha256=UPhAmf2K05cnoeIl2wjufWQedepg7vBKb-ShU0TdlL4,2582
5
+ pyzotero-1.5.28.dist-info/AUTHORS,sha256=ZMicxg7lRScOYbxzMPznlzMbmrFIUIHwg-NvljEMbRQ,110
6
+ pyzotero-1.5.28.dist-info/LICENSE.md,sha256=bhy1CPMj1zWffD9YifFmSeBzPylsrhb1qP8OCEx5Etw,1550
7
+ pyzotero-1.5.28.dist-info/METADATA,sha256=E692i0SYizzrEYVYMzjUUfKvGmRs9WoZTxxOxpah1ZI,7205
8
+ pyzotero-1.5.28.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
9
+ pyzotero-1.5.28.dist-info/top_level.txt,sha256=BOPNkPk5VtNDCy_li7Xftx6k0zG8STGxh-KgckcxLEw,18
10
+ pyzotero-1.5.28.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- _version.py,sha256=3Tmg9jbpC9bPlRJbsezp5XYxDyx0BRakSgsZ8sjAdqw,413
2
- pyzotero/__init__.py,sha256=5QI4Jou9L-YJAf_oN9TgRXVKgt_Unc39oADo2Ch8bLI,243
3
- pyzotero/zotero.py,sha256=sBJYuJuJqM-MLJOiY0y4Jxgz4o6_WA4tiOKxxWSpF7c,74835
4
- pyzotero/zotero_errors.py,sha256=UPhAmf2K05cnoeIl2wjufWQedepg7vBKb-ShU0TdlL4,2582
5
- pyzotero-1.5.25.dist-info/AUTHORS,sha256=ZMicxg7lRScOYbxzMPznlzMbmrFIUIHwg-NvljEMbRQ,110
6
- pyzotero-1.5.25.dist-info/LICENSE.md,sha256=bhy1CPMj1zWffD9YifFmSeBzPylsrhb1qP8OCEx5Etw,1550
7
- pyzotero-1.5.25.dist-info/METADATA,sha256=RPHcbi6bbybP4avSGLTR1NXAIA5QJwRybUBIJPW5fqs,7211
8
- pyzotero-1.5.25.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
9
- pyzotero-1.5.25.dist-info/top_level.txt,sha256=BOPNkPk5VtNDCy_li7Xftx6k0zG8STGxh-KgckcxLEw,18
10
- pyzotero-1.5.25.dist-info/RECORD,,