specstream-client 1.3.2__tar.gz → 1.4.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.
Files changed (23) hide show
  1. specstream_client-1.4.0/PKG-INFO +251 -0
  2. specstream_client-1.4.0/README.md +224 -0
  3. {specstream_client-1.3.2 → specstream_client-1.4.0}/pyproject.toml +1 -1
  4. {specstream_client-1.3.2 → specstream_client-1.4.0}/specstream_client/__init__.py +3 -1
  5. {specstream_client-1.3.2 → specstream_client-1.4.0}/specstream_client/cli.py +2 -1
  6. {specstream_client-1.3.2 → specstream_client-1.4.0}/specstream_client/client.py +216 -6
  7. {specstream_client-1.3.2 → specstream_client-1.4.0}/specstream_client/lifecycle_commands.py +133 -6
  8. specstream_client-1.4.0/specstream_client/monitors.py +387 -0
  9. specstream_client-1.4.0/tests/test_monitors.py +285 -0
  10. specstream_client-1.3.2/PKG-INFO +0 -125
  11. specstream_client-1.3.2/README.md +0 -98
  12. {specstream_client-1.3.2 → specstream_client-1.4.0}/.gitignore +0 -0
  13. {specstream_client-1.3.2 → specstream_client-1.4.0}/LICENSE +0 -0
  14. {specstream_client-1.3.2 → specstream_client-1.4.0}/specstream_client/__main__.py +0 -0
  15. {specstream_client-1.3.2 → specstream_client-1.4.0}/specstream_client/authorization.py +0 -0
  16. {specstream_client-1.3.2 → specstream_client-1.4.0}/specstream_client/families.py +0 -0
  17. {specstream_client-1.3.2 → specstream_client-1.4.0}/specstream_client/py.typed +0 -0
  18. {specstream_client-1.3.2 → specstream_client-1.4.0}/tests/__init__.py +0 -0
  19. {specstream_client-1.3.2 → specstream_client-1.4.0}/tests/test_cli.py +0 -0
  20. {specstream_client-1.3.2 → specstream_client-1.4.0}/tests/test_client.py +0 -0
  21. {specstream_client-1.3.2 → specstream_client-1.4.0}/tests/test_convergence.py +0 -0
  22. {specstream_client-1.3.2 → specstream_client-1.4.0}/tests/test_http_boundary.py +0 -0
  23. {specstream_client-1.3.2 → specstream_client-1.4.0}/tests/test_m16_exports.py +0 -0
@@ -0,0 +1,251 @@
1
+ Metadata-Version: 2.5
2
+ Name: specstream-client
3
+ Version: 1.4.0
4
+ Summary: Python client for building lead lists and company lists from the live web. Every match comes with its source, priced before it runs.
5
+ Project-URL: Homepage, https://specstream.ai
6
+ Project-URL: Documentation, https://specstream.ai/docs/sdk
7
+ Project-URL: API, https://api.specstream.ai
8
+ Project-URL: Changelog, https://specstream.ai/changelog
9
+ Project-URL: Repository, https://github.com/specstream/specstream-tools
10
+ Project-URL: Issues, https://github.com/specstream/specstream-tools/issues
11
+ Author-email: SpecStream <support@specstream.ai>
12
+ License-Expression: MIT
13
+ License-File: LICENSE
14
+ Keywords: ai-agents,api-client,company-list,enrichment,grants,lead-generation,lead-list,lead-lists,live-web,mcp,monitoring,specstream,web-data
15
+ Classifier: Development Status :: 5 - Production/Stable
16
+ Classifier: Environment :: Console
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Internet :: WWW/HTTP
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.12
26
+ Description-Content-Type: text/markdown
27
+
28
+ # specstream-client
29
+
30
+ `pip install specstream-client` (the `specstream` package on PyPI is a different project)
31
+
32
+ Python client and command line for [SpecStream](https://specstream.ai), the live web data engine. One platform to build, search, extract, enrich, map, and monitor data across the entire web.
33
+
34
+ Ask for any dataset in plain words, and SpecStream builds it from the entire live web: every match found, extracted and enriched into structured records, then monitored for change.
35
+
36
+ - Source URL and read time on every value.
37
+ - You pay for each row delivered.
38
+
39
+ The client has no dependencies and needs Python 3.12 or newer. It uses the same account, permissions, projects and balance as the workspace.
40
+
41
+ ```sh
42
+ pip install specstream-client
43
+ ```
44
+
45
+ The package installs the import name `specstream` and the command `specstream`.
46
+
47
+ Create an API key under **Agents & API** in your SpecStream workspace and keep it in the environment:
48
+
49
+ ```sh
50
+ export SPECSTREAM_API_KEY="ss_live_..."
51
+ ```
52
+
53
+ ## Search the web
54
+
55
+ `web_search` calls the [Search API](https://specstream.ai/docs/search-api), `GET /v1/web-search`, at $5 per 1,000 searches of up to 10 results, or $1 on the fast tier.
56
+
57
+ ```python
58
+ import os
59
+ from specstream_client import Client
60
+
61
+ client = Client(os.environ["SPECSTREAM_API_KEY"])
62
+
63
+ search = client.web_search(q="What is the population of Japan?")
64
+ for source in search["sources"][:1]:
65
+ print(source["title"], source["url"], source["snippet"])
66
+ ```
67
+
68
+ ## Extract pages
69
+
70
+ `extract_pages` calls the [Extract API](https://specstream.ai/docs/extract-api), `POST /v1/extract`, at $0.80 per 1,000 pages, and a page with no text is not charged.
71
+
72
+ ```python
73
+ import os
74
+ from specstream_client import Client
75
+
76
+ client = Client(os.environ["SPECSTREAM_API_KEY"])
77
+
78
+ extract = client.extract_pages({"urls": ["https://example.com"]})
79
+ for page in extract["results"][:1]:
80
+ print(page["title"], page["url"], page["text"])
81
+ ```
82
+
83
+ ## Drop-in for the API you already call
84
+
85
+ SpecStream answers calls written for these search APIs at its own address, in each API's own reply shape. To switch, change the base address and the key. Each search call is one Search API web search on your SpecStream key. A drop-in call runs the fast search: $0.001 for up to 10 results ($1 per 1,000 searches), and each 10 results more in the same call add $0.0012. A call that asks for an answer or the API's thorough mode runs the default search: $0.005 for up to 10 results, and $0.006 for each 10 more.
86
+
87
+ | API you call | Base address you have | SpecStream address | Where the SpecStream key goes |
88
+ | --- | --- | --- | --- |
89
+ | Tavily | `https://api.tavily.com` | `https://api.specstream.ai/tavily` | Bearer token or `api_key` |
90
+ | Exa | `https://api.exa.ai` | `https://api.specstream.ai/exa` | `x-api-key` or Bearer token |
91
+ | Brave Search API | `https://api.search.brave.com` | `https://api.specstream.ai` | `X-Subscription-Token` |
92
+ | Serper | `https://google.serper.dev` | `https://api.specstream.ai/serper` | `X-API-KEY` |
93
+ | Bing Web Search API v7 | `https://api.bing.microsoft.com/v7.0/search` | `https://api.specstream.ai/v7.0/search` | `Ocp-Apim-Subscription-Key` |
94
+ | Google Custom Search JSON API | `https://www.googleapis.com` or `https://customsearch.googleapis.com` | `https://api.specstream.ai` | `key=` (`cx` is accepted and not used) |
95
+ | SearXNG (JSON) | your instance address | `https://api.specstream.ai/searxng/<key>` | in the address, `key=`, `X-API-Key` or Bearer token |
96
+ | Firecrawl v2 | `https://api.firecrawl.dev` | `https://api.specstream.ai/firecrawl` | Bearer token |
97
+
98
+ The official Tavily and Exa Python SDKs take the address as an argument:
99
+
100
+ ```python
101
+ import os
102
+ from tavily import TavilyClient
103
+ from exa_py import Exa
104
+
105
+ tavily = TavilyClient(api_key=os.environ["SPECSTREAM_API_KEY"], api_base_url="https://api.specstream.ai/tavily")
106
+ exa = Exa(api_key=os.environ["SPECSTREAM_API_KEY"], base_url="https://api.specstream.ai/exa")
107
+ ```
108
+
109
+ - A call that names no result count returns 10 results, at $0.001 on the fast search. Brave's own default is 20: send `count=20` for 20 results at $0.0022.
110
+ - A Firecrawl `/v2/scrape` call is one Extract API page at $0.0008. The Firecrawl JavaScript SDK works with this address; the Firecrawl Python SDK does not yet.
111
+ - Each route's request and reply fields: [specstream.ai/agents.md](https://specstream.ai/agents.md). Create a key under **Agents & API** at [specstream.ai/workspace](https://specstream.ai/workspace). New accounts start with $10 of credit, no card.
112
+
113
+ ## Read a request, get the price
114
+
115
+ ```python
116
+ import os
117
+ from specstream_client import Client
118
+
119
+ client = Client(os.environ["SPECSTREAM_API_KEY"])
120
+
121
+ read = client.compile("Open-source document-signing tools I can self-host. Include the license and latest release.")
122
+ offer = client.quote_capacity_work({
123
+ "ast_hash": read["ast_hash"],
124
+ "operation": "find",
125
+ "requested_units": read["ast"]["limit"]["max"],
126
+ })
127
+ print(offer["maximum_cents"], offer["expires_at"])
128
+ ```
129
+
130
+ Nothing has run yet. Review the quote: what will be found, the facts that come back, the most the work can cost, and when the price expires. A price lasts 30 minutes.
131
+
132
+ ## Approve it, then read the results
133
+
134
+ After a person approves, send the approved maximum in cents and a request key you saved first:
135
+
136
+ ```python
137
+ run = client.authorize_capacity_work({
138
+ "quote_id": offer["quote_id"],
139
+ "quote_hash": offer["quote_hash"],
140
+ "confirm_max_cents": approved_maximum_cents,
141
+ "idempotency_key": saved_request_key,
142
+ })
143
+ find_id = run["find_id"]
144
+
145
+ page = client.rows(find_id)
146
+ for row in page["rows"]:
147
+ print(row)
148
+ ```
149
+
150
+ If the response is lost, `get_capacity_request(saved_request_key)` returns the same work. Keep the original key when you retry, and you will not pay twice. `get_find` reports progress, and `rows` pages through results with `next_cursor`. Reading, exporting and sharing results you own cost nothing.
151
+
152
+ `authorize_capacity_work` refuses to send anything unless the quote, its signature, the maximum and the key are all present.
153
+
154
+ ## Keep a list current on a schedule
155
+
156
+ A monitor checks a list again on the live web every hour, day, week or month ("month" is every 30 days).
157
+ Each check is a refresh: half the row rate for a row that changed or is new, and 1 cent for a row that comes back unchanged.
158
+
159
+ ```python
160
+ monitor = client.monitor_list(
161
+ find_id,
162
+ every="week",
163
+ max_price_per_run_usd=2,
164
+ max_price_per_month_usd=8,
165
+ )
166
+
167
+ if monitor["status"] == "saved":
168
+ print(monitor["monitor_id"], monitor["next_run_at"])
169
+ else:
170
+ print(monitor["message"]) # "over_maximum": one check costs more than max_price_per_run_usd, nothing was saved
171
+ ```
172
+
173
+ The client prices one check before it saves anything.
174
+ When one check can cost more than `max_price_per_run_usd`, nothing is saved.
175
+ `max_price_per_month_usd` is the most the monitor spends in one UTC calendar month, checks run on demand included.
176
+ Without it, the limit is `max_price_per_run_usd` times the checks in 31 days.
177
+ The first check runs one interval after the current hour began, and the monitor ends a year after it, unless you set `first_run_at=` and `ends_at=` (a `datetime` with a time zone or an ISO 8601 string).
178
+ The same call again in the same hour returns the monitor already saved, not a second one.
179
+
180
+ | Call | What it does | Cost |
181
+ | --- | --- | --- |
182
+ | `monitor_list(list_id, ...)` | Prices one check of the list and saves the schedule within your limits | Each check, within the limits |
183
+ | `monitors()` | Every monitor of the account, with its state, next check and last list | Free |
184
+ | `monitor_runs(monitor_id)` | The recent checks, newest first: when, the outcome, the reason and the list each one made | Free |
185
+ | `run_monitor_now(monitor_id)` | One check now, inside the monitor's limits. The regular times stay as they are | One check |
186
+ | `pause_monitor(monitor_id)`, `resume_monitor(monitor_id)` | Stops and starts the checks. A missed check is never bought later | Free |
187
+ | `delete_monitor(monitor_id)` | Ends the monitor. The lists it made stay yours | Free |
188
+ | `revisit(list_id)` | Each record of a refreshed list: still matches, no longer matches, unresolved or unavailable | Free |
189
+
190
+ A blocked or missed check is not an unchanged result, and it is not bought later.
191
+ For a calendar schedule (for example Mondays at 9:00 in your time zone), call `create_capacity_schedule` with the API's own fields, including `calendar_schedule`; `list_capacity_schedules`, `update_capacity_schedule`, `list_capacity_occurrences` and `run_capacity_schedule_now` are there too.
192
+
193
+ ### Send new and changed records to a webhook
194
+
195
+ ```python
196
+ delivery = client.set_monitor_delivery(monitor["monitor_id"], webhook="https://example.com/hooks/specstream")
197
+ signing_secret = delivery["webhook_secret"] # shown once: store it, never log it
198
+ ```
199
+
200
+ `set_monitor_delivery` also takes `slack=` (a channel of your connected Slack workspace), `send_to=` (a connected tool) and `notify=` (SpecStream notifications). Nothing runs when you set it.
201
+ Slack and webhook delivery need a plan that includes deliveries.
202
+
203
+ Each delivery is a JSON POST with the headers `Specstream-Event-Id` and `Specstream-Signature: t=<unix time>,v1=<hex>`.
204
+ Check it before you trust the body, and use the event id to drop repeats:
205
+
206
+ ```python
207
+ import json
208
+ import os
209
+ from specstream_client import verify_webhook
210
+
211
+ # In your web endpoint, with the raw request body
212
+ verify_webhook(
213
+ secret=os.environ["SPECSTREAM_WEBHOOK_SECRET"],
214
+ signature=request.headers["Specstream-Signature"],
215
+ body=raw_body,
216
+ ) # raises SpecstreamError when the signature is wrong or older than 5 minutes
217
+ event = json.loads(raw_body)
218
+ ```
219
+
220
+ ## More than a first request
221
+
222
+ - `quote_capacity_work` also prices `extend` (more results), `add_facts` and `refresh` (a recheck, at half price) on a finished run. Pass the original `parent_find_id`.
223
+ - `spec_options(kind)` lists the facts you can ask for, per kind of thing. `edit_spec` changes a request without rereading it.
224
+ - `create_capacity_schedule` keeps any request up to date, hourly to yearly, inside per-run and per-period limits.
225
+ - `export` and `download_export` give CSV, XLSX, JSON or HTML. `create_customer_webhook` sends signed events.
226
+ - Projects, members, shares and starred items have their own methods.
227
+
228
+ ## Command line
229
+
230
+ ```sh
231
+ specstream compile "Open-source vector databases on GitHub with more than 5,000 stars, with their license."
232
+ specstream get-capacity-balance
233
+ specstream quote-capacity-work --body quote-request.json
234
+ specstream authorize-capacity-work --body approved-execution.json
235
+ specstream rows --find-id FIND_ID
236
+ ```
237
+
238
+ `--body` takes a JSON file or `-` for stdin. Every command's `--help` describes its parameters. The command line exposes the same operations as the client.
239
+
240
+ ## Pricing
241
+
242
+ New accounts start with $10 of credit, no card. A delivered result costs 5 cents, 15 cents or $1 depending on how many facts it carries. No result, no charge. Rechecks cost half. People and agents share one balance. See [pricing](https://specstream.ai/pricing).
243
+
244
+ ## Links
245
+
246
+ - [SDK docs](https://specstream.ai/docs/sdk) and [API docs](https://specstream.ai/docs/api)
247
+ - [Source and issues](https://github.com/specstream/specstream-tools)
248
+ - [TypeScript client](https://www.npmjs.com/package/@specstream/sdk)
249
+ - Support: support@specstream.ai
250
+
251
+ MIT license.
@@ -0,0 +1,224 @@
1
+ # specstream-client
2
+
3
+ `pip install specstream-client` (the `specstream` package on PyPI is a different project)
4
+
5
+ Python client and command line for [SpecStream](https://specstream.ai), the live web data engine. One platform to build, search, extract, enrich, map, and monitor data across the entire web.
6
+
7
+ Ask for any dataset in plain words, and SpecStream builds it from the entire live web: every match found, extracted and enriched into structured records, then monitored for change.
8
+
9
+ - Source URL and read time on every value.
10
+ - You pay for each row delivered.
11
+
12
+ The client has no dependencies and needs Python 3.12 or newer. It uses the same account, permissions, projects and balance as the workspace.
13
+
14
+ ```sh
15
+ pip install specstream-client
16
+ ```
17
+
18
+ The package installs the import name `specstream` and the command `specstream`.
19
+
20
+ Create an API key under **Agents & API** in your SpecStream workspace and keep it in the environment:
21
+
22
+ ```sh
23
+ export SPECSTREAM_API_KEY="ss_live_..."
24
+ ```
25
+
26
+ ## Search the web
27
+
28
+ `web_search` calls the [Search API](https://specstream.ai/docs/search-api), `GET /v1/web-search`, at $5 per 1,000 searches of up to 10 results, or $1 on the fast tier.
29
+
30
+ ```python
31
+ import os
32
+ from specstream_client import Client
33
+
34
+ client = Client(os.environ["SPECSTREAM_API_KEY"])
35
+
36
+ search = client.web_search(q="What is the population of Japan?")
37
+ for source in search["sources"][:1]:
38
+ print(source["title"], source["url"], source["snippet"])
39
+ ```
40
+
41
+ ## Extract pages
42
+
43
+ `extract_pages` calls the [Extract API](https://specstream.ai/docs/extract-api), `POST /v1/extract`, at $0.80 per 1,000 pages, and a page with no text is not charged.
44
+
45
+ ```python
46
+ import os
47
+ from specstream_client import Client
48
+
49
+ client = Client(os.environ["SPECSTREAM_API_KEY"])
50
+
51
+ extract = client.extract_pages({"urls": ["https://example.com"]})
52
+ for page in extract["results"][:1]:
53
+ print(page["title"], page["url"], page["text"])
54
+ ```
55
+
56
+ ## Drop-in for the API you already call
57
+
58
+ SpecStream answers calls written for these search APIs at its own address, in each API's own reply shape. To switch, change the base address and the key. Each search call is one Search API web search on your SpecStream key. A drop-in call runs the fast search: $0.001 for up to 10 results ($1 per 1,000 searches), and each 10 results more in the same call add $0.0012. A call that asks for an answer or the API's thorough mode runs the default search: $0.005 for up to 10 results, and $0.006 for each 10 more.
59
+
60
+ | API you call | Base address you have | SpecStream address | Where the SpecStream key goes |
61
+ | --- | --- | --- | --- |
62
+ | Tavily | `https://api.tavily.com` | `https://api.specstream.ai/tavily` | Bearer token or `api_key` |
63
+ | Exa | `https://api.exa.ai` | `https://api.specstream.ai/exa` | `x-api-key` or Bearer token |
64
+ | Brave Search API | `https://api.search.brave.com` | `https://api.specstream.ai` | `X-Subscription-Token` |
65
+ | Serper | `https://google.serper.dev` | `https://api.specstream.ai/serper` | `X-API-KEY` |
66
+ | Bing Web Search API v7 | `https://api.bing.microsoft.com/v7.0/search` | `https://api.specstream.ai/v7.0/search` | `Ocp-Apim-Subscription-Key` |
67
+ | Google Custom Search JSON API | `https://www.googleapis.com` or `https://customsearch.googleapis.com` | `https://api.specstream.ai` | `key=` (`cx` is accepted and not used) |
68
+ | SearXNG (JSON) | your instance address | `https://api.specstream.ai/searxng/<key>` | in the address, `key=`, `X-API-Key` or Bearer token |
69
+ | Firecrawl v2 | `https://api.firecrawl.dev` | `https://api.specstream.ai/firecrawl` | Bearer token |
70
+
71
+ The official Tavily and Exa Python SDKs take the address as an argument:
72
+
73
+ ```python
74
+ import os
75
+ from tavily import TavilyClient
76
+ from exa_py import Exa
77
+
78
+ tavily = TavilyClient(api_key=os.environ["SPECSTREAM_API_KEY"], api_base_url="https://api.specstream.ai/tavily")
79
+ exa = Exa(api_key=os.environ["SPECSTREAM_API_KEY"], base_url="https://api.specstream.ai/exa")
80
+ ```
81
+
82
+ - A call that names no result count returns 10 results, at $0.001 on the fast search. Brave's own default is 20: send `count=20` for 20 results at $0.0022.
83
+ - A Firecrawl `/v2/scrape` call is one Extract API page at $0.0008. The Firecrawl JavaScript SDK works with this address; the Firecrawl Python SDK does not yet.
84
+ - Each route's request and reply fields: [specstream.ai/agents.md](https://specstream.ai/agents.md). Create a key under **Agents & API** at [specstream.ai/workspace](https://specstream.ai/workspace). New accounts start with $10 of credit, no card.
85
+
86
+ ## Read a request, get the price
87
+
88
+ ```python
89
+ import os
90
+ from specstream_client import Client
91
+
92
+ client = Client(os.environ["SPECSTREAM_API_KEY"])
93
+
94
+ read = client.compile("Open-source document-signing tools I can self-host. Include the license and latest release.")
95
+ offer = client.quote_capacity_work({
96
+ "ast_hash": read["ast_hash"],
97
+ "operation": "find",
98
+ "requested_units": read["ast"]["limit"]["max"],
99
+ })
100
+ print(offer["maximum_cents"], offer["expires_at"])
101
+ ```
102
+
103
+ Nothing has run yet. Review the quote: what will be found, the facts that come back, the most the work can cost, and when the price expires. A price lasts 30 minutes.
104
+
105
+ ## Approve it, then read the results
106
+
107
+ After a person approves, send the approved maximum in cents and a request key you saved first:
108
+
109
+ ```python
110
+ run = client.authorize_capacity_work({
111
+ "quote_id": offer["quote_id"],
112
+ "quote_hash": offer["quote_hash"],
113
+ "confirm_max_cents": approved_maximum_cents,
114
+ "idempotency_key": saved_request_key,
115
+ })
116
+ find_id = run["find_id"]
117
+
118
+ page = client.rows(find_id)
119
+ for row in page["rows"]:
120
+ print(row)
121
+ ```
122
+
123
+ If the response is lost, `get_capacity_request(saved_request_key)` returns the same work. Keep the original key when you retry, and you will not pay twice. `get_find` reports progress, and `rows` pages through results with `next_cursor`. Reading, exporting and sharing results you own cost nothing.
124
+
125
+ `authorize_capacity_work` refuses to send anything unless the quote, its signature, the maximum and the key are all present.
126
+
127
+ ## Keep a list current on a schedule
128
+
129
+ A monitor checks a list again on the live web every hour, day, week or month ("month" is every 30 days).
130
+ Each check is a refresh: half the row rate for a row that changed or is new, and 1 cent for a row that comes back unchanged.
131
+
132
+ ```python
133
+ monitor = client.monitor_list(
134
+ find_id,
135
+ every="week",
136
+ max_price_per_run_usd=2,
137
+ max_price_per_month_usd=8,
138
+ )
139
+
140
+ if monitor["status"] == "saved":
141
+ print(monitor["monitor_id"], monitor["next_run_at"])
142
+ else:
143
+ print(monitor["message"]) # "over_maximum": one check costs more than max_price_per_run_usd, nothing was saved
144
+ ```
145
+
146
+ The client prices one check before it saves anything.
147
+ When one check can cost more than `max_price_per_run_usd`, nothing is saved.
148
+ `max_price_per_month_usd` is the most the monitor spends in one UTC calendar month, checks run on demand included.
149
+ Without it, the limit is `max_price_per_run_usd` times the checks in 31 days.
150
+ The first check runs one interval after the current hour began, and the monitor ends a year after it, unless you set `first_run_at=` and `ends_at=` (a `datetime` with a time zone or an ISO 8601 string).
151
+ The same call again in the same hour returns the monitor already saved, not a second one.
152
+
153
+ | Call | What it does | Cost |
154
+ | --- | --- | --- |
155
+ | `monitor_list(list_id, ...)` | Prices one check of the list and saves the schedule within your limits | Each check, within the limits |
156
+ | `monitors()` | Every monitor of the account, with its state, next check and last list | Free |
157
+ | `monitor_runs(monitor_id)` | The recent checks, newest first: when, the outcome, the reason and the list each one made | Free |
158
+ | `run_monitor_now(monitor_id)` | One check now, inside the monitor's limits. The regular times stay as they are | One check |
159
+ | `pause_monitor(monitor_id)`, `resume_monitor(monitor_id)` | Stops and starts the checks. A missed check is never bought later | Free |
160
+ | `delete_monitor(monitor_id)` | Ends the monitor. The lists it made stay yours | Free |
161
+ | `revisit(list_id)` | Each record of a refreshed list: still matches, no longer matches, unresolved or unavailable | Free |
162
+
163
+ A blocked or missed check is not an unchanged result, and it is not bought later.
164
+ For a calendar schedule (for example Mondays at 9:00 in your time zone), call `create_capacity_schedule` with the API's own fields, including `calendar_schedule`; `list_capacity_schedules`, `update_capacity_schedule`, `list_capacity_occurrences` and `run_capacity_schedule_now` are there too.
165
+
166
+ ### Send new and changed records to a webhook
167
+
168
+ ```python
169
+ delivery = client.set_monitor_delivery(monitor["monitor_id"], webhook="https://example.com/hooks/specstream")
170
+ signing_secret = delivery["webhook_secret"] # shown once: store it, never log it
171
+ ```
172
+
173
+ `set_monitor_delivery` also takes `slack=` (a channel of your connected Slack workspace), `send_to=` (a connected tool) and `notify=` (SpecStream notifications). Nothing runs when you set it.
174
+ Slack and webhook delivery need a plan that includes deliveries.
175
+
176
+ Each delivery is a JSON POST with the headers `Specstream-Event-Id` and `Specstream-Signature: t=<unix time>,v1=<hex>`.
177
+ Check it before you trust the body, and use the event id to drop repeats:
178
+
179
+ ```python
180
+ import json
181
+ import os
182
+ from specstream_client import verify_webhook
183
+
184
+ # In your web endpoint, with the raw request body
185
+ verify_webhook(
186
+ secret=os.environ["SPECSTREAM_WEBHOOK_SECRET"],
187
+ signature=request.headers["Specstream-Signature"],
188
+ body=raw_body,
189
+ ) # raises SpecstreamError when the signature is wrong or older than 5 minutes
190
+ event = json.loads(raw_body)
191
+ ```
192
+
193
+ ## More than a first request
194
+
195
+ - `quote_capacity_work` also prices `extend` (more results), `add_facts` and `refresh` (a recheck, at half price) on a finished run. Pass the original `parent_find_id`.
196
+ - `spec_options(kind)` lists the facts you can ask for, per kind of thing. `edit_spec` changes a request without rereading it.
197
+ - `create_capacity_schedule` keeps any request up to date, hourly to yearly, inside per-run and per-period limits.
198
+ - `export` and `download_export` give CSV, XLSX, JSON or HTML. `create_customer_webhook` sends signed events.
199
+ - Projects, members, shares and starred items have their own methods.
200
+
201
+ ## Command line
202
+
203
+ ```sh
204
+ specstream compile "Open-source vector databases on GitHub with more than 5,000 stars, with their license."
205
+ specstream get-capacity-balance
206
+ specstream quote-capacity-work --body quote-request.json
207
+ specstream authorize-capacity-work --body approved-execution.json
208
+ specstream rows --find-id FIND_ID
209
+ ```
210
+
211
+ `--body` takes a JSON file or `-` for stdin. Every command's `--help` describes its parameters. The command line exposes the same operations as the client.
212
+
213
+ ## Pricing
214
+
215
+ New accounts start with $10 of credit, no card. A delivered result costs 5 cents, 15 cents or $1 depending on how many facts it carries. No result, no charge. Rechecks cost half. People and agents share one balance. See [pricing](https://specstream.ai/pricing).
216
+
217
+ ## Links
218
+
219
+ - [SDK docs](https://specstream.ai/docs/sdk) and [API docs](https://specstream.ai/docs/api)
220
+ - [Source and issues](https://github.com/specstream/specstream-tools)
221
+ - [TypeScript client](https://www.npmjs.com/package/@specstream/sdk)
222
+ - Support: support@specstream.ai
223
+
224
+ MIT license.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "specstream-client"
3
- version = "1.3.2"
3
+ version = "1.4.0"
4
4
  description = "Python client for building lead lists and company lists from the live web. Every match comes with its source, priced before it runs."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -2,6 +2,7 @@
2
2
 
3
3
  from specstream_client.client import DEFAULT_BASE_URL, Client, SpecstreamError
4
4
  from specstream_client.families import FAMILIES, FAMILY_SET, assert_family
5
+ from specstream_client.monitors import verify_webhook
5
6
 
6
7
  __all__ = [
7
8
  "Client",
@@ -10,5 +11,6 @@ __all__ = [
10
11
  "FAMILY_SET",
11
12
  "SpecstreamError",
12
13
  "assert_family",
14
+ "verify_webhook",
13
15
  ]
14
- __version__ = "1.3.2"
16
+ __version__ = "1.4.0"
@@ -75,7 +75,8 @@ def _parser() -> argparse.ArgumentParser:
75
75
  options["action"] = argparse.BooleanOptionalAction
76
76
  else:
77
77
  options["type"] = int if kind == "integer" else str
78
- command.add_argument("--" + parameter.replace("_", "-"), **options)
78
+ flag = "--" + parameter.rstrip("_").replace("_", "-")
79
+ command.add_argument(flag, dest=parameter, **options)
79
80
  return parser
80
81
 
81
82