aisles-client 1.0.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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aisles Inc.
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,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: aisles-client
3
+ Version: 1.0.0
4
+ Summary: Python client for Aisles: is a product in stock at stores near a US city or ZIP, with the store, price and the time Aisles checked. Read-only, no key.
5
+ Author: Aisles Inc.
6
+ License: MIT
7
+ Project-URL: Homepage, https://aislesinventory.com
8
+ Project-URL: Documentation, https://aislesinventory.com/developers
9
+ Project-URL: Source, https://github.com/aislesinventory/aisles
10
+ Keywords: aisles,aislesinventory,local inventory,in stock,shopping,sdk
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
18
+
19
+ # aisles-client (Python)
20
+
21
+ Python client for [Aisles](https://aislesinventory.com): whether a product is in stock at stores near a covered US city or ZIP, with the store, price and the time Aisles last checked. Read-only, free, no key. Standard library only.
22
+
23
+ ```
24
+ pip install aisles-client
25
+ ```
26
+
27
+ ```python
28
+ from aisles_client import Aisles
29
+
30
+ r = Aisles().search("oat milk", city="chicago", availability="available")
31
+ for l in r["results"]:
32
+ print(l["summary"], l["links"]["aisles_offer_url"])
33
+ ```
34
+
35
+ Also `search_batch([...])`, `ask("oat milk in Chicago")` and `locations("TX")`, and a command line: `aisles-py search "oat milk" --city chicago`.
36
+
37
+ Docs: https://aislesinventory.com/developers · Source: https://github.com/aislesinventory/aisles
@@ -0,0 +1,19 @@
1
+ # aisles-client (Python)
2
+
3
+ Python client for [Aisles](https://aislesinventory.com): whether a product is in stock at stores near a covered US city or ZIP, with the store, price and the time Aisles last checked. Read-only, free, no key. Standard library only.
4
+
5
+ ```
6
+ pip install aisles-client
7
+ ```
8
+
9
+ ```python
10
+ from aisles_client import Aisles
11
+
12
+ r = Aisles().search("oat milk", city="chicago", availability="available")
13
+ for l in r["results"]:
14
+ print(l["summary"], l["links"]["aisles_offer_url"])
15
+ ```
16
+
17
+ Also `search_batch([...])`, `ask("oat milk in Chicago")` and `locations("TX")`, and a command line: `aisles-py search "oat milk" --city chicago`.
18
+
19
+ Docs: https://aislesinventory.com/developers · Source: https://github.com/aislesinventory/aisles
@@ -0,0 +1,64 @@
1
+ """Client for Aisles (https://aislesinventory.com): whether a product is in stock at stores near a
2
+ covered US city or ZIP, with the store, price and the time Aisles last checked. Read-only, no key.
3
+
4
+ from aisles_client import Aisles
5
+ r = Aisles().search("oat milk", city="chicago", availability="available")
6
+ """
7
+ import json
8
+ import urllib.error
9
+ import urllib.parse
10
+ import urllib.request
11
+
12
+ __version__ = "1.0.0"
13
+ DEFAULT_BASE = "https://aislesinventory.com"
14
+
15
+
16
+ class AislesError(Exception):
17
+ def __init__(self, code, message, status=0):
18
+ super().__init__(f"{code} ({status}): {message}")
19
+ self.code, self.message, self.status = code, message, status
20
+
21
+
22
+ class Aisles:
23
+ def __init__(self, base_url=DEFAULT_BASE, timeout=30):
24
+ self.base_url = base_url.rstrip("/")
25
+ self.timeout = timeout
26
+
27
+ def _request(self, path, body=None):
28
+ data = json.dumps(body).encode() if body is not None else None
29
+ req = urllib.request.Request(self.base_url + path, data=data, method="POST" if data else "GET",
30
+ headers={"Accept": "application/json", "Content-Type": "application/json",
31
+ "User-Agent": f"aisles-python/{__version__}"})
32
+ try:
33
+ with urllib.request.urlopen(req, timeout=self.timeout) as res:
34
+ return json.loads(res.read().decode())
35
+ except urllib.error.HTTPError as e:
36
+ try:
37
+ err = json.loads(e.read().decode()).get("error", {})
38
+ except ValueError:
39
+ err = {}
40
+ raise AislesError(err.get("code", "http_error"), err.get("message", str(e)), e.code) from None
41
+
42
+ def search(self, q, city=None, zip=None, availability=None, fulfillment=None, max_price=None, per_page=None, cursor=None):
43
+ """Listings for a product near a covered city or ZIP: {"pagination": {...}, "results": [...]}."""
44
+ params = {"q": q, "city": city, "zip": zip, "availability": availability,
45
+ "fulfillment": ",".join(fulfillment) if isinstance(fulfillment, (list, tuple)) else fulfillment,
46
+ "max_price": max_price, "per_page": per_page, "cursor": cursor}
47
+ return self._request("/api/v1/search?" + urllib.parse.urlencode({k: v for k, v in params.items() if v is not None}))
48
+
49
+ def search_batch(self, queries):
50
+ """Up to 10 searches at once, each a dict like {"q": "oat milk", "city": "chicago"}."""
51
+ return self._request("/api/v1/search/batch", {"queries": queries})
52
+
53
+ def ask(self, question):
54
+ """A question in plain words ("oat milk in Chicago"): NLWeb {"query_id", "results"}."""
55
+ return self._request("/ask?" + urllib.parse.urlencode({"query": question}))
56
+
57
+ def locations(self, filter=None):
58
+ """Covered metros; filter narrows them, e.g. "TX" or "Kroger"."""
59
+ args = {"filter": filter} if filter else {}
60
+ reply = self._request("/mcp", {"jsonrpc": "2.0", "id": 1, "method": "tools/call",
61
+ "params": {"name": "list_locations", "arguments": args}})
62
+ if "error" in reply:
63
+ raise AislesError("mcp_error", reply["error"].get("message", ""))
64
+ return reply["result"].get("structuredContent", {}).get("locations", [])
@@ -0,0 +1,49 @@
1
+ """aisles-py: look up local store stock from the command line.
2
+
3
+ aisles-py search "oat milk" --city chicago --in-stock
4
+ aisles-py ask "where can I buy eggs near 60614"
5
+ aisles-py cities TX
6
+ """
7
+ import argparse
8
+ import json
9
+ import sys
10
+
11
+ from . import Aisles, AislesError
12
+
13
+
14
+ def main(argv=None):
15
+ p = argparse.ArgumentParser(prog="aisles-py", description="Local store stock from Aisles (https://aislesinventory.com).")
16
+ sub = p.add_subparsers(dest="cmd", required=True)
17
+ s = sub.add_parser("search")
18
+ s.add_argument("words", nargs="+")
19
+ s.add_argument("--city")
20
+ s.add_argument("--zip")
21
+ s.add_argument("--in-stock", action="store_true")
22
+ s.add_argument("--limit", type=int, default=5)
23
+ a = sub.add_parser("ask")
24
+ a.add_argument("words", nargs="+")
25
+ c = sub.add_parser("cities")
26
+ c.add_argument("filter", nargs="*")
27
+ p.add_argument("--json", action="store_true")
28
+ args = p.parse_args(argv)
29
+ client = Aisles()
30
+ try:
31
+ if args.cmd == "search":
32
+ out = client.search(" ".join(args.words), city=args.city, zip=args.zip,
33
+ availability="available" if args.in_stock else None, per_page=args.limit)
34
+ rows = [f"{r['summary']}\n {r['links']['aisles_offer_url']}" for r in out["results"]] or ["No matching listings."]
35
+ elif args.cmd == "ask":
36
+ out = client.ask(" ".join(args.words))
37
+ rows = ([out["message"]] if out.get("message") else []) + [f"{r['description']}\n {r['url']}" for r in out["results"]]
38
+ else:
39
+ out = client.locations(" ".join(args.filter) or None)
40
+ rows = [f"{l['name']} ({l['slug']}): {l['stores']} stores" for l in out] or ["No covered metro matches."]
41
+ except AislesError as e:
42
+ print(f"aisles-py: {e}", file=sys.stderr)
43
+ return 1
44
+ print(json.dumps(out, indent=2) if args.json else "\n\n".join(rows))
45
+ return 0
46
+
47
+
48
+ if __name__ == "__main__":
49
+ sys.exit(main())
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: aisles-client
3
+ Version: 1.0.0
4
+ Summary: Python client for Aisles: is a product in stock at stores near a US city or ZIP, with the store, price and the time Aisles checked. Read-only, no key.
5
+ Author: Aisles Inc.
6
+ License: MIT
7
+ Project-URL: Homepage, https://aislesinventory.com
8
+ Project-URL: Documentation, https://aislesinventory.com/developers
9
+ Project-URL: Source, https://github.com/aislesinventory/aisles
10
+ Keywords: aisles,aislesinventory,local inventory,in stock,shopping,sdk
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
18
+
19
+ # aisles-client (Python)
20
+
21
+ Python client for [Aisles](https://aislesinventory.com): whether a product is in stock at stores near a covered US city or ZIP, with the store, price and the time Aisles last checked. Read-only, free, no key. Standard library only.
22
+
23
+ ```
24
+ pip install aisles-client
25
+ ```
26
+
27
+ ```python
28
+ from aisles_client import Aisles
29
+
30
+ r = Aisles().search("oat milk", city="chicago", availability="available")
31
+ for l in r["results"]:
32
+ print(l["summary"], l["links"]["aisles_offer_url"])
33
+ ```
34
+
35
+ Also `search_batch([...])`, `ask("oat milk in Chicago")` and `locations("TX")`, and a command line: `aisles-py search "oat milk" --city chicago`.
36
+
37
+ Docs: https://aislesinventory.com/developers · Source: https://github.com/aislesinventory/aisles
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ aisles_client/__init__.py
5
+ aisles_client/cli.py
6
+ aisles_client.egg-info/PKG-INFO
7
+ aisles_client.egg-info/SOURCES.txt
8
+ aisles_client.egg-info/dependency_links.txt
9
+ aisles_client.egg-info/entry_points.txt
10
+ aisles_client.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ aisles-py = aisles_client.cli:main
@@ -0,0 +1 @@
1
+ aisles_client
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "aisles-client"
7
+ version = "1.0.0"
8
+ description = "Python client for Aisles: is a product in stock at stores near a US city or ZIP, with the store, price and the time Aisles checked. Read-only, no key."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ authors = [{ name = "Aisles Inc." }]
12
+ requires-python = ">=3.8"
13
+ keywords = ["aisles", "aislesinventory", "local inventory", "in stock", "shopping", "sdk"]
14
+ classifiers = ["Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent"]
15
+
16
+ [project.urls]
17
+ Homepage = "https://aislesinventory.com"
18
+ Documentation = "https://aislesinventory.com/developers"
19
+ Source = "https://github.com/aislesinventory/aisles"
20
+
21
+ [project.scripts]
22
+ aisles-py = "aisles_client.cli:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+