pyzotero 1.5.9__tar.gz → 1.5.15__tar.gz

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.
Files changed (61) hide show
  1. pyzotero-1.5.15/.github/dependabot.yml +16 -0
  2. {pyzotero-1.5.9 → pyzotero-1.5.15}/.github/workflows/tests.yml +14 -8
  3. {pyzotero-1.5.9 → pyzotero-1.5.15}/.gitignore +1 -0
  4. pyzotero-1.5.15/.readthedocs.yaml +21 -0
  5. {pyzotero-1.5.9 → pyzotero-1.5.15}/PKG-INFO +38 -12
  6. {pyzotero-1.5.9 → pyzotero-1.5.15}/doc/conf.py +8 -7
  7. {pyzotero-1.5.9 → pyzotero-1.5.15}/doc/index.rst +5 -0
  8. pyzotero-1.5.15/pyproject.toml +60 -0
  9. pyzotero-1.5.15/setup.cfg +4 -0
  10. pyzotero-1.5.15/src/_version.py +8 -0
  11. pyzotero-1.5.15/src/pyzotero/__init__.py +7 -0
  12. {pyzotero-1.5.9 → pyzotero-1.5.15/src}/pyzotero/zotero.py +44 -38
  13. {pyzotero-1.5.9 → pyzotero-1.5.15/src}/pyzotero.egg-info/PKG-INFO +38 -12
  14. {pyzotero-1.5.9 → pyzotero-1.5.15/src}/pyzotero.egg-info/SOURCES.txt +11 -13
  15. {pyzotero-1.5.9 → pyzotero-1.5.15/src}/pyzotero.egg-info/requires.txt +3 -4
  16. {pyzotero-1.5.9 → pyzotero-1.5.15/src}/pyzotero.egg-info/top_level.txt +1 -0
  17. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/test_zotero.py +21 -7
  18. pyzotero-1.5.9/.readthedocs.yml +0 -8
  19. pyzotero-1.5.9/manifest.in +0 -3
  20. pyzotero-1.5.9/pyproject.toml +0 -10
  21. pyzotero-1.5.9/pyzotero/version.py +0 -1
  22. pyzotero-1.5.9/pyzotero.egg-info/not-zip-safe +0 -1
  23. pyzotero-1.5.9/setup.cfg +0 -63
  24. pyzotero-1.5.9/tests/api_responses/__init__.py +0 -0
  25. {pyzotero-1.5.9 → pyzotero-1.5.15}/.coveragerc +0 -0
  26. {pyzotero-1.5.9 → pyzotero-1.5.15}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  27. {pyzotero-1.5.9 → pyzotero-1.5.15}/.github/ISSUE_TEMPLATE/usage_question.md +0 -0
  28. {pyzotero-1.5.9 → pyzotero-1.5.15}/.github/pull_request_template.md +0 -0
  29. {pyzotero-1.5.9 → pyzotero-1.5.15}/AUTHORS +0 -0
  30. {pyzotero-1.5.9 → pyzotero-1.5.15}/CITATION.cff +0 -0
  31. {pyzotero-1.5.9 → pyzotero-1.5.15}/CONTRIBUTING.md +0 -0
  32. {pyzotero-1.5.9 → pyzotero-1.5.15}/CONTRIBUTORS.md +0 -0
  33. {pyzotero-1.5.9 → pyzotero-1.5.15}/README.md +0 -0
  34. {pyzotero-1.5.9 → pyzotero-1.5.15}/__init__.py +0 -0
  35. {pyzotero-1.5.9 → pyzotero-1.5.15}/doc/Makefile +0 -0
  36. {pyzotero-1.5.9 → pyzotero-1.5.15}/doc/_templates/layout.html +0 -0
  37. {pyzotero-1.5.9 → pyzotero-1.5.15}/doc/cat.png +0 -0
  38. {pyzotero-1.5.9 → pyzotero-1.5.15}/dump_contributors.py +0 -0
  39. {pyzotero-1.5.9 → pyzotero-1.5.15}/license.txt +0 -0
  40. {pyzotero-1.5.9 → pyzotero-1.5.15}/pre-deploy.py +0 -0
  41. {pyzotero-1.5.9 → pyzotero-1.5.15}/setup.py +0 -0
  42. {pyzotero-1.5.9 → pyzotero-1.5.15/src}/pyzotero/zotero_errors.py +0 -0
  43. {pyzotero-1.5.9 → pyzotero-1.5.15/src}/pyzotero.egg-info/dependency_links.txt +0 -0
  44. {pyzotero-1.5.9/pyzotero → pyzotero-1.5.15/tests/api_responses}/__init__.py +0 -0
  45. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/attachments_doc.json +0 -0
  46. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/citation_doc.xml +0 -0
  47. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/collection_doc.json +0 -0
  48. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/collection_tags.json +0 -0
  49. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/collection_versions.json +0 -0
  50. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/collections_doc.json +0 -0
  51. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/creation_doc.json +0 -0
  52. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/groups_doc.json +0 -0
  53. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/item_doc.json +0 -0
  54. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/item_fields.json +0 -0
  55. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/item_file.pdf +0 -0
  56. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/item_template.json +0 -0
  57. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/item_types.json +0 -0
  58. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/item_versions.json +0 -0
  59. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/items_doc.json +0 -0
  60. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/keys_doc.txt +0 -0
  61. {pyzotero-1.5.9 → pyzotero-1.5.15}/tests/api_responses/tags_doc.json +0 -0
@@ -0,0 +1,16 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ ignore:
8
+ # Optional: Official actions have moving tags like v1;
9
+ # if you use those, you don't need updates.
10
+ - dependency-name: "actions/*"
11
+
12
+ - package-ecosystem: pip
13
+ directory: "/"
14
+ schedule:
15
+ interval: daily
16
+ open-pull-requests-limit: 10
@@ -8,10 +8,10 @@ jobs:
8
8
  runs-on: ubuntu-latest
9
9
  strategy:
10
10
  matrix:
11
- python-version: [3.7, 3.8, 3.9, 3.10.9, 3.11]
11
+ python-version: [3.8, 3.9, 3.10.9, 3.11]
12
12
 
13
13
  steps:
14
- - uses: actions/checkout@v3
14
+ - uses: actions/checkout@v4
15
15
  - name: Set up Python ${{ matrix.python-version }}
16
16
  uses: actions/setup-python@v3
17
17
  with:
@@ -20,8 +20,7 @@ jobs:
20
20
  run: |
21
21
  python -m pip install --upgrade pip
22
22
  pip install wheel
23
- pip install .
24
- pip install python-dateutil httpretty pytest
23
+ pip install .[test] --use-pep517
25
24
  - name: Test with pytest
26
25
  run: |
27
26
  pytest
@@ -30,7 +29,7 @@ jobs:
30
29
  name: Make SDist
31
30
  runs-on: ubuntu-latest
32
31
  steps:
33
- - uses: actions/checkout@v3
32
+ - uses: actions/checkout@v4
34
33
  with:
35
34
  fetch-depth: 0 # Optional, use if you use setuptools_scm
36
35
  submodules: true # Optional, use if you have submodules
@@ -54,11 +53,18 @@ jobs:
54
53
  contents: write
55
54
 
56
55
  steps:
57
- - uses: actions/checkout@v3
56
+ - uses: actions/checkout@v4
57
+ with:
58
+ fetch-depth: 0 # Optional, use if you use setuptools_scm
59
+ submodules: false # Optional, use if you have submodules
58
60
 
59
61
  - name: Build wheels
60
62
  run: |
61
- pip wheel --no-deps . -w dist
63
+ pip install pip -U
64
+ pip install setuptools -U
65
+ pwd
66
+ ls -la
67
+ pip wheel . -w dist --no-deps --use-pep517
62
68
 
63
69
  - uses: actions/upload-artifact@v3
64
70
  with:
@@ -78,6 +84,6 @@ jobs:
78
84
  token: ${{ secrets.GITHUB_TOKEN }}
79
85
 
80
86
  - name: PyPI Publish
81
- uses: pypa/gh-action-pypi-publish@v1.8.5
87
+ uses: pypa/gh-action-pypi-publish@v1.8.10
82
88
  with:
83
89
  packages-dir: ${{ steps.download.outputs.download-path }}/**/
@@ -3,3 +3,4 @@ Pyzotero.egg-info
3
3
  Pyzotero.egg-info
4
4
  __pycache__
5
5
  .eggs
6
+ src/_version.py
@@ -0,0 +1,21 @@
1
+ # .readthedocs.yaml
2
+ # Read the Docs configuration file
3
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4
+
5
+ # Required
6
+ version: 2
7
+
8
+ # Set the version of Python and other tools you might need
9
+ build:
10
+ os: ubuntu-22.04
11
+ tools:
12
+ python: "3.11"
13
+
14
+ python:
15
+ install:
16
+ - method: pip
17
+ path: .
18
+
19
+ # Build documentation in the docs/ directory with Sphinx
20
+ sphinx:
21
+ configuration: doc/conf.py
@@ -1,30 +1,56 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyzotero
3
- Version: 1.5.9
3
+ Version: 1.5.15
4
4
  Summary: Python wrapper for the Zotero API
5
- Home-page: https://github.com/urschrei/pyzotero
6
- Author: Stephan Hügel
7
- Author-email: urschrei@gmail.com
8
- License: MIT
9
- Project-URL: Source, https://github.com/urschrei/pyzotero
5
+ Author-email: Stephan Hügel <urschrei@gmail.com>
6
+ License: The MIT License (MIT)
7
+
8
+ Copyright (c) 2015 Stephan Hügel
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ THE SOFTWARE.
27
+
28
+ Project-URL: Repository, https://github.com/urschrei/pyzotero
10
29
  Project-URL: Tracker, https://github.com/urschrei/pyzotero/issues
11
- Keywords: zotero
30
+ Keywords: Zotero,DH
12
31
  Classifier: Programming Language :: Python
13
- Classifier: Programming Language :: Python :: 3.7
14
32
  Classifier: Programming Language :: Python :: 3.8
15
33
  Classifier: Programming Language :: Python :: 3.9
16
34
  Classifier: Programming Language :: Python :: 3.10
35
+ Classifier: Programming Language :: Python :: 3.11
17
36
  Classifier: Development Status :: 5 - Production/Stable
18
37
  Classifier: Intended Audience :: Developers
38
+ Classifier: Intended Audience :: Science/Research
19
39
  Classifier: Intended Audience :: Education
20
40
  Classifier: License :: OSI Approved :: MIT License
21
41
  Classifier: Operating System :: OS Independent
22
42
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
- Requires-Python: >=3.7
24
- Description-Content-Type: text/markdown; charset=UTF-8
43
+ Requires-Python: >=3.8
44
+ Description-Content-Type: text/markdown
45
+ License-File: AUTHORS
46
+ Requires-Dist: feedparser>=6
47
+ Requires-Dist: pytz
48
+ Requires-Dist: requests>=2.21.0
49
+ Requires-Dist: bibtexparser
25
50
  Provides-Extra: test
26
- Provides-Extra: all
27
- License-File: license.txt
51
+ Requires-Dist: pytest>=7.4.2; extra == "test"
52
+ Requires-Dist: httpretty; extra == "test"
53
+ Requires-Dist: python-dateutil; extra == "test"
28
54
 
29
55
  [![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) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](license.txt) [![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)
30
56
 
@@ -15,6 +15,7 @@ import sys
15
15
  from datetime import date
16
16
 
17
17
  sys.path.insert(1, "..")
18
+ import pyzotero
18
19
  from pyzotero import zotero as zot
19
20
 
20
21
  author = zot.__author__
@@ -46,15 +47,15 @@ source_suffix = ".rst"
46
47
  master_doc = "index"
47
48
 
48
49
  # General information about the project.
49
- project = u"Pyzotero"
50
- copyright = u"2011 – %s, %s" % (current_year, author)
50
+ project = "Pyzotero"
51
+ copyright = "2011 – %s, %s" % (current_year, author)
51
52
 
52
53
  # The version info for the project you're documenting, acts as replacement for
53
54
  # |version| and |release|, also used in various other places throughout the
54
55
  # built documents.
55
56
  #
56
57
  # The short X.Y version.
57
- version = zot.__version__
58
+ version = pyzotero.__version__
58
59
  # The full version, including alpha/beta/rc tags.
59
60
  release = version
60
61
  # The language for content autogenerated by Sphinx. Refer to documentation
@@ -184,7 +185,7 @@ htmlhelp_basename = "Pyzoterodoc"
184
185
  # Grouping the document tree into LaTeX files. List of tuples
185
186
  # (source start file, target name, title, author, documentclass [howto/manual]).
186
187
  latex_documents = [
187
- ("index", "Pyzotero.tex", u"Pyzotero Documentation", author, "manual"),
188
+ ("index", "Pyzotero.tex", "Pyzotero Documentation", author, "manual"),
188
189
  ]
189
190
 
190
191
  # The name of an image file (relative to this directory) to place at the top of
@@ -215,16 +216,16 @@ latex_documents = [
215
216
 
216
217
  # One entry per manual page. List of tuples
217
218
  # (source start file, name, description, authors, manual section).
218
- man_pages = [("index", "pyzotero", u"Pyzotero Documentation", [author], 1)]
219
+ man_pages = [("index", "pyzotero", "Pyzotero Documentation", [author], 1)]
219
220
 
220
221
 
221
222
  # -- Options for Epub output ---------------------------------------------------
222
223
 
223
224
  # Bibliographic Dublin Core info.
224
- epub_title = u"Pyzotero"
225
+ epub_title = "Pyzotero"
225
226
  epub_author = author
226
227
  epub_publisher = author
227
- epub_copyright = u"2011 – %s, %s" % (current_year, author)
228
+ epub_copyright = "2011 – %s, %s" % (current_year, author)
228
229
 
229
230
  # The language of the text. It defaults to the language option
230
231
  # or en if the language is not set.
@@ -128,6 +128,11 @@ Example:
128
128
 
129
129
  .. _read:
130
130
 
131
+ Errors
132
+ =======
133
+ Where possible, any ``ZoteroError`` which is raised will preserve the underlying error in its ``__cause__`` and ``__context__`` properties, should you wish to work with these directly.
134
+
135
+
131
136
  Read API Methods
132
137
  ====================
133
138
 
@@ -0,0 +1,60 @@
1
+ [project]
2
+ name = "pyzotero"
3
+ dynamic = ["version", "readme"]
4
+ description = "Python wrapper for the Zotero API"
5
+ requires-python = ">=3.8"
6
+ dependencies = [
7
+ "feedparser >= 6",
8
+ "pytz",
9
+ "requests >= 2.21.0",
10
+ "bibtexparser"
11
+ ]
12
+ authors = [{ name = "Stephan Hügel", email = "urschrei@gmail.com" }]
13
+ license = {file = "license.txt"}
14
+ keywords = ["Zotero", "DH"]
15
+ classifiers = [
16
+ "Programming Language :: Python",
17
+ "Programming Language :: Python :: 3.8",
18
+ "Programming Language :: Python :: 3.9",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Development Status :: 5 - Production/Stable",
22
+ "Intended Audience :: Developers",
23
+ "Intended Audience :: Science/Research",
24
+ "Intended Audience :: Education",
25
+ "License :: OSI Approved :: MIT License",
26
+ "Operating System :: OS Independent",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ ]
29
+ [project.urls]
30
+ Repository = "https://github.com/urschrei/pyzotero"
31
+ Tracker = "https://github.com/urschrei/pyzotero/issues"
32
+
33
+ [project.optional-dependencies]
34
+ test = [
35
+ "pytest >= 7.4.2",
36
+ "httpretty",
37
+ "python-dateutil"
38
+ ]
39
+
40
+ [tool.setuptools.dynamic]
41
+ readme = {file = "README.md", content-type = "text/markdown"}
42
+
43
+ [build-system]
44
+ build-backend = "setuptools.build_meta"
45
+ requires = [
46
+ "setuptools >= 45",
47
+ "setuptools-scm[toml] >= 6.2",
48
+ ]
49
+
50
+ [tool.pytest.ini_options]
51
+ minversion = "6.2.2"
52
+ addopts = [
53
+ "--import-mode=importlib",
54
+ ]
55
+ testpaths = [
56
+ "tests",
57
+ ]
58
+
59
+ [tool.setuptools_scm]
60
+ write_to = "src/_version.py"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,8 @@
1
+ # file generated by setuptools_scm
2
+ # don't change, don't track in version control
3
+ TYPE_CHECKING = False
4
+ if TYPE_CHECKING:
5
+ from typing import Tuple
6
+
7
+ __version__ = version = '1.5.15' # type: str
8
+ __version_tuple__ = version_tuple = (1, 5, 15) # type: Tuple[int | str, ...]
@@ -0,0 +1,7 @@
1
+ import importlib.metadata
2
+
3
+ try:
4
+ # __package__ allows for the case where __name__ is "__main__"
5
+ __version__ = importlib.metadata.version(__package__ or __name__)
6
+ except importlib.metadata.PackageNotFoundError:
7
+ __version__ = "0.0.0"
@@ -29,11 +29,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
29
  THE SOFTWARE.
30
30
 
31
31
  """
32
- from . import version as pzv
33
32
 
34
33
  __author__ = "Stephan Hügel"
35
34
  __api_version__ = "3"
36
- __version__ = pzv.__version__
37
35
 
38
36
  import requests
39
37
  from requests import Request
@@ -58,6 +56,7 @@ from urllib.parse import urlparse, urlunparse, parse_qsl
58
56
  from urllib.parse import quote
59
57
 
60
58
  from . import zotero_errors as ze
59
+ import pyzotero as pz
61
60
 
62
61
 
63
62
  # Avoid hanging the application if there's no server response
@@ -145,8 +144,8 @@ def backoff_check(func):
145
144
  resp = func(self, *args, **kwargs)
146
145
  try:
147
146
  resp.raise_for_status()
148
- except requests.exceptions.HTTPError:
149
- error_handler(self, resp)
147
+ except requests.exceptions.HTTPError as exc:
148
+ error_handler(self, resp, exc)
150
149
  self.request = resp
151
150
  backoff = resp.headers.get("backoff") or resp.headers.get("retry-after")
152
151
  if backoff:
@@ -358,7 +357,7 @@ class Zotero:
358
357
  It's always OK to include these headers
359
358
  """
360
359
  _headers = {
361
- "User-Agent": "Pyzotero/%s" % __version__,
360
+ "User-Agent": "Pyzotero/%s" % pz.__version__,
362
361
  "Zotero-API-Version": "%s" % __api_version__,
363
362
  }
364
363
  if self.api_key:
@@ -408,8 +407,8 @@ class Zotero:
408
407
  self.request.encoding = "utf-8"
409
408
  try:
410
409
  self.request.raise_for_status()
411
- except requests.exceptions.HTTPError:
412
- error_handler(self, self.request)
410
+ except requests.exceptions.HTTPError as exc:
411
+ error_handler(self, self.request, exc)
413
412
  backoff = self.request.headers.get("backoff") or self.request.headers.get(
414
413
  "retry-after"
415
414
  )
@@ -476,8 +475,8 @@ class Zotero:
476
475
  req = requests.get(query, headers=headers)
477
476
  try:
478
477
  req.raise_for_status()
479
- except requests.exceptions.HTTPError:
480
- error_handler(self, req)
478
+ except requests.exceptions.HTTPError as exc:
479
+ error_handler(self, req, exc)
481
480
  backoff = self.request.headers.get("backoff") or self.request.headers.get(
482
481
  "retry-after"
483
482
  )
@@ -625,8 +624,8 @@ class Zotero:
625
624
  resp = requests.get(build_url(self.endpoint, query_string), headers=headers)
626
625
  try:
627
626
  resp.raise_for_status()
628
- except requests.exceptions.HTTPError:
629
- error_handler(self, resp)
627
+ except requests.exceptions.HTTPError as exc:
628
+ error_handler(self, resp, exc)
630
629
  backoff = self.request.headers.get("backoff") or self.request.headers.get(
631
630
  "retry-after"
632
631
  )
@@ -1023,8 +1022,8 @@ class Zotero:
1023
1022
  self.request = req
1024
1023
  try:
1025
1024
  req.raise_for_status()
1026
- except requests.exceptions.HTTPError:
1027
- error_handler(self, req)
1025
+ except requests.exceptions.HTTPError as exc:
1026
+ error_handler(self, req, exc)
1028
1027
  backoff = self.request.headers.get("backoff") or self.request.headers.get(
1029
1028
  "retry-after"
1030
1029
  )
@@ -1051,8 +1050,8 @@ class Zotero:
1051
1050
  self.request = req
1052
1051
  try:
1053
1052
  req.raise_for_status()
1054
- except requests.exceptions.HTTPError:
1055
- error_handler(self, req)
1053
+ except requests.exceptions.HTTPError as exc:
1054
+ error_handler(self, req, exc)
1056
1055
  backoff = self.request.headers.get("backoff") or self.request.headers.get(
1057
1056
  "retry-after"
1058
1057
  )
@@ -1227,8 +1226,8 @@ class Zotero:
1227
1226
  self.request = req
1228
1227
  try:
1229
1228
  req.raise_for_status()
1230
- except requests.exceptions.HTTPError:
1231
- error_handler(self, req)
1229
+ except requests.exceptions.HTTPError as exc:
1230
+ error_handler(self, req, exc)
1232
1231
  resp = req.json()
1233
1232
  backoff = self.request.headers.get("backoff") or self.request.headers.get(
1234
1233
  "retry-after"
@@ -1259,8 +1258,8 @@ class Zotero:
1259
1258
  self.request = presp
1260
1259
  try:
1261
1260
  presp.raise_for_status()
1262
- except requests.exceptions.HTTPError:
1263
- error_handler(self, presp)
1261
+ except requests.exceptions.HTTPError as exc:
1262
+ error_handler(self, presp, exc)
1264
1263
  backoff = presp.headers.get("backoff") or presp.headers.get(
1265
1264
  "retry-after"
1266
1265
  )
@@ -1303,8 +1302,8 @@ class Zotero:
1303
1302
  self.request = req
1304
1303
  try:
1305
1304
  req.raise_for_status()
1306
- except requests.exceptions.HTTPError:
1307
- error_handler(self, req)
1305
+ except requests.exceptions.HTTPError as exc:
1306
+ error_handler(self, req, exc)
1308
1307
  backoff = req.headers.get("backoff") or req.headers.get("retry-after")
1309
1308
  if backoff:
1310
1309
  self._set_backoff(backoff)
@@ -1417,8 +1416,8 @@ class Zotero:
1417
1416
  self.request = req
1418
1417
  try:
1419
1418
  req.raise_for_status()
1420
- except requests.exceptions.HTTPError:
1421
- error_handler(self, req)
1419
+ except requests.exceptions.HTTPError as exc:
1420
+ error_handler(self, req, exc)
1422
1421
  backoff = req.headers.get("backoff") or req.headers.get("retry-after")
1423
1422
  if backoff:
1424
1423
  self._set_backoff(backoff)
@@ -1449,8 +1448,8 @@ class Zotero:
1449
1448
  self.request = req
1450
1449
  try:
1451
1450
  req.raise_for_status()
1452
- except requests.exceptions.HTTPError:
1453
- error_handler(self, req)
1451
+ except requests.exceptions.HTTPError as exc:
1452
+ error_handler(self, req, exc)
1454
1453
  backoff = req.headers.get("backoff") or req.headers.get("retry-after")
1455
1454
  if backoff:
1456
1455
  self._set_backoff(backoff)
@@ -1602,7 +1601,7 @@ class Zotero:
1602
1601
  return requests.delete(url=url, params=params, headers=headers)
1603
1602
 
1604
1603
 
1605
- def error_handler(zot, req):
1604
+ def error_handler(zot, req, exc=None):
1606
1605
  """Error handler for HTTP requests"""
1607
1606
  error_codes = {
1608
1607
  400: ze.UnsupportedParams,
@@ -1638,14 +1637,21 @@ def error_handler(zot, req):
1638
1637
  else:
1639
1638
  zot._set_backoff(delay)
1640
1639
  else:
1641
- raise error_codes.get(req.status_code)(err_msg(req))
1640
+ if not exc:
1641
+ raise error_codes.get(req.status_code)(err_msg(req))
1642
+ else:
1643
+ raise error_codes.get(req.status_code)(err_msg(req)) from exc
1642
1644
  else:
1643
- raise ze.HTTPError(err_msg(req))
1645
+ if not exc:
1646
+ raise ze.HTTPError(err_msg(req))
1647
+ else:
1648
+ raise ze.HTTPError(err_msg(req)) from exc
1644
1649
 
1645
1650
 
1646
1651
  class SavedSearch:
1647
1652
  """Saved search functionality
1648
- See https://github.com/zotero/zotero/blob/master/chrome/content/zotero/xpcom/data/searchConditions.js"""
1653
+ See https://github.com/zotero/zotero/blob/master/chrome/content/zotero/xpcom/data/searchConditions.js
1654
+ """
1649
1655
 
1650
1656
  def __init__(self, zinstance):
1651
1657
  super(SavedSearch, self).__init__()
@@ -1889,8 +1895,8 @@ class Zupload:
1889
1895
  )
1890
1896
  try:
1891
1897
  req.raise_for_status()
1892
- except requests.exceptions.HTTPError:
1893
- error_handler(self.zinstance, req)
1898
+ except requests.exceptions.HTTPError as exc:
1899
+ error_handler(self.zinstance, req, exc)
1894
1900
  backoff = req.headers.get("backoff") or req.headers.get("retry-after")
1895
1901
  if backoff:
1896
1902
  self.zinstance._set_backoff(backoff)
@@ -1939,8 +1945,8 @@ class Zupload:
1939
1945
  )
1940
1946
  try:
1941
1947
  auth_req.raise_for_status()
1942
- except requests.exceptions.HTTPError:
1943
- error_handler(self.zinstance, auth_req)
1948
+ except requests.exceptions.HTTPError as exc:
1949
+ error_handler(self.zinstance, auth_req, exc)
1944
1950
  backoff = auth_req.headers.get("backoff") or auth_req.headers.get("retry-after")
1945
1951
  if backoff:
1946
1952
  self.zinstance._set_backoff(backoff)
@@ -1967,12 +1973,12 @@ class Zupload:
1967
1973
  files=upload_pairs,
1968
1974
  headers={"User-Agent": "Pyzotero/%s" % __version__},
1969
1975
  )
1970
- except (requests.exceptions.ConnectionError):
1976
+ except requests.exceptions.ConnectionError:
1971
1977
  raise ze.UploadError("ConnectionError")
1972
1978
  try:
1973
1979
  upload.raise_for_status()
1974
- except requests.exceptions.HTTPError:
1975
- error_handler(self.zinstance, upload)
1980
+ except requests.exceptions.HTTPError as exc:
1981
+ error_handler(self.zinstance, upload, exc)
1976
1982
  backoff = upload.headers.get("backoff") or upload.headers.get("retry-after")
1977
1983
  if backoff:
1978
1984
  self.zinstance._set_backoff(backoff)
@@ -2004,8 +2010,8 @@ class Zupload:
2004
2010
  )
2005
2011
  try:
2006
2012
  upload_reg.raise_for_status()
2007
- except requests.exceptions.HTTPError:
2008
- error_handler(self.zinstance, upload_reg)
2013
+ except requests.exceptions.HTTPError as exc:
2014
+ error_handler(self.zinstance, upload_reg, exc)
2009
2015
  backoff = upload_reg.headers.get("backoff") or upload_reg.headers.get(
2010
2016
  "retry-after"
2011
2017
  )
@@ -1,30 +1,56 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyzotero
3
- Version: 1.5.9
3
+ Version: 1.5.15
4
4
  Summary: Python wrapper for the Zotero API
5
- Home-page: https://github.com/urschrei/pyzotero
6
- Author: Stephan Hügel
7
- Author-email: urschrei@gmail.com
8
- License: MIT
9
- Project-URL: Source, https://github.com/urschrei/pyzotero
5
+ Author-email: Stephan Hügel <urschrei@gmail.com>
6
+ License: The MIT License (MIT)
7
+
8
+ Copyright (c) 2015 Stephan Hügel
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ THE SOFTWARE.
27
+
28
+ Project-URL: Repository, https://github.com/urschrei/pyzotero
10
29
  Project-URL: Tracker, https://github.com/urschrei/pyzotero/issues
11
- Keywords: zotero
30
+ Keywords: Zotero,DH
12
31
  Classifier: Programming Language :: Python
13
- Classifier: Programming Language :: Python :: 3.7
14
32
  Classifier: Programming Language :: Python :: 3.8
15
33
  Classifier: Programming Language :: Python :: 3.9
16
34
  Classifier: Programming Language :: Python :: 3.10
35
+ Classifier: Programming Language :: Python :: 3.11
17
36
  Classifier: Development Status :: 5 - Production/Stable
18
37
  Classifier: Intended Audience :: Developers
38
+ Classifier: Intended Audience :: Science/Research
19
39
  Classifier: Intended Audience :: Education
20
40
  Classifier: License :: OSI Approved :: MIT License
21
41
  Classifier: Operating System :: OS Independent
22
42
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
- Requires-Python: >=3.7
24
- Description-Content-Type: text/markdown; charset=UTF-8
43
+ Requires-Python: >=3.8
44
+ Description-Content-Type: text/markdown
45
+ License-File: AUTHORS
46
+ Requires-Dist: feedparser>=6
47
+ Requires-Dist: pytz
48
+ Requires-Dist: requests>=2.21.0
49
+ Requires-Dist: bibtexparser
25
50
  Provides-Extra: test
26
- Provides-Extra: all
27
- License-File: license.txt
51
+ Requires-Dist: pytest>=7.4.2; extra == "test"
52
+ Requires-Dist: httpretty; extra == "test"
53
+ Requires-Dist: python-dateutil; extra == "test"
28
54
 
29
55
  [![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) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](license.txt) [![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)
30
56
 
@@ -1,6 +1,6 @@
1
1
  .coveragerc
2
2
  .gitignore
3
- .readthedocs.yml
3
+ .readthedocs.yaml
4
4
  AUTHORS
5
5
  CITATION.cff
6
6
  CONTRIBUTING.md
@@ -9,11 +9,10 @@ README.md
9
9
  __init__.py
10
10
  dump_contributors.py
11
11
  license.txt
12
- manifest.in
13
12
  pre-deploy.py
14
13
  pyproject.toml
15
- setup.cfg
16
14
  setup.py
15
+ .github/dependabot.yml
17
16
  .github/pull_request_template.md
18
17
  .github/ISSUE_TEMPLATE/bug_report.md
19
18
  .github/ISSUE_TEMPLATE/usage_question.md
@@ -23,16 +22,15 @@ doc/cat.png
23
22
  doc/conf.py
24
23
  doc/index.rst
25
24
  doc/_templates/layout.html
26
- pyzotero/__init__.py
27
- pyzotero/version.py
28
- pyzotero/zotero.py
29
- pyzotero/zotero_errors.py
30
- pyzotero.egg-info/PKG-INFO
31
- pyzotero.egg-info/SOURCES.txt
32
- pyzotero.egg-info/dependency_links.txt
33
- pyzotero.egg-info/not-zip-safe
34
- pyzotero.egg-info/requires.txt
35
- pyzotero.egg-info/top_level.txt
25
+ src/_version.py
26
+ src/pyzotero/__init__.py
27
+ src/pyzotero/zotero.py
28
+ src/pyzotero/zotero_errors.py
29
+ src/pyzotero.egg-info/PKG-INFO
30
+ src/pyzotero.egg-info/SOURCES.txt
31
+ src/pyzotero.egg-info/dependency_links.txt
32
+ src/pyzotero.egg-info/requires.txt
33
+ src/pyzotero.egg-info/top_level.txt
36
34
  tests/test_zotero.py
37
35
  tests/api_responses/__init__.py
38
36
  tests/api_responses/attachments_doc.json
@@ -3,8 +3,7 @@ pytz
3
3
  requests>=2.21.0
4
4
  bibtexparser
5
5
 
6
- [all]
7
- pytest>=6.2.2
8
-
9
6
  [test]
10
- pytest>=6.2.2
7
+ pytest>=7.4.2
8
+ httpretty
9
+ python-dateutil
@@ -141,12 +141,12 @@ class ZoteroTests(unittest.TestCase):
141
141
  body=self.item_doc,
142
142
  )
143
143
  items_data = zot.items()
144
- self.assertEqual(u"X42A7DEE", items_data["data"]["key"])
144
+ self.assertEqual("X42A7DEE", items_data["data"]["key"])
145
145
  self.assertEqual(
146
- u"Institute of Physics (Great Britain)",
146
+ "Institute of Physics (Great Britain)",
147
147
  items_data["data"]["creators"][0]["name"],
148
148
  )
149
- self.assertEqual(u"book", items_data["data"]["itemType"])
149
+ self.assertEqual("book", items_data["data"]["itemType"])
150
150
  test_dt = parser.parse("2011-01-13T03:37:29Z")
151
151
  incoming_dt = parser.parse(items_data["data"]["dateModified"])
152
152
  self.assertEqual(test_dt, incoming_dt)
@@ -194,7 +194,7 @@ class ZoteroTests(unittest.TestCase):
194
194
  body=self.attachments_doc,
195
195
  )
196
196
  attachments_data = zot.items()
197
- self.assertEqual(u"1641 Depositions", attachments_data["data"]["title"])
197
+ self.assertEqual("1641 Depositions", attachments_data["data"]["title"])
198
198
 
199
199
  @httpretty.activate
200
200
  def testParseKeysResponse(self):
@@ -251,7 +251,7 @@ class ZoteroTests(unittest.TestCase):
251
251
  body=self.items_doc,
252
252
  )
253
253
  items_data = zot.children("ABC123")
254
- self.assertEqual(u"NM66T6EF", items_data[0]["key"])
254
+ self.assertEqual("NM66T6EF", items_data[0]["key"])
255
255
 
256
256
  @httpretty.activate
257
257
  def testCitUTF8(self):
@@ -265,7 +265,7 @@ class ZoteroTests(unittest.TestCase):
265
265
  body=self.citation_doc,
266
266
  )
267
267
  cit = zot.item("GW8V2CK7", content="citation", style="chicago-author-date")
268
- self.assertEqual(cit[0], u"<span>(Ans\\xe6lm and Tka\\u010dik 2014)</span>")
268
+ self.assertEqual(cit[0], "<span>(Ans\\xe6lm and Tka\\u010dik 2014)</span>")
269
269
 
270
270
  # @httpretty.activate
271
271
  # def testParseItemAtomBibDoc(self):
@@ -343,7 +343,7 @@ class ZoteroTests(unittest.TestCase):
343
343
  body=self.tags_doc,
344
344
  )
345
345
  tags_data = zot.tags()
346
- self.assertEqual(u"Community / Economic Development", tags_data[0])
346
+ self.assertEqual("Community / Economic Development", tags_data[0])
347
347
 
348
348
  @httpretty.activate
349
349
  def testParseLinkHeaders(self):
@@ -418,6 +418,20 @@ class ZoteroTests(unittest.TestCase):
418
418
  with self.assertRaises(z.ze.UserNotAuthorised):
419
419
  zot.items()
420
420
 
421
+ @httpretty.activate
422
+ def testTimeout(self):
423
+ """Ensure that an error is properly raised for 503"""
424
+ zot = z.Zotero("myuserID", "user", "myuserkey")
425
+ HTTPretty.register_uri(
426
+ HTTPretty.GET,
427
+ "https://api.zotero.org/users/myuserID/items",
428
+ content_type="application/json",
429
+ body=self.items_doc,
430
+ status=503,
431
+ )
432
+ with self.assertRaises(z.ze.HTTPError):
433
+ zot.items()
434
+
421
435
  @httpretty.activate
422
436
  def testResponseUnsupported(self):
423
437
  """Ensure that an error is properly raised for 400"""
@@ -1,8 +0,0 @@
1
- build:
2
- image: latest
3
-
4
- python:
5
- version: 3.6
6
- setup_py_install: true
7
-
8
- formats: []
@@ -1,3 +0,0 @@
1
- include license.txt
2
- include readme.md
3
- include doc/index.rst
@@ -1,10 +0,0 @@
1
- [build-system]
2
- requires = [
3
- "setuptools >= 40.6.0",
4
- "wheel >= 0.29.0",
5
- "setuptools_scm[toml] >= 4, <6",
6
- ]
7
- build-backend = "setuptools.build_meta"
8
-
9
- [tool.ruff]
10
- ignore = ["E501"]
@@ -1 +0,0 @@
1
- __version__ = "1.5.9"
@@ -1 +0,0 @@
1
-
pyzotero-1.5.9/setup.cfg DELETED
@@ -1,63 +0,0 @@
1
- [metadata]
2
- name = pyzotero
3
- version = attr: pyzotero.version.__version__
4
- description = Python wrapper for the Zotero API
5
- long_description = file: README.md
6
- long_description_content_type = text/markdown; charset=UTF-8
7
- url = https://github.com/urschrei/pyzotero
8
- author = Stephan Hügel
9
- author_email = urschrei@gmail.com
10
- license = MIT
11
- license_files = license.txt
12
- keywords = zotero
13
- classifiers =
14
- Programming Language :: Python
15
- Programming Language :: Python :: 3.7
16
- Programming Language :: Python :: 3.8
17
- Programming Language :: Python :: 3.9
18
- Programming Language :: Python :: 3.10
19
- Development Status :: 5 - Production/Stable
20
- Intended Audience :: Developers
21
- Intended Audience :: Education
22
- License :: OSI Approved :: MIT License
23
- Operating System :: OS Independent
24
- Topic :: Software Development :: Libraries :: Python Modules
25
- project_urls =
26
- Source = https://github.com/urschrei/pyzotero
27
- Tracker = https://github.com/urschrei/pyzotero/issues
28
-
29
- [options]
30
- zip_safe = False
31
- packages = find:
32
- platforms = any
33
- include_package_data = True
34
- install_requires =
35
- feedparser >= 6
36
- pytz
37
- requests >= 2.21.0
38
- bibtexparser
39
- python_requires = >=3.7
40
- setup_requires =
41
- setuptools_scm
42
- tests_require =
43
- pytest >= 6.2.2
44
- httpretty
45
- python-dateutil
46
- test_suite = test
47
-
48
- [bdist_wheel]
49
- universal = 0
50
-
51
- [options.extras_require]
52
- test =
53
- pytest >= 6.2.2
54
- all =
55
- %(test)s
56
-
57
- [flake8]
58
- ignore = E501,E203,W503
59
-
60
- [egg_info]
61
- tag_build =
62
- tag_date = 0
63
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes