geonode-scraper-cli 0.2.0__tar.gz → 0.2.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 (34) hide show
  1. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/PKG-INFO +2 -2
  2. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/__init__.py +1 -1
  3. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/config.py +7 -1
  4. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/context.py +3 -1
  5. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli.egg-info/PKG-INFO +2 -2
  6. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli.egg-info/SOURCES.txt +2 -1
  7. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli.egg-info/requires.txt +1 -1
  8. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/pyproject.toml +2 -2
  9. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/tests/test_cli.py +1 -1
  10. geonode_scraper_cli-0.2.1/tests/test_user_agent.py +28 -0
  11. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/README.md +0 -0
  12. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/__init__.py +0 -0
  13. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/_common.py +0 -0
  14. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/batch.py +0 -0
  15. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/config.py +0 -0
  16. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/crawl.py +0 -0
  17. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/extract.py +0 -0
  18. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/jobs.py +0 -0
  19. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/map.py +0 -0
  20. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/search.py +0 -0
  21. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/stats.py +0 -0
  22. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/system.py +0 -0
  23. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/commands/usage.py +0 -0
  24. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/errors.py +0 -0
  25. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/invoke.py +0 -0
  26. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/main.py +0 -0
  27. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/output.py +0 -0
  28. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/py.typed +0 -0
  29. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/renderers/__init__.py +0 -0
  30. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli/renderers/tables.py +0 -0
  31. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli.egg-info/dependency_links.txt +0 -0
  32. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli.egg-info/entry_points.txt +0 -0
  33. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/geonode_scraper_cli.egg-info/top_level.txt +0 -0
  34. {geonode_scraper_cli-0.2.0 → geonode_scraper_cli-0.2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geonode-scraper-cli
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Command-line interface for the Geonode Scraper API
5
5
  Author: Geonode Team
6
6
  License-Expression: MIT
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3.12
10
10
  Classifier: Typing :: Typed
11
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
- Requires-Dist: geonode-scraper-tools-core>=0.4.0
13
+ Requires-Dist: geonode-scraper-tools-core>=0.5.0
14
14
  Requires-Dist: typer>=0.12
15
15
  Requires-Dist: rich>=13.0
16
16
  Requires-Dist: PyYAML>=6.0
@@ -1,3 +1,3 @@
1
- __version__ = "0.2.0"
1
+ __version__ = "0.2.1"
2
2
 
3
3
  __all__ = ["__version__"]
@@ -15,7 +15,13 @@ from geonode_scraper_tools_core import ScraperToolSettings
15
15
 
16
16
  ENV_PREFIX = "GEONODE_SCRAPER_"
17
17
  DEFAULT_PROFILE = "default"
18
- DEFAULT_HOST = "http://localhost"
18
+ # The production API. It used to be `http://localhost`, which is the OpenAPI
19
+ # generator's fallback for a spec with no `servers` block - harmless in a generated
20
+ # client that documents it, and wrong in a CLI a person installs and runs, where it
21
+ # means every command fails to connect until a host is configured. A flag, the
22
+ # environment or the config file still override it; this is only what happens when
23
+ # nobody said anything.
24
+ DEFAULT_HOST = "https://scraper.geonode.io"
19
25
 
20
26
 
21
27
  class ConfigError(Exception):
@@ -7,6 +7,7 @@ from dataclasses import dataclass
7
7
  import typer
8
8
  from geonode_scraper_tools_core import ScraperToolService, ScraperToolSettings
9
9
 
10
+ from . import __version__
10
11
  from .config import ConfigError, resolve_settings
11
12
  from .errors import ExitCode
12
13
  from .output import OutputFormat
@@ -49,7 +50,8 @@ class CLIContext:
49
50
 
50
51
  def service(self) -> ScraperToolService:
51
52
  if self._service is None:
52
- self._service = ScraperToolService(self.settings())
53
+ # The API labels requests from this package `cli` (scraper-api#674).
54
+ self._service = ScraperToolService(self.settings(), client=f"geonode-cli/{__version__}")
53
55
  return self._service
54
56
 
55
57
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geonode-scraper-cli
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Command-line interface for the Geonode Scraper API
5
5
  Author: Geonode Team
6
6
  License-Expression: MIT
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3.12
10
10
  Classifier: Typing :: Typed
11
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
- Requires-Dist: geonode-scraper-tools-core>=0.4.0
13
+ Requires-Dist: geonode-scraper-tools-core>=0.5.0
14
14
  Requires-Dist: typer>=0.12
15
15
  Requires-Dist: rich>=13.0
16
16
  Requires-Dist: PyYAML>=6.0
@@ -28,4 +28,5 @@ geonode_scraper_cli/commands/system.py
28
28
  geonode_scraper_cli/commands/usage.py
29
29
  geonode_scraper_cli/renderers/__init__.py
30
30
  geonode_scraper_cli/renderers/tables.py
31
- tests/test_cli.py
31
+ tests/test_cli.py
32
+ tests/test_user_agent.py
@@ -1,4 +1,4 @@
1
- geonode-scraper-tools-core>=0.4.0
1
+ geonode-scraper-tools-core>=0.5.0
2
2
  typer>=0.12
3
3
  rich>=13.0
4
4
  PyYAML>=6.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "geonode-scraper-cli"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "Command-line interface for the Geonode Scraper API"
5
5
  authors = [
6
6
  {name = "Geonode Team"},
@@ -15,7 +15,7 @@ classifiers = [
15
15
  "Typing :: Typed",
16
16
  ]
17
17
  dependencies = [
18
- "geonode-scraper-tools-core>=0.4.0",
18
+ "geonode-scraper-tools-core>=0.5.0",
19
19
  "typer>=0.12",
20
20
  "rich>=13.0",
21
21
  "PyYAML>=6.0",
@@ -97,7 +97,7 @@ def test_missing_api_key_is_usage_error(invoke, fake_service):
97
97
  def test_flag_overrides_env_host(invoke, fake_service, monkeypatch):
98
98
  captured: dict[str, object] = {}
99
99
 
100
- def _capture(settings):
100
+ def _capture(settings, **_):
101
101
  captured["host"] = settings.host
102
102
  return fake_service
103
103
 
@@ -0,0 +1,28 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from unittest.mock import MagicMock, patch
5
+
6
+ import urllib3
7
+
8
+ HEALTH = {"version": "0.1.0", "service": "scraper-api", "timestamp": "2026-01-01T00:00:00Z", "status": "ok"}
9
+
10
+
11
+ def test_requests_name_the_cli_first(runner, tmp_path):
12
+ # The API labels a request by the first User-Agent token (scraper-api#674).
13
+ from geonode_scraper_cli import __version__
14
+ from geonode_scraper_cli.main import app
15
+
16
+ response = MagicMock(status=200, reason="OK", data=json.dumps(HEALTH).encode())
17
+ response.headers = {"content-type": "application/json"}
18
+ env = {
19
+ "GEONODE_SCRAPER_CONFIG": str(tmp_path / "config.toml"),
20
+ "GEONODE_SCRAPER_API_KEY": "test-key",
21
+ "GEONODE_SCRAPER_HOST": "http://api.mock.local",
22
+ }
23
+
24
+ with patch.object(urllib3.PoolManager, "request", return_value=response) as request:
25
+ result = runner.invoke(app, ["--json", "health"], env=env)
26
+
27
+ assert result.exit_code == 0, result.output
28
+ assert request.call_args.kwargs["headers"]["User-Agent"].split()[0] == f"geonode-cli/{__version__}"