whereq.cloud 0.1.0__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.
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .mypy_cache/
9
+ .ruff_cache/
10
+ .venv-sdk/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WhereQ
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.5
2
+ Name: whereq.cloud
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the WhereQ data cloud (api.whereq.cloud)
5
+ Project-URL: Homepage, https://whereq.cloud
6
+ Project-URL: Documentation, https://api.whereq.cloud/docs
7
+ Project-URL: Repository, https://github.com/whereq/whereq-cloud-python
8
+ Author-email: WhereQ <whereq@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: api,cost-of-living,data,finance,prices,trending,whereq
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Requires-Python: >=3.9
18
+ Requires-Dist: httpx>=0.27
19
+ Description-Content-Type: text/markdown
20
+
21
+ # whereq.cloud — Python SDK
22
+
23
+ Official Python client for the [WhereQ data cloud](https://whereq.cloud) — the versioned,
24
+ metered `/v1` API at **`api.whereq.cloud`**: cost-of-living prices, a cross-region
25
+ cost-of-living comparison, trending hot-lists, autos, equities & market data, and more.
26
+
27
+ Public endpoints work with no key; metered endpoints take an API key.
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ pip install whereq.cloud
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ```python
38
+ from whereq_cloud import Client
39
+
40
+ wq = Client() # public access
41
+ # wq = Client(api_key="wq_live_…") # metered tier
42
+
43
+ # Cost of living — compare US states, CA provinces, or metros (by rent-series id)
44
+ print(wq.cost_of_living("us:California,ca:Ontario,m:3958"))
45
+
46
+ # Prices — fuel | food | energy | housing | rent
47
+ print(wq.prices(domain="rent", region="us", bedrooms=2, limit=10))
48
+ print(wq.price(3958)) # one series + full history
49
+
50
+ # Bulk CSV export
51
+ csv_text = wq.prices_csv(domain="fuel", region="us")
52
+
53
+ # Discovery
54
+ wq.catalog(); wq.categories(); wq.regions(); wq.domains()
55
+
56
+ # Finance
57
+ wq.hotstocks(limit=5)
58
+ wq.screener(sector="Technology")
59
+
60
+ # Escape hatch — call any /v1 endpoint directly
61
+ wq.get("/v1/trending", limit=10)
62
+ ```
63
+
64
+ Use it as a context manager to close the HTTP connection pool:
65
+
66
+ ```python
67
+ with Client(api_key="wq_live_…") as wq:
68
+ data = wq.prices(domain="energy")
69
+ ```
70
+
71
+ Errors raise `whereq_cloud.WhereqError` (with `.status`, `.message`, `.url`).
72
+
73
+ ## License
74
+
75
+ MIT © WhereQ
@@ -0,0 +1,55 @@
1
+ # whereq.cloud — Python SDK
2
+
3
+ Official Python client for the [WhereQ data cloud](https://whereq.cloud) — the versioned,
4
+ metered `/v1` API at **`api.whereq.cloud`**: cost-of-living prices, a cross-region
5
+ cost-of-living comparison, trending hot-lists, autos, equities & market data, and more.
6
+
7
+ Public endpoints work with no key; metered endpoints take an API key.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install whereq.cloud
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```python
18
+ from whereq_cloud import Client
19
+
20
+ wq = Client() # public access
21
+ # wq = Client(api_key="wq_live_…") # metered tier
22
+
23
+ # Cost of living — compare US states, CA provinces, or metros (by rent-series id)
24
+ print(wq.cost_of_living("us:California,ca:Ontario,m:3958"))
25
+
26
+ # Prices — fuel | food | energy | housing | rent
27
+ print(wq.prices(domain="rent", region="us", bedrooms=2, limit=10))
28
+ print(wq.price(3958)) # one series + full history
29
+
30
+ # Bulk CSV export
31
+ csv_text = wq.prices_csv(domain="fuel", region="us")
32
+
33
+ # Discovery
34
+ wq.catalog(); wq.categories(); wq.regions(); wq.domains()
35
+
36
+ # Finance
37
+ wq.hotstocks(limit=5)
38
+ wq.screener(sector="Technology")
39
+
40
+ # Escape hatch — call any /v1 endpoint directly
41
+ wq.get("/v1/trending", limit=10)
42
+ ```
43
+
44
+ Use it as a context manager to close the HTTP connection pool:
45
+
46
+ ```python
47
+ with Client(api_key="wq_live_…") as wq:
48
+ data = wq.prices(domain="energy")
49
+ ```
50
+
51
+ Errors raise `whereq_cloud.WhereqError` (with `.status`, `.message`, `.url`).
52
+
53
+ ## License
54
+
55
+ MIT © WhereQ
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "whereq.cloud"
7
+ version = "0.1.0"
8
+ description = "Official Python SDK for the WhereQ data cloud (api.whereq.cloud)"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.9"
12
+ authors = [{ name = "WhereQ", email = "whereq@gmail.com" }]
13
+ keywords = ["whereq", "data", "api", "cost-of-living", "prices", "trending", "finance"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Topic :: Software Development :: Libraries :: Python Modules",
20
+ ]
21
+ dependencies = ["httpx>=0.27"]
22
+
23
+ [project.urls]
24
+ Homepage = "https://whereq.cloud"
25
+ Documentation = "https://api.whereq.cloud/docs"
26
+ Repository = "https://github.com/whereq/whereq-cloud-python"
27
+
28
+ [tool.hatch.build.targets.wheel]
29
+ packages = ["src/whereq_cloud"]
30
+
31
+ [tool.hatch.build.targets.sdist]
32
+ include = ["src/whereq_cloud", "README.md", "LICENSE"]
@@ -0,0 +1,4 @@
1
+ """whereq.cloud — official Python SDK for the WhereQ data cloud (api.whereq.cloud)."""
2
+ from whereq_cloud.client import Client, WhereqError, DEFAULT_BASE_URL, __version__
3
+
4
+ __all__ = ["Client", "WhereqError", "DEFAULT_BASE_URL", "__version__"]
@@ -0,0 +1,152 @@
1
+ """whereq.cloud — official Python SDK for the WhereQ data cloud.
2
+
3
+ A thin, typed-ish wrapper over the versioned ``/v1`` HTTP API at ``api.whereq.cloud``.
4
+ Public endpoints work with no key; metered endpoints take a ``X-API-Key``.
5
+
6
+ from whereq_cloud import Client
7
+
8
+ wq = Client() # public access
9
+ wq = Client(api_key="wq_live_…") # metered tier
10
+
11
+ wq.cost_of_living("us:California,ca:Ontario")
12
+ wq.prices(domain="rent", region="us", bedrooms=2)
13
+ wq.get("/v1/trending", limit=10) # escape hatch for any endpoint
14
+ """
15
+ from __future__ import annotations
16
+
17
+ from typing import Any, Optional
18
+
19
+ import httpx
20
+
21
+ __version__ = "0.1.0"
22
+ DEFAULT_BASE_URL = "https://api.whereq.cloud"
23
+
24
+
25
+ class WhereqError(Exception):
26
+ """Raised on a non-2xx API response."""
27
+
28
+ def __init__(self, status: int, message: str, url: str) -> None:
29
+ self.status = status
30
+ self.url = url
31
+ self.message = message
32
+ super().__init__(f"whereq.cloud API error {status} for {url}: {message}")
33
+
34
+
35
+ class Client:
36
+ """Synchronous client for the whereq.cloud Data API.
37
+
38
+ Args:
39
+ api_key: optional ``wq_live_…`` key for metered endpoints (sent as ``X-API-Key``).
40
+ base_url: override the API base (default ``https://api.whereq.cloud``).
41
+ timeout: per-request timeout in seconds.
42
+ """
43
+
44
+ def __init__(self, api_key: Optional[str] = None, base_url: str = DEFAULT_BASE_URL,
45
+ timeout: float = 30.0) -> None:
46
+ headers = {"Accept": "application/json",
47
+ "User-Agent": f"whereq.cloud-python/{__version__}"}
48
+ if api_key:
49
+ headers["X-API-Key"] = api_key
50
+ self._http = httpx.Client(base_url=base_url.rstrip("/"), headers=headers, timeout=timeout)
51
+
52
+ # -- lifecycle -----------------------------------------------------------
53
+ def close(self) -> None:
54
+ self._http.close()
55
+
56
+ def __enter__(self) -> "Client":
57
+ return self
58
+
59
+ def __exit__(self, *_exc: Any) -> None:
60
+ self.close()
61
+
62
+ # -- core ----------------------------------------------------------------
63
+ def get(self, path: str, **params: Any) -> Any:
64
+ """GET any endpoint. ``None`` params are dropped. Returns parsed JSON."""
65
+ clean = {k: v for k, v in params.items() if v is not None}
66
+ r = self._http.get(path, params=clean)
67
+ if r.status_code >= 400:
68
+ try:
69
+ msg = r.json().get("detail") or r.text
70
+ except Exception: # noqa: BLE001
71
+ msg = r.text
72
+ raise WhereqError(r.status_code, msg, str(r.url))
73
+ return r.json()
74
+
75
+ def get_text(self, path: str, **params: Any) -> str:
76
+ """GET a non-JSON endpoint (e.g. CSV export) as text."""
77
+ clean = {k: v for k, v in params.items() if v is not None}
78
+ r = self._http.get(path, params=clean)
79
+ if r.status_code >= 400:
80
+ raise WhereqError(r.status_code, r.text, str(r.url))
81
+ return r.text
82
+
83
+ # -- prices / cost of living --------------------------------------------
84
+ def prices(self, domain: Optional[str] = None, region: Optional[str] = None,
85
+ bedrooms: Optional[int] = None, q: Optional[str] = None,
86
+ limit: int = 60, offset: int = 0) -> Any:
87
+ """Cost-of-living price series (fuel | food | energy | housing | rent)."""
88
+ return self.get("/v1/prices", domain=domain, region=region, bedrooms=bedrooms,
89
+ q=q, limit=limit, offset=offset)
90
+
91
+ def price(self, series_id: int) -> Any:
92
+ """One price series with its full history."""
93
+ return self.get(f"/v1/prices/{series_id}")
94
+
95
+ def prices_csv(self, domain: Optional[str] = None, region: Optional[str] = None,
96
+ bedrooms: Optional[int] = None, q: Optional[str] = None) -> str:
97
+ """Bulk CSV export of matching price series."""
98
+ return self.get_text("/v1/prices/export", domain=domain, region=region,
99
+ bedrooms=bedrooms, q=q)
100
+
101
+ def cost_of_living(self, places: str) -> Any:
102
+ """Compare cost of living across US states / CA provinces / metros.
103
+
104
+ ``places``: comma-separated ``region:name`` or ``m:<rent-series-id>``,
105
+ e.g. ``"us:California,ca:Ontario,m:3958"``.
106
+ """
107
+ return self.get("/v1/cost-of-living", places=places)
108
+
109
+ # -- discovery / facets --------------------------------------------------
110
+ def catalog(self) -> Any:
111
+ return self.get("/v1/catalog")
112
+
113
+ def categories(self) -> Any:
114
+ return self.get("/v1/categories")
115
+
116
+ def regions(self) -> Any:
117
+ return self.get("/v1/regions")
118
+
119
+ def domains(self) -> Any:
120
+ return self.get("/v1/domains")
121
+
122
+ def trending(self, **params: Any) -> Any:
123
+ return self.get("/v1/trending", **params)
124
+
125
+ # -- finance -------------------------------------------------------------
126
+ def hotstocks(self, limit: int = 20) -> Any:
127
+ return self.get("/v1/hotstocks", limit=limit)
128
+
129
+ def quotes(self, **params: Any) -> Any:
130
+ return self.get("/v1/quotes", **params)
131
+
132
+ def news(self, **params: Any) -> Any:
133
+ return self.get("/v1/news", **params)
134
+
135
+ def screener(self, **params: Any) -> Any:
136
+ return self.get("/v1/screener", **params)
137
+
138
+ def search(self, q: str, **params: Any) -> Any:
139
+ return self.get("/v1/search", q=q, **params)
140
+
141
+ # -- autos ---------------------------------------------------------------
142
+ def autos_recalls(self, **params: Any) -> Any:
143
+ return self.get("/v1/autos/recalls", **params)
144
+
145
+ def autos_listings(self, **params: Any) -> Any:
146
+ return self.get("/v1/autos/listings", **params)
147
+
148
+ def autos_fuel_economy(self, **params: Any) -> Any:
149
+ return self.get("/v1/autos/fuel-economy", **params)
150
+
151
+ def autos_models(self, **params: Any) -> Any:
152
+ return self.get("/v1/autos/models", **params)