pyzotero 1.6.0__tar.gz → 1.6.1__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 (54) hide show
  1. {pyzotero-1.6.0 → pyzotero-1.6.1}/.github/pull_request_template.md +4 -4
  2. {pyzotero-1.6.0/src/pyzotero.egg-info → pyzotero-1.6.1}/PKG-INFO +1 -1
  3. {pyzotero-1.6.0 → pyzotero-1.6.1}/src/_version.py +2 -2
  4. {pyzotero-1.6.0 → pyzotero-1.6.1}/src/pyzotero/zotero.py +9 -6
  5. {pyzotero-1.6.0 → pyzotero-1.6.1/src/pyzotero.egg-info}/PKG-INFO +1 -1
  6. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/test_zotero.py +15 -1
  7. {pyzotero-1.6.0 → pyzotero-1.6.1}/.coveragerc +0 -0
  8. {pyzotero-1.6.0 → pyzotero-1.6.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  9. {pyzotero-1.6.0 → pyzotero-1.6.1}/.github/ISSUE_TEMPLATE/usage_question.md +0 -0
  10. {pyzotero-1.6.0 → pyzotero-1.6.1}/.github/dependabot.yml +0 -0
  11. {pyzotero-1.6.0 → pyzotero-1.6.1}/.github/workflows/tests.yml +0 -0
  12. {pyzotero-1.6.0 → pyzotero-1.6.1}/.gitignore +0 -0
  13. {pyzotero-1.6.0 → pyzotero-1.6.1}/.readthedocs.yaml +0 -0
  14. {pyzotero-1.6.0 → pyzotero-1.6.1}/AUTHORS +0 -0
  15. {pyzotero-1.6.0 → pyzotero-1.6.1}/CITATION.cff +0 -0
  16. {pyzotero-1.6.0 → pyzotero-1.6.1}/CONTRIBUTING.md +0 -0
  17. {pyzotero-1.6.0 → pyzotero-1.6.1}/CONTRIBUTORS.md +0 -0
  18. {pyzotero-1.6.0 → pyzotero-1.6.1}/LICENSE.md +0 -0
  19. {pyzotero-1.6.0 → pyzotero-1.6.1}/README.md +0 -0
  20. {pyzotero-1.6.0 → pyzotero-1.6.1}/__init__.py +0 -0
  21. {pyzotero-1.6.0 → pyzotero-1.6.1}/doc/Makefile +0 -0
  22. {pyzotero-1.6.0 → pyzotero-1.6.1}/doc/_templates/layout.html +0 -0
  23. {pyzotero-1.6.0 → pyzotero-1.6.1}/doc/cat.png +0 -0
  24. {pyzotero-1.6.0 → pyzotero-1.6.1}/doc/conf.py +0 -0
  25. {pyzotero-1.6.0 → pyzotero-1.6.1}/doc/index.rst +0 -0
  26. {pyzotero-1.6.0 → pyzotero-1.6.1}/dump_contributors.py +0 -0
  27. {pyzotero-1.6.0 → pyzotero-1.6.1}/pyproject.toml +0 -0
  28. {pyzotero-1.6.0 → pyzotero-1.6.1}/setup.cfg +0 -0
  29. {pyzotero-1.6.0 → pyzotero-1.6.1}/setup.py +0 -0
  30. {pyzotero-1.6.0 → pyzotero-1.6.1}/src/pyzotero/__init__.py +0 -0
  31. {pyzotero-1.6.0 → pyzotero-1.6.1}/src/pyzotero/zotero_errors.py +0 -0
  32. {pyzotero-1.6.0 → pyzotero-1.6.1}/src/pyzotero.egg-info/SOURCES.txt +0 -0
  33. {pyzotero-1.6.0 → pyzotero-1.6.1}/src/pyzotero.egg-info/dependency_links.txt +0 -0
  34. {pyzotero-1.6.0 → pyzotero-1.6.1}/src/pyzotero.egg-info/requires.txt +0 -0
  35. {pyzotero-1.6.0 → pyzotero-1.6.1}/src/pyzotero.egg-info/top_level.txt +0 -0
  36. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/__init__.py +0 -0
  37. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/attachments_doc.json +0 -0
  38. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/citation_doc.xml +0 -0
  39. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/collection_doc.json +0 -0
  40. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/collection_tags.json +0 -0
  41. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/collection_versions.json +0 -0
  42. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/collections_doc.json +0 -0
  43. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/creation_doc.json +0 -0
  44. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/groups_doc.json +0 -0
  45. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/item_doc.json +0 -0
  46. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/item_fields.json +0 -0
  47. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/item_file.pdf +0 -0
  48. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/item_template.json +0 -0
  49. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/item_types.json +0 -0
  50. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/item_versions.json +0 -0
  51. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/items_doc.json +0 -0
  52. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/keys_doc.txt +0 -0
  53. {pyzotero-1.6.0 → pyzotero-1.6.1}/tests/api_responses/tags_doc.json +0 -0
  54. {pyzotero-1.6.0 → pyzotero-1.6.1}/uv.lock +0 -0
@@ -2,11 +2,11 @@ Thanks for opening a PR. Please read the following:
2
2
 
3
3
  - **Base your changes on the `dev` branch**
4
4
  - If necessary, rebase against `dev` before opening a pull request
5
- - Follow [PEP 8](http://www.python.org/dev/peps/pep-0008/). I currently periodically run [`Black`](https://black.readthedocs.io/en/stable/) against the codebase and perhaps you should, too
5
+ - Follow [PEP 8](http://www.python.org/dev/peps/pep-0008/). I run [`ruff`](https://docs.astral.sh/ruff/) against the codebase and perhaps you should, too
6
6
  - Use spaces for indentation, and ensure that all methods have a proper docstring. **Please don't use Doctest**
7
7
  - If at all possible, don't add dependencies
8
8
  - If it's unavoidable, ensure that the dependency is maintained, and supported
9
- - Ensure that you add your dependency to [setup.py](setup.py)
9
+ - Ensure that you add your dependency to [pyproject.toml](pyproject.toml)
10
10
  - Run the tests, and ensure that they pass. If you're adding a feature, **you must add tests that exercise it**
11
11
  - If your pull request is a feature, **document it**
12
12
  - One feature per pull request
@@ -14,5 +14,5 @@ Thanks for opening a PR. Please read the following:
14
14
  - If in doubt, comment your code.
15
15
 
16
16
  ## License of Contributed Code
17
- Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be MIT licensed, without any additional terms or conditions.
18
- Please note that pull requests with licenses that are more restrictive than or otherwise incompatible with the MIT license will not be accepted.
17
+ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed under the Blua Oak Model License 1.0, without any additional terms or conditions.
18
+ Please note that pull requests with licenses that are more restrictive than or otherwise incompatible with the license will not be accepted.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyzotero
3
- Version: 1.6.0
3
+ Version: 1.6.1
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
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.6.0'
16
- __version_tuple__ = version_tuple = (1, 6, 0)
15
+ __version__ = version = '1.6.1'
16
+ __version_tuple__ = version_tuple = (1, 6, 1)
@@ -338,6 +338,7 @@ class Zotero:
338
338
  return False
339
339
 
340
340
  def _striplocal(self, url):
341
+ """We need to remve the leading "/api" substring from urls if we're running in local mode"""
341
342
  if self.local:
342
343
  parsed = urlparse(url)
343
344
  purepath = PurePosixPath(unquote(parsed.path))
@@ -432,14 +433,15 @@ class Zotero:
432
433
  # ensure that we wait if there's an active backoff
433
434
  self._check_backoff()
434
435
  # don't set locale if the url already contains it
435
- if params and self.links:
436
- if not self._check_for_component(self.links.get("next"), "locale"):
436
+ # we always add a locale if it's a "standalone" or first call
437
+ needs_locale = not self.links or not self._check_for_component(
438
+ self.links.get("next"), "locale"
439
+ )
440
+ if needs_locale:
441
+ if params:
437
442
  params["locale"] = self.locale
438
- if not params and self.links:
439
- if not self._check_for_component(self.links.get("next"), "locale"):
440
- params = {"locale": self.locale}
441
443
  else:
442
- params = {}
444
+ params = {"locale": self.locale}
443
445
  self.request = requests.get(
444
446
  url=full_url, headers=self.default_headers(), params=params
445
447
  )
@@ -877,6 +879,7 @@ class Zotero:
877
879
  """Return the result of the call to the URL in the 'Next' link"""
878
880
  if n := self.links.get("next"):
879
881
  newurl = self._striplocal(n)
882
+ print(newurl)
880
883
  return newurl
881
884
  return
882
885
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyzotero
3
- Version: 1.6.0
3
+ Version: 1.6.1
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,7 +59,7 @@ class ZoteroTests(unittest.TestCase):
59
59
  content_type="application/json",
60
60
  body=self.items_doc,
61
61
  )
62
-
62
+
63
63
  def testBuildUrlCorrectHandleEndpoint(self):
64
64
  """url should be concat correctly by build_url"""
65
65
  url = z.build_url("http://localhost:23119/api", "/users/0")
@@ -84,6 +84,20 @@ class ZoteroTests(unittest.TestCase):
84
84
  parse_qs("start=7&limit=100&format=json"), parse_qs(zot.url_params)
85
85
  )
86
86
 
87
+ @httpretty.activate
88
+ def testLocale(self):
89
+ """Should correctly add locale to request because it's an initial request"""
90
+ HTTPretty.register_uri(
91
+ HTTPretty.GET,
92
+ "https://api.zotero.org/users/myuserID/items",
93
+ content_type="application/json",
94
+ body=self.item_doc,
95
+ )
96
+ zot = z.Zotero("myuserID", "user", "myuserkey")
97
+ _ = zot.items()
98
+ req = zot.request
99
+ self.assertEqual(req.url.find("locale"), 66)
100
+
87
101
  @httpretty.activate
88
102
  def testRequestBuilderLimitNone(self):
89
103
  """Should skip limit = 100 param if limit is set to None"""
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
File without changes
File without changes
File without changes
File without changes
File without changes