pyzotero 1.5.24__py3-none-any.whl → 1.5.27__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.24'
16
- __version_tuple__ = version_tuple = (1, 5, 24)
15
+ __version__ = version = '1.5.27'
16
+ __version_tuple__ = version_tuple = (1, 5, 27)
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)
@@ -151,6 +153,11 @@ def retrieve(func):
151
153
  """
152
154
  if kwargs:
153
155
  self.add_parameters(**kwargs)
156
+ res = func(self, *args)
157
+ parsed = urlparse(res)
158
+ querydict = parse_qs(parsed.query)
159
+ if not querydict.get("locale"):
160
+ self.add_parameters(locale=self.locale)
154
161
  retrieved = self._retrieve_data(func(self, *args))
155
162
  # we now always have links in the header response
156
163
  self.links = self._extract_links()
@@ -265,9 +272,13 @@ class Zotero:
265
272
  api_key=None,
266
273
  preserve_json_order=False,
267
274
  locale="en-US",
275
+ local=False,
268
276
  ):
269
277
  """Store Zotero credentials"""
270
- self.endpoint = "https://api.zotero.org"
278
+ if not local:
279
+ self.endpoint = "https://api.zotero.org"
280
+ else:
281
+ self.endpoint = "http://localhost:23119/api"
271
282
  if library_id and library_type:
272
283
  self.library_id = library_id
273
284
  # library_type determines whether query begins w. /users or /groups
@@ -363,7 +374,14 @@ class Zotero:
363
374
  to self.templates as a new dict using the specified key
364
375
  """
365
376
  # cache template and retrieval time for subsequent calls
366
- thetime = datetime.datetime.utcnow().replace(tzinfo=pytz.timezone("GMT"))
377
+ try:
378
+ thetime = datetime.datetime.now(datetime.UTC).replace(
379
+ tzinfo=pytz.timezone("GMT")
380
+ )
381
+ except AttributeError:
382
+ thetime = thetime = datetime.datetime.utcnow().replace(
383
+ tzinfo=pytz.timezone("GMT")
384
+ )
367
385
  self.templates[key] = {"tmplt": response.json(), "updated": thetime}
368
386
  return copy.deepcopy(response.json())
369
387
 
@@ -585,14 +603,13 @@ class Zotero:
585
603
 
586
604
  @backoff_check
587
605
  def set_fulltext(self, itemkey, payload):
588
- """ "
606
+ """
589
607
  Set full-text data for an item
590
608
  <itemkey> should correspond to an existing attachment item.
591
609
  payload should be a dict containing three keys:
592
610
  'content': the full-text content and either
593
611
  For text documents, 'indexedChars' and 'totalChars' OR
594
612
  For PDFs, 'indexedPages' and 'totalPages'.
595
-
596
613
  """
597
614
  headers = self.default_headers()
598
615
  headers.update({"Content-Type": "application/json"})
@@ -1,8 +1,44 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyzotero
3
- Version: 1.5.24
3
+ Version: 1.5.27
4
4
  Summary: Python wrapper for the Zotero API
5
5
  Author-email: Stephan Hügel <urschrei@gmail.com>
6
+ License: # Blue Oak Model License
7
+
8
+ Version 1.0.0
9
+
10
+ ## Purpose
11
+
12
+ This license gives everyone as much permission to work with this software as possible, while protecting contributors from liability.
13
+
14
+ ## Acceptance
15
+
16
+ In order to receive this license, you must agree to its rules. The rules of this license are both obligations under that agreement and conditions to your license. You must not do anything with this software that triggers a rule that you cannot or will not follow.
17
+
18
+ ## Copyright
19
+
20
+ Each contributor licenses you to do everything with this software that would otherwise infringe that contributor's copyright in it.
21
+
22
+ ## Notices
23
+
24
+ You must ensure that everyone who gets a copy of any part of this software from you, with or without changes, also gets the text of this license or a link to <https://blueoakcouncil.org/license/1.0.0>.
25
+
26
+ ## Excuse
27
+
28
+ If anyone notifies you in writing that you have not complied with [Notices](#notices), you can keep your license by taking all practical steps to comply within 30 days after the notice. If you do not do so, your license ends immediately.
29
+
30
+ ## Patent
31
+
32
+ Each contributor licenses you to do everything with this software that would otherwise infringe any patent claims they can license or become able to license.
33
+
34
+ ## Reliability
35
+
36
+ No contributor can revoke this license.
37
+
38
+ ## No Liability
39
+
40
+ ***As far as the law allows, this software comes as is, without any warranty or condition, and no contributor will be liable to anyone for any damages related to this software or this license, under any kind of legal claim.***
41
+
6
42
  Project-URL: Repository, https://github.com/urschrei/pyzotero
7
43
  Project-URL: Tracker, https://github.com/urschrei/pyzotero/issues
8
44
  Keywords: Zotero,DH
@@ -23,14 +59,14 @@ Requires-Python: >=3.8
23
59
  Description-Content-Type: text/markdown
24
60
  License-File: LICENSE.md
25
61
  License-File: AUTHORS
26
- Requires-Dist: feedparser >=6.0.11
62
+ Requires-Dist: feedparser>=6.0.11
27
63
  Requires-Dist: pytz
28
- Requires-Dist: requests >=2.21.0
64
+ Requires-Dist: requests>=2.21.0
29
65
  Requires-Dist: bibtexparser
30
66
  Provides-Extra: test
31
- Requires-Dist: pytest >=7.4.2 ; extra == 'test'
32
- Requires-Dist: httpretty ; extra == 'test'
33
- 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"
34
70
 
35
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)
36
72
 
@@ -0,0 +1,10 @@
1
+ _version.py,sha256=18YFcLGl3tefAmuTyEetbx1KY48NF0tP49vnY60y_4A,413
2
+ pyzotero/__init__.py,sha256=5QI4Jou9L-YJAf_oN9TgRXVKgt_Unc39oADo2Ch8bLI,243
3
+ pyzotero/zotero.py,sha256=-0d3B7jmxoagqTIWBcBpTlp8cHL9BFajF9X3nDsjowg,75432
4
+ pyzotero/zotero_errors.py,sha256=UPhAmf2K05cnoeIl2wjufWQedepg7vBKb-ShU0TdlL4,2582
5
+ pyzotero-1.5.27.dist-info/AUTHORS,sha256=ZMicxg7lRScOYbxzMPznlzMbmrFIUIHwg-NvljEMbRQ,110
6
+ pyzotero-1.5.27.dist-info/LICENSE.md,sha256=bhy1CPMj1zWffD9YifFmSeBzPylsrhb1qP8OCEx5Etw,1550
7
+ pyzotero-1.5.27.dist-info/METADATA,sha256=xWQ7mz8QpLE5slWP66JOKM-tmEVLEZQ0mPLRE2yHYa4,7205
8
+ pyzotero-1.5.27.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
9
+ pyzotero-1.5.27.dist-info/top_level.txt,sha256=BOPNkPk5VtNDCy_li7Xftx6k0zG8STGxh-KgckcxLEw,18
10
+ pyzotero-1.5.27.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=4eQxnsqXZiTS32CvVuiTZuY0kmMrad1KJsoHrN1tRmY,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.24.dist-info/AUTHORS,sha256=ZMicxg7lRScOYbxzMPznlzMbmrFIUIHwg-NvljEMbRQ,110
6
- pyzotero-1.5.24.dist-info/LICENSE.md,sha256=bhy1CPMj1zWffD9YifFmSeBzPylsrhb1qP8OCEx5Etw,1550
7
- pyzotero-1.5.24.dist-info/METADATA,sha256=X8i3ZKcu9bfGWWvgyO46NoKLtwYgHyrVIM6VLPPopkI,5371
8
- pyzotero-1.5.24.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
9
- pyzotero-1.5.24.dist-info/top_level.txt,sha256=BOPNkPk5VtNDCy_li7Xftx6k0zG8STGxh-KgckcxLEw,18
10
- pyzotero-1.5.24.dist-info/RECORD,,