pyzotero 1.7.1__tar.gz → 1.7.3__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 (34) hide show
  1. {pyzotero-1.7.1 → pyzotero-1.7.3}/PKG-INFO +2 -2
  2. {pyzotero-1.7.1 → pyzotero-1.7.3}/README.md +1 -1
  3. {pyzotero-1.7.1 → pyzotero-1.7.3}/pyproject.toml +1 -1
  4. {pyzotero-1.7.1 → pyzotero-1.7.3}/src/pyzotero/cli.py +50 -2
  5. {pyzotero-1.7.1 → pyzotero-1.7.3}/LICENSE.md +0 -0
  6. {pyzotero-1.7.1 → pyzotero-1.7.3}/doc/Makefile +0 -0
  7. {pyzotero-1.7.1 → pyzotero-1.7.3}/doc/_templates/layout.html +0 -0
  8. {pyzotero-1.7.1 → pyzotero-1.7.3}/doc/cat.png +0 -0
  9. {pyzotero-1.7.1 → pyzotero-1.7.3}/doc/conf.py +0 -0
  10. {pyzotero-1.7.1 → pyzotero-1.7.3}/doc/index.rst +0 -0
  11. {pyzotero-1.7.1 → pyzotero-1.7.3}/src/pyzotero/__init__.py +0 -0
  12. {pyzotero-1.7.1 → pyzotero-1.7.3}/src/pyzotero/filetransport.py +0 -0
  13. {pyzotero-1.7.1 → pyzotero-1.7.3}/src/pyzotero/zotero.py +0 -0
  14. {pyzotero-1.7.1 → pyzotero-1.7.3}/src/pyzotero/zotero_errors.py +0 -0
  15. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/__init__.py +0 -0
  16. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/attachments_doc.json +0 -0
  17. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/citation_doc.xml +0 -0
  18. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/collection_doc.json +0 -0
  19. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/collection_tags.json +0 -0
  20. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/collection_versions.json +0 -0
  21. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/collections_doc.json +0 -0
  22. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/creation_doc.json +0 -0
  23. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/groups_doc.json +0 -0
  24. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/item_doc.json +0 -0
  25. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/item_fields.json +0 -0
  26. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/item_file.pdf +0 -0
  27. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/item_template.json +0 -0
  28. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/item_types.json +0 -0
  29. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/item_versions.json +0 -0
  30. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/items_doc.json +0 -0
  31. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/keys_doc.txt +0 -0
  32. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/api_responses/tags_doc.json +0 -0
  33. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/test_async.py +0 -0
  34. {pyzotero-1.7.1 → pyzotero-1.7.3}/tests/test_zotero.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyzotero
3
- Version: 1.7.1
3
+ Version: 1.7.3
4
4
  Summary: Python wrapper for the Zotero API
5
5
  Keywords: Zotero,DH
6
6
  Author: Stephan Hügel
@@ -149,7 +149,7 @@ Use the `--json` flag to output structured JSON.
149
149
 
150
150
  ## Optional: Command-Line Interface
151
151
 
152
- Pyzotero includes an optional command-line interface for searching and querying your local Zotero library.
152
+ Pyzotero includes an optional command-line interface for searching and querying your local Zotero library. As it uses the local API server introduced in Zotero 7, it requires "Allow other applications on this computer to communicate with Zotero" to be enabled in Zotero's Settings > Advanced.
153
153
 
154
154
  ### Installing the CLI
155
155
 
@@ -82,7 +82,7 @@ Use the `--json` flag to output structured JSON.
82
82
 
83
83
  ## Optional: Command-Line Interface
84
84
 
85
- Pyzotero includes an optional command-line interface for searching and querying your local Zotero library.
85
+ Pyzotero includes an optional command-line interface for searching and querying your local Zotero library. As it uses the local API server introduced in Zotero 7, it requires "Allow other applications on this computer to communicate with Zotero" to be enabled in Zotero's Settings > Advanced.
86
86
 
87
87
  ### Installing the CLI
88
88
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyzotero"
3
- version = "1.7.1"
3
+ version = "1.7.3"
4
4
  description = "Python wrapper for the Zotero API"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9"
@@ -4,8 +4,9 @@ import json
4
4
  import sys
5
5
 
6
6
  import click
7
+ import httpx
7
8
 
8
- from pyzotero import zotero
9
+ from pyzotero import __version__, zotero
9
10
  from pyzotero.zotero import chunks
10
11
 
11
12
 
@@ -15,6 +16,7 @@ def _get_zotero_client(locale="en-US"):
15
16
 
16
17
 
17
18
  @click.group()
19
+ @click.version_option(version=__version__, prog_name="pyzotero")
18
20
  @click.option(
19
21
  "--locale",
20
22
  default="en-US",
@@ -210,7 +212,11 @@ def search(ctx, query, fulltext, itemtype, collection, limit, output_json): # n
210
212
 
211
213
  # Output results
212
214
  if output_json:
213
- click.echo(json.dumps(output_items, indent=2))
215
+ click.echo(
216
+ json.dumps(
217
+ {"count": len(output_items), "items": output_items}, indent=2
218
+ )
219
+ )
214
220
  else:
215
221
  click.echo(f"\nFound {len(results)} items:\n")
216
222
  for idx, item_obj in enumerate(output_items, 1):
@@ -348,5 +354,47 @@ def itemtypes(ctx):
348
354
  sys.exit(1)
349
355
 
350
356
 
357
+ @main.command()
358
+ @click.pass_context
359
+ def test(ctx):
360
+ """Test connection to local Zotero instance.
361
+
362
+ This command checks whether Zotero is running and accepting local connections.
363
+
364
+ Examples:
365
+ pyzotero test
366
+
367
+ """
368
+ try:
369
+ locale = ctx.obj.get("locale", "en-US")
370
+ zot = _get_zotero_client(locale)
371
+
372
+ # Call settings() to test the connection
373
+ # This should return {} if Zotero is running and listening
374
+ result = zot.settings()
375
+
376
+ # If we get here, the connection succeeded
377
+ click.echo("✓ Connection successful: Zotero is running and listening locally.")
378
+ if result == {}:
379
+ click.echo(" Received expected empty settings response.")
380
+ else:
381
+ click.echo(f" Received response: {json.dumps(result)}")
382
+
383
+ except httpx.ConnectError:
384
+ click.echo(
385
+ "✗ Connection failed: Could not connect to Zotero.\n\n"
386
+ "Possible causes:\n"
387
+ " • Zotero might not be running\n"
388
+ " • Local connections might not be enabled\n\n"
389
+ "To enable local connections:\n"
390
+ " Zotero > Settings > Advanced > Allow other applications on this computer to communicate with Zotero",
391
+ err=True,
392
+ )
393
+ sys.exit(1)
394
+ except Exception as e:
395
+ click.echo(f"Error: {e!s}", err=True)
396
+ sys.exit(1)
397
+
398
+
351
399
  if __name__ == "__main__":
352
400
  main()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes