synoppy 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,5 @@
1
+ node_modules/
2
+ dist/
3
+ *.tsbuildinfo
4
+ __pycache__/
5
+ *.egg-info/
synoppy-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Saanora
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.
synoppy-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: synoppy
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for the Synoppy web-data API — scrape, screenshot, crawl, map, extract, classify, enrich, and images.
5
+ Project-URL: Homepage, https://synoppy.com
6
+ Project-URL: Documentation, https://synoppy.com/docs/sdks
7
+ Project-URL: Repository, https://github.com/Synoppy/synoppy-python
8
+ Project-URL: Issues, https://github.com/Synoppy/synoppy-python/issues
9
+ Author-email: Saanora <support@synoppy.com>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: agents,crawler,llm,markdown,rag,scraping,synoppy,web-data
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Requires-Python: >=3.8
23
+ Requires-Dist: requests>=2.25
24
+ Description-Content-Type: text/markdown
25
+
26
+ # synoppy (Python)
27
+
28
+ [![PyPI](https://img.shields.io/pypi/v/synoppy.svg)](https://pypi.org/project/synoppy/) [![Python](https://img.shields.io/pypi/pyversions/synoppy.svg)](https://pypi.org/project/synoppy/)
29
+
30
+ **Give your AI agents the whole web.** Synoppy is the web-data layer for AI agents — one key to **read, crawl, map, extract, classify & enrich** any site, plus screenshots and image scraping. Clean, structured, LLM-ready data, with no scraping stack to run.
31
+
32
+ [**Get a free key →**](https://synoppy.com/dashboard) · [Docs](https://synoppy.com/docs) · [synoppy.com](https://synoppy.com)
33
+
34
+ ```bash
35
+ pip install synoppy
36
+ ```
37
+
38
+ ## Quickstart
39
+
40
+ ```python
41
+ import os
42
+ from synoppy import Synoppy
43
+
44
+ client = Synoppy(api_key=os.environ["SYNOPPY_API_KEY"])
45
+
46
+ # Read any URL → clean markdown (force JS rendering + settle delay)
47
+ page = client.read(
48
+ "https://stripe.com/blog",
49
+ formats=["markdown"],
50
+ render="auto",
51
+ wait_ms=500,
52
+ )
53
+ print(page["markdown"])
54
+ print(page["metadata"]["rendered"], page["metadata"]["bytesIn"])
55
+
56
+ # Screenshot a URL → PNG data URL
57
+ shot = client.screenshot("https://stripe.com", full_page=True)
58
+ print(shot["screenshot"][:40], shot["statusCode"])
59
+
60
+ # Crawl a site
61
+ site = client.crawl("https://example.com", limit=25)
62
+ print(site["count"], "of", site["discovered"], "pages")
63
+
64
+ # AI structured extraction (prompt, a.k.a. instruction)
65
+ result = client.extract("https://news.ycombinator.com", prompt="Return { title, summary, topics }")
66
+ print(result["data"], result["usage"])
67
+
68
+ # Brand intelligence — from a url, a domain, or a work email
69
+ brand = client.enrich(domain="linear.app")
70
+ print(brand["colors"], brand["fonts"], brand["socials"])
71
+ ```
72
+
73
+ ## Credits
74
+
75
+ Every successful response includes `creditsUsed` (number) and
76
+ `creditsRemaining` (number or `None`) so you can track metered usage:
77
+
78
+ ```python
79
+ page = client.read("https://stripe.com")
80
+ print("used", page["creditsUsed"], "remaining", page["creditsRemaining"])
81
+ ```
82
+
83
+ ## Methods
84
+
85
+ | Method | Endpoint | Notes |
86
+ | --- | --- | --- |
87
+ | `read(url, formats=, only_main_content=, timeout_ms=, render=, wait_ms=)` / `scrape(...)` | `POST /api/scrape` | `render` is `True`/`False`/`"auto"` |
88
+ | `screenshot(url, full_page=, wait_ms=, timeout_ms=)` | `POST /api/screenshot` | returns a PNG data URL; can 503 `RENDER_UNAVAILABLE` |
89
+ | `crawl(url, limit=)` | `POST /api/crawl` | `limit` 1–25 · requires a key |
90
+ | `map(url)` / `sitemap(url)` | `POST /api/map` | |
91
+ | `extract(url, prompt=, instruction=)` | `POST /api/extract` | `instruction` aliases `prompt` · AI · requires a key |
92
+ | `classify(url, labels=)` | `POST /api/classify` | NAICS/SIC by default, or your own `labels` · AI · requires a key |
93
+ | `enrich(url=, domain=, email=)` / `brand(...)` | `POST /api/brand` | pass one of url / domain / work email |
94
+ | `images(url)` | `POST /api/images` | |
95
+
96
+ Every response also carries `creditsUsed` and `creditsRemaining`.
97
+
98
+ `act()` is **coming soon** — `/api/act` is not live yet, and calling this
99
+ method raises `NotImplementedError`.
100
+
101
+ ## Errors
102
+
103
+ ```python
104
+ from synoppy import SynoppyError
105
+
106
+ try:
107
+ client.crawl("https://example.com")
108
+ except SynoppyError as err:
109
+ print(err.code, err.status, err)
110
+ ```
111
+
112
+ MIT licensed.
@@ -0,0 +1,87 @@
1
+ # synoppy (Python)
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/synoppy.svg)](https://pypi.org/project/synoppy/) [![Python](https://img.shields.io/pypi/pyversions/synoppy.svg)](https://pypi.org/project/synoppy/)
4
+
5
+ **Give your AI agents the whole web.** Synoppy is the web-data layer for AI agents — one key to **read, crawl, map, extract, classify & enrich** any site, plus screenshots and image scraping. Clean, structured, LLM-ready data, with no scraping stack to run.
6
+
7
+ [**Get a free key →**](https://synoppy.com/dashboard) · [Docs](https://synoppy.com/docs) · [synoppy.com](https://synoppy.com)
8
+
9
+ ```bash
10
+ pip install synoppy
11
+ ```
12
+
13
+ ## Quickstart
14
+
15
+ ```python
16
+ import os
17
+ from synoppy import Synoppy
18
+
19
+ client = Synoppy(api_key=os.environ["SYNOPPY_API_KEY"])
20
+
21
+ # Read any URL → clean markdown (force JS rendering + settle delay)
22
+ page = client.read(
23
+ "https://stripe.com/blog",
24
+ formats=["markdown"],
25
+ render="auto",
26
+ wait_ms=500,
27
+ )
28
+ print(page["markdown"])
29
+ print(page["metadata"]["rendered"], page["metadata"]["bytesIn"])
30
+
31
+ # Screenshot a URL → PNG data URL
32
+ shot = client.screenshot("https://stripe.com", full_page=True)
33
+ print(shot["screenshot"][:40], shot["statusCode"])
34
+
35
+ # Crawl a site
36
+ site = client.crawl("https://example.com", limit=25)
37
+ print(site["count"], "of", site["discovered"], "pages")
38
+
39
+ # AI structured extraction (prompt, a.k.a. instruction)
40
+ result = client.extract("https://news.ycombinator.com", prompt="Return { title, summary, topics }")
41
+ print(result["data"], result["usage"])
42
+
43
+ # Brand intelligence — from a url, a domain, or a work email
44
+ brand = client.enrich(domain="linear.app")
45
+ print(brand["colors"], brand["fonts"], brand["socials"])
46
+ ```
47
+
48
+ ## Credits
49
+
50
+ Every successful response includes `creditsUsed` (number) and
51
+ `creditsRemaining` (number or `None`) so you can track metered usage:
52
+
53
+ ```python
54
+ page = client.read("https://stripe.com")
55
+ print("used", page["creditsUsed"], "remaining", page["creditsRemaining"])
56
+ ```
57
+
58
+ ## Methods
59
+
60
+ | Method | Endpoint | Notes |
61
+ | --- | --- | --- |
62
+ | `read(url, formats=, only_main_content=, timeout_ms=, render=, wait_ms=)` / `scrape(...)` | `POST /api/scrape` | `render` is `True`/`False`/`"auto"` |
63
+ | `screenshot(url, full_page=, wait_ms=, timeout_ms=)` | `POST /api/screenshot` | returns a PNG data URL; can 503 `RENDER_UNAVAILABLE` |
64
+ | `crawl(url, limit=)` | `POST /api/crawl` | `limit` 1–25 · requires a key |
65
+ | `map(url)` / `sitemap(url)` | `POST /api/map` | |
66
+ | `extract(url, prompt=, instruction=)` | `POST /api/extract` | `instruction` aliases `prompt` · AI · requires a key |
67
+ | `classify(url, labels=)` | `POST /api/classify` | NAICS/SIC by default, or your own `labels` · AI · requires a key |
68
+ | `enrich(url=, domain=, email=)` / `brand(...)` | `POST /api/brand` | pass one of url / domain / work email |
69
+ | `images(url)` | `POST /api/images` | |
70
+
71
+ Every response also carries `creditsUsed` and `creditsRemaining`.
72
+
73
+ `act()` is **coming soon** — `/api/act` is not live yet, and calling this
74
+ method raises `NotImplementedError`.
75
+
76
+ ## Errors
77
+
78
+ ```python
79
+ from synoppy import SynoppyError
80
+
81
+ try:
82
+ client.crawl("https://example.com")
83
+ except SynoppyError as err:
84
+ print(err.code, err.status, err)
85
+ ```
86
+
87
+ MIT licensed.
@@ -0,0 +1,37 @@
1
+ [project]
2
+ name = "synoppy"
3
+ version = "1.0.0"
4
+ description = "Official Python SDK for the Synoppy web-data API — scrape, screenshot, crawl, map, extract, classify, enrich, and images."
5
+ readme = "README.md"
6
+ requires-python = ">=3.8"
7
+ license = { text = "MIT" }
8
+ authors = [{ name = "Saanora", email = "support@synoppy.com" }]
9
+ dependencies = ["requests>=2.25"]
10
+ keywords = ["synoppy", "scraping", "crawler", "web-data", "markdown", "llm", "agents", "rag"]
11
+ classifiers = [
12
+ "Development Status :: 5 - Production/Stable",
13
+ "Intended Audience :: Developers",
14
+ "License :: OSI Approved :: MIT License",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.8",
17
+ "Programming Language :: Python :: 3.9",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ ]
22
+
23
+ [project.urls]
24
+ Homepage = "https://synoppy.com"
25
+ Documentation = "https://synoppy.com/docs/sdks"
26
+ Repository = "https://github.com/Synoppy/synoppy-python"
27
+ Issues = "https://github.com/Synoppy/synoppy-python/issues"
28
+
29
+ [build-system]
30
+ requires = ["hatchling"]
31
+ build-backend = "hatchling.build"
32
+
33
+ [tool.hatch.build]
34
+ exclude = ["**/__pycache__", "*.pyc"]
35
+
36
+ [tool.hatch.build.targets.wheel]
37
+ packages = ["synoppy"]
@@ -0,0 +1,233 @@
1
+ """Official Python SDK for the Synoppy web-data API.
2
+
3
+ One key for scrape, screenshot, crawl, map, extract, classify, enrich,
4
+ and images. Every successful response includes ``creditsUsed`` and
5
+ ``creditsRemaining`` so you can track metered usage.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import json as _json
10
+ from typing import Any, Dict, List, Optional, Union
11
+
12
+ import requests
13
+
14
+ __version__ = "1.0.0"
15
+ DEFAULT_BASE_URL = "https://synoppy.com"
16
+
17
+
18
+ class SynoppyError(Exception):
19
+ """Raised when the API returns an error response."""
20
+
21
+ def __init__(self, message: str, code: str, status: int) -> None:
22
+ super().__init__(message)
23
+ self.code = code
24
+ self.status = status
25
+
26
+
27
+ class Synoppy:
28
+ """Synoppy API client.
29
+
30
+ Example:
31
+ >>> from synoppy import Synoppy
32
+ >>> client = Synoppy(api_key="syn_live_...")
33
+ >>> page = client.read("https://stripe.com/blog", formats=["markdown"])
34
+ >>> print(page["markdown"])
35
+ """
36
+
37
+ def __init__(
38
+ self,
39
+ api_key: str,
40
+ base_url: str = DEFAULT_BASE_URL,
41
+ timeout: float = 60.0,
42
+ ) -> None:
43
+ if not api_key:
44
+ raise ValueError("Synoppy: api_key is required")
45
+ self.api_key = api_key
46
+ self.base_url = base_url.rstrip("/")
47
+ self.timeout = timeout
48
+ self._session = requests.Session()
49
+ self._session.headers.update(
50
+ {
51
+ "Authorization": "Bearer " + api_key,
52
+ "Content-Type": "application/json",
53
+ "User-Agent": "synoppy-python/" + __version__,
54
+ }
55
+ )
56
+
57
+ def _request(self, path: str, body: Dict[str, Any]) -> Dict[str, Any]:
58
+ resp = self._session.post(
59
+ self.base_url + path, data=_json.dumps(body), timeout=self.timeout
60
+ )
61
+ try:
62
+ data = resp.json()
63
+ except ValueError:
64
+ data = {}
65
+ if not resp.ok or data.get("success") is False:
66
+ raise SynoppyError(
67
+ data.get("error", "HTTP %s" % resp.status_code),
68
+ data.get("code", "ERROR"),
69
+ resp.status_code,
70
+ )
71
+ return data
72
+
73
+ # --- Endpoints -----------------------------------------------------------
74
+
75
+ def read(
76
+ self,
77
+ url: str,
78
+ formats: Optional[List[str]] = None,
79
+ only_main_content: Optional[bool] = None,
80
+ timeout_ms: Optional[int] = None,
81
+ render: Optional[Union[bool, str]] = None,
82
+ wait_ms: Optional[int] = None,
83
+ ) -> Dict[str, Any]:
84
+ """Read a URL → clean markdown / HTML / text.
85
+
86
+ ``render`` may be ``True``/``False`` or ``"auto"`` to control JS
87
+ rendering; ``wait_ms`` adds a settle delay before capture. The
88
+ response includes ``metadata`` (title, description, language,
89
+ siteName, author, ogImage, sourceUrl, statusCode, wordCount,
90
+ fetchedAt, rendered, bytesIn), the requested ``markdown``/``html``/
91
+ ``text``, ``renderMs``, ``latencyMs``, ``creditsUsed``, and
92
+ ``creditsRemaining``.
93
+ """
94
+ body: Dict[str, Any] = {"url": url}
95
+ if formats is not None:
96
+ body["formats"] = formats
97
+ if only_main_content is not None:
98
+ body["onlyMainContent"] = only_main_content
99
+ if timeout_ms is not None:
100
+ body["timeoutMs"] = timeout_ms
101
+ if render is not None:
102
+ body["render"] = render
103
+ if wait_ms is not None:
104
+ body["waitMs"] = wait_ms
105
+ return self._request("/api/scrape", body)
106
+
107
+ scrape = read
108
+
109
+ def screenshot(
110
+ self,
111
+ url: str,
112
+ full_page: Optional[bool] = None,
113
+ wait_ms: Optional[int] = None,
114
+ timeout_ms: Optional[int] = None,
115
+ ) -> Dict[str, Any]:
116
+ """Capture a PNG screenshot of a URL.
117
+
118
+ Returns ``screenshot`` (a PNG data URL) alongside ``sourceUrl``,
119
+ ``statusCode``, ``fullPage``, ``latencyMs``, ``creditsUsed``, and
120
+ ``creditsRemaining``. Raises :class:`SynoppyError` with code
121
+ ``RENDER_UNAVAILABLE`` (status 503) if rendering is unavailable.
122
+ """
123
+ body: Dict[str, Any] = {"url": url}
124
+ if full_page is not None:
125
+ body["fullPage"] = full_page
126
+ if wait_ms is not None:
127
+ body["waitMs"] = wait_ms
128
+ if timeout_ms is not None:
129
+ body["timeoutMs"] = timeout_ms
130
+ return self._request("/api/screenshot", body)
131
+
132
+ def crawl(self, url: str, limit: Optional[int] = None) -> Dict[str, Any]:
133
+ """Crawl a site → one clean page per URL discovered (requires a key)."""
134
+ body: Dict[str, Any] = {"url": url}
135
+ if limit is not None:
136
+ body["limit"] = limit
137
+ return self._request("/api/crawl", body)
138
+
139
+ def map(self, url: str) -> Dict[str, Any]:
140
+ """Discover every URL on a domain."""
141
+ return self._request("/api/map", {"url": url})
142
+
143
+ sitemap = map
144
+
145
+ def extract(
146
+ self,
147
+ url: str,
148
+ prompt: Optional[str] = None,
149
+ instruction: Optional[str] = None,
150
+ ) -> Dict[str, Any]:
151
+ """AI-structured JSON extraction (requires a key).
152
+
153
+ ``instruction`` is an alias for ``prompt``. The response includes
154
+ ``data``, ``model``, ``metadata``, ``truncated``,
155
+ ``usage`` (``inputTokens``/``outputTokens``), ``latencyMs``,
156
+ ``creditsUsed``, and ``creditsRemaining``.
157
+ """
158
+ body: Dict[str, Any] = {"url": url}
159
+ if prompt is None:
160
+ prompt = instruction
161
+ if prompt is not None:
162
+ body["prompt"] = prompt
163
+ return self._request("/api/extract", body)
164
+
165
+ def classify(self, url: str, labels: Optional[List[str]] = None) -> Dict[str, Any]:
166
+ """Classify a company by industry, or your own labels (requires a key).
167
+
168
+ Without ``labels``, ``data`` holds the NAICS/SIC industry profile
169
+ (``industry``, ``naics_code``, ``naics_title``, ``naics_sector``,
170
+ ``naics_sector_title``, ``naics_valid``, ``sic_code``,
171
+ ``sic_title``, ``sic_division``, ``sic_division_title``,
172
+ ``sic_valid``, ``categories``, ``confidence``). With ``labels``,
173
+ ``data`` holds ``label``, ``matched``, ``confidence``, and
174
+ ``reasoning``. Both modes include ``creditsUsed`` and
175
+ ``creditsRemaining``.
176
+ """
177
+ body: Dict[str, Any] = {"url": url}
178
+ if labels is not None:
179
+ body["labels"] = labels
180
+ return self._request("/api/classify", body)
181
+
182
+ def enrich(
183
+ self,
184
+ url: Optional[str] = None,
185
+ *,
186
+ domain: Optional[str] = None,
187
+ email: Optional[str] = None,
188
+ ) -> Dict[str, Any]:
189
+ """Resolve a brand profile from a URL, domain, or work email.
190
+
191
+ Pass exactly one of ``url``, ``domain``, or ``email`` (a work email
192
+ is mapped to its domain server-side). The response includes
193
+ ``name``, ``description``, ``logo``, ``colors``, ``fonts``,
194
+ ``address``, ``socials`` (``label``/``url``), ``bytesIn``,
195
+ ``latencyMs``, ``creditsUsed``, and ``creditsRemaining``.
196
+ """
197
+ body: Dict[str, Any] = {}
198
+ if url is not None:
199
+ body["url"] = url
200
+ if domain is not None:
201
+ body["domain"] = domain
202
+ if email is not None:
203
+ body["email"] = email
204
+ if not body:
205
+ raise ValueError(
206
+ "Synoppy.enrich: one of url, domain, or email is required"
207
+ )
208
+ return self._request("/api/brand", body)
209
+
210
+ brand = enrich
211
+
212
+ def images(self, url: str) -> Dict[str, Any]:
213
+ """Pull every image off a page.
214
+
215
+ Returns ``url``, ``count``, ``images`` (each with ``src``, ``alt``,
216
+ ``width``, ``height``), ``bytesIn``, ``latencyMs``, ``creditsUsed``,
217
+ and ``creditsRemaining``.
218
+ """
219
+ return self._request("/api/images", {"url": url})
220
+
221
+ # --- Coming soon ---------------------------------------------------------
222
+ # /api/act is not live yet. It is intentionally not implemented; calling
223
+ # it raises a clear error rather than hitting an endpoint that does not
224
+ # exist.
225
+
226
+ def act(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
227
+ """Agentic browser actions — coming soon (not yet live)."""
228
+ raise NotImplementedError(
229
+ "Synoppy.act is coming soon; /api/act is not live yet."
230
+ )
231
+
232
+
233
+ __all__ = ["Synoppy", "SynoppyError", "__version__"]