coresignal 0.1.0rc1__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 Coresignal
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,559 @@
1
+ Metadata-Version: 2.4
2
+ Name: coresignal
3
+ Version: 0.1.0rc1
4
+ Summary: Python SDK for the Coresignal API
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Keywords: coresignal,api,sdk,company data,employee data,job data
8
+ Author: Coresignal
9
+ Requires-Python: >=3.11
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
+ Requires-Dist: httpx (>=0.27)
23
+ Project-URL: Documentation, https://docs.coresignal.com
24
+ Project-URL: Homepage, https://coresignal.com
25
+ Project-URL: Repository, https://github.com/Coresignal-com/coresignal-sdk-python
26
+ Description-Content-Type: text/markdown
27
+
28
+ # Coresignal Python SDK
29
+
30
+ [![PyPI](https://img.shields.io/pypi/v/coresignal)](https://pypi.org/project/coresignal/)
31
+ [![Python versions](https://img.shields.io/pypi/pyversions/coresignal)](https://pypi.org/project/coresignal/)
32
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/Coresignal-com/coresignal-sdk-python/blob/main/LICENSE)
33
+
34
+ The official Python SDK for the
35
+ [Coresignal API](https://docs.coresignal.com/?utm_source=sdk_readme&utm_medium=referral&utm_campaign=sdk_launch_python&utm_content=docs).
36
+ Access multi-source company, employee, and jobs data, plus Agentic Search, without writing the plumbing yourself.
37
+
38
+ - One simple function for every API request
39
+ - Responses in JSON
40
+ - Automatic retries and clear error messages
41
+ - Big searches and bulk record collection handled for you
42
+
43
+ ## Table of contents
44
+
45
+ - [Installation](#installation)
46
+ - [Authentication](#authentication)
47
+ - [Quick start](#quick-start)
48
+ - [Datasets](#datasets)
49
+ - [Responses](#responses)
50
+ - [Paging](#paging)
51
+ - [Searching and collecting](#searching-and-collecting)
52
+ - [Agentic Search](#agentic-search)
53
+ - [Collecting many records](#collecting-many-records)
54
+ - [Bulk Collect](#bulk-collect)
55
+ - [Errors and retries](#errors-and-retries)
56
+ - [Versioning](#versioning)
57
+ - [Support](#support)
58
+ - [About Coresignal](#about-coresignal)
59
+ - [License](#license)
60
+
61
+ ## Installation
62
+
63
+ ```bash
64
+ pip install coresignal
65
+ ```
66
+
67
+ The SDK needs Python 3.11 or newer.
68
+
69
+ ## Authentication
70
+
71
+ You need a Coresignal API key.
72
+ [Sign up](https://dashboard.coresignal.com/sign-up?utm_source=sdk_readme&utm_medium=referral&utm_campaign=sdk_launch_python&utm_content=auth_signup)
73
+ for free to get one, or find it in
74
+ [your dashboard](https://dashboard.coresignal.com/?utm_source=sdk_readme&utm_medium=referral&utm_campaign=sdk_launch_python&utm_content=auth_dashboard).
75
+
76
+ Pass your Coresignal API key as `api_key`, or set the `CORESIGNAL_API_KEY` environment variable:
77
+
78
+ ```python
79
+ from coresignal import Coresignal
80
+
81
+ client = Coresignal(api_key="your-api-key")
82
+ client = Coresignal() # reads CORESIGNAL_API_KEY
83
+ ```
84
+
85
+ Create one client and reuse it: it keeps a pool of open connections. Close it with `client.close()`, or use it as a
86
+ context manager:
87
+
88
+ ```python
89
+ with Coresignal() as client:
90
+ ...
91
+ ```
92
+
93
+ ## Quick start
94
+
95
+ ```python
96
+ from coresignal import Coresignal
97
+
98
+ with Coresignal() as client:
99
+ company = client.company_multi_source.collect("example-inc", fields=["id", "company_name", "website"])
100
+ print(company.data["company_name"])
101
+ print(company.credits_remaining)
102
+ ```
103
+
104
+ ## Datasets
105
+
106
+ Each dataset has its own group on the client, with one function per endpoint. Parameters are named as in the API,
107
+ and a parameter you leave out is not sent, so the API's default applies. Every function also takes `timeout` and
108
+ `max_retries` for that one request.
109
+
110
+ Each endpoint function returns an `ApiResponse`: `.data` is the response body, and its other attributes hold what
111
+ came with it, such as `total_results` or `credits_remaining` (see [Responses](#responses)). The helpers that send
112
+ several requests, such as `iter_search_es_dsl`, `collect_many` and `search_and_collect`, return their own results.
113
+
114
+ ### Multi-source Company Data
115
+
116
+ ```python
117
+ from coresignal.types.company_multi_source import MultiSourceCompanyFilters
118
+
119
+ companies = client.company_multi_source
120
+
121
+ # Collect one record
122
+ company = companies.collect(12345).data # by ID
123
+ company = companies.collect("example-inc").data # by shorthand name or profile URL
124
+ company = companies.collect(12345, fields=["id", "company_name", "website"]).data
125
+ company = companies.collect(12345, bundle=["core_company_data", "financial_information"]).data
126
+ company = companies.enrich(website="example.com").data
127
+ company = companies.enrich(social_url="https://social.example.com/example-inc").data
128
+
129
+ # Search with an Elasticsearch DSL query
130
+ query = {"match": {"company_name": "Example"}}
131
+ ids = companies.search_es_dsl(query).data # the IDs of the matches, a page at a time
132
+ ids = companies.search_es_dsl(query, items_per_page=100, sort=["id"]).data
133
+ previews = companies.search_es_dsl_preview(query).data # a short preview of each match
134
+
135
+ # Search with filters, as keyword arguments or as a dict
136
+ ids = companies.search_filter(hq_country_iso2="US", industry="Software Development").data
137
+ filters: MultiSourceCompanyFilters = {"hq_country_iso2": "US", "industry": "Software Development"}
138
+ ids = companies.search_filter(**filters).data
139
+ previews = companies.search_filter_preview(**filters).data
140
+ ids = companies.search_filter(hq_country_iso2="US", industry=None).data # US companies without an industry
141
+
142
+ # Semantic search: synonyms are added to a match_phrase on the fields the docs list
143
+ semantic_query = {"match_phrase": {"active_job_postings.job_posting_title": "data engineer"}}
144
+ found = companies.semantic_search_es_dsl(semantic_query, threshold=0.8).data
145
+ found["results"] # the IDs of the matches
146
+ found["metadata"]["synonyms_injected"] # the synonyms that were added
147
+
148
+ # Every search, page after page (see Paging)
149
+ for company_id in companies.iter_search_es_dsl(query):
150
+ ...
151
+ for company_id in companies.iter_search_filter(**filters):
152
+ ...
153
+ for company_id in companies.iter_semantic_search_es_dsl(semantic_query):
154
+ ...
155
+ for preview in companies.iter_search_es_dsl_preview(query, max_pages=2):
156
+ ...
157
+ for preview in companies.iter_search_filter_preview(max_pages=2, **filters):
158
+ ...
159
+
160
+ # Search and collect the full records in one call (see Searching and collecting)
161
+ result = companies.search_and_collect(query, sort="_score", max_records=10)
162
+ result = companies.search_filter_and_collect(sort="last_updated", max_records=10, **filters)
163
+
164
+ # Collect many records (see Collecting many records)
165
+ collected = companies.collect_many([12345, 12346, 12347])
166
+
167
+ # Bulk Collect: the API prepares the records as files (see Bulk Collect)
168
+ request_id = companies.bulk_collect_ids([12345, 12346, 12347]).data["request_id"]
169
+ request_id = companies.bulk_collect_es_dsl(query, limit=1000).data["request_id"]
170
+ ```
171
+
172
+ ### Multi-source Employee Data
173
+
174
+ ```python
175
+ from coresignal.types.employee_multi_source import MultiSourceEmployeeFilters
176
+
177
+ employees = client.employee_multi_source
178
+
179
+ # Collect one record
180
+ employee = employees.collect(67890).data # by ID
181
+ employee = employees.collect("jane-doe").data # by shorthand name or profile URL
182
+ employee = employees.collect(67890, fields=["id", "full_name", "headline"]).data
183
+ employee = employees.collect(67890, bundle=["core_employee_data", "career_intelligence"]).data
184
+ employee = employees.enrich(social_url="https://www.example.com/in/jane-doe").data
185
+
186
+ # Search with an Elasticsearch DSL query
187
+ query = {"match_phrase": {"headline": "data engineer"}}
188
+ ids = employees.search_es_dsl(query).data
189
+ previews = employees.search_es_dsl_preview(query).data
190
+
191
+ # Search with filters, as keyword arguments or as a dict
192
+ ids = employees.search_filter(location_country="Lithuania", active_experience_title="Data Engineer").data
193
+ filters: MultiSourceEmployeeFilters = {"location_country": "Lithuania", "active_experience_title": "Data Engineer"}
194
+ ids = employees.search_filter(**filters).data
195
+ previews = employees.search_filter_preview(**filters).data
196
+
197
+ # Semantic search
198
+ semantic_query = {"match_phrase": {"active_experience_title": "data engineer"}}
199
+ found = employees.semantic_search_es_dsl(semantic_query).data
200
+
201
+ # Every search, page after page
202
+ for employee_id in employees.iter_search_es_dsl(query):
203
+ ...
204
+ for employee_id in employees.iter_search_filter(**filters):
205
+ ...
206
+ for employee_id in employees.iter_semantic_search_es_dsl(semantic_query):
207
+ ...
208
+ for preview in employees.iter_search_es_dsl_preview(query, max_pages=2):
209
+ ...
210
+ for preview in employees.iter_search_filter_preview(max_pages=2, **filters):
211
+ ...
212
+
213
+ # Search and collect the full records in one call
214
+ result = employees.search_and_collect(query, sort="_score", max_records=10)
215
+ result = employees.search_filter_and_collect(sort="last_updated", max_records=10, **filters)
216
+
217
+ # Collect many records
218
+ collected = employees.collect_many([67890, 67891, "jane-doe"])
219
+
220
+ # Bulk Collect
221
+ request_id = employees.bulk_collect_ids([67890, 67891]).data["request_id"]
222
+ request_id = employees.bulk_collect_es_dsl(query, limit=1000).data["request_id"]
223
+ ```
224
+
225
+ ### Multi-source Jobs Data
226
+
227
+ ```python
228
+ jobs = client.job_multi_source
229
+
230
+ # Collect one record
231
+ job = jobs.collect(424242).data # by ID, also as a string of digits
232
+ job = jobs.collect(424242, fields=["id", "title", "company_name"]).data
233
+
234
+ # Search with an Elasticsearch DSL query
235
+ query = {"match_phrase": {"title": "product manager"}}
236
+ ids = jobs.search_es_dsl(query).data
237
+ previews = jobs.search_es_dsl_preview(query).data
238
+
239
+ # Semantic search
240
+ found = jobs.semantic_search_es_dsl(query).data
241
+
242
+ # Every search, page after page
243
+ for job_id in jobs.iter_search_es_dsl(query):
244
+ ...
245
+ for job_id in jobs.iter_semantic_search_es_dsl(query):
246
+ ...
247
+ for preview in jobs.iter_search_es_dsl_preview(query, max_pages=2):
248
+ ...
249
+
250
+ # Search and collect the full records in one call
251
+ result = jobs.search_and_collect(query, sort="_score", max_records=10)
252
+
253
+ # Collect many records
254
+ collected = jobs.collect_many([424242, 424243])
255
+
256
+ # Bulk Collect
257
+ request_id = jobs.bulk_collect_ids([424242, 424243]).data["request_id"]
258
+ request_id = jobs.bulk_collect_es_dsl(query, limit=1000).data["request_id"]
259
+ ```
260
+
261
+ ## Responses
262
+
263
+ A function that sends one request and returns its data, such as `collect` or `search_es_dsl`, returns an
264
+ `ApiResponse`:
265
+
266
+ | Attribute | What it holds |
267
+ | --- | --- |
268
+ | `data` | The response body, exactly as the API sent it. |
269
+ | `credits_remaining` | Remaining credit balance after this request. |
270
+ | `credits_charged` | Credits this request deducted, or `None` when the API did not send them. |
271
+ | `total_results`, `total_pages` | Total number of matching results and pages. |
272
+ | `next_page_after` | The cursor for the next page of a search, or `None` on the last page. |
273
+ | `snapshot_token` | The token that keeps preview pages on one snapshot of the results. |
274
+ | `headers`, `status_code`, `attempts` | All headers, the status code, and how many times the request was sent. |
275
+
276
+ `data` holds plain dicts and lists. The `TypedDict` types in `coresignal.types` give editors and type checkers the
277
+ field names. Every field is optional. Fields named after the professional network are left out of the types, but
278
+ `data` still holds them. Read them with `.get()`, which type checkers see as `object`, or cast `data` to
279
+ `dict[str, Any]` first.
280
+
281
+ ## Paging
282
+
283
+ A search returns up to 1,000 IDs per page. Each search function has an `iter_` version that follows the API's
284
+ `next_page_after` cursor for you:
285
+
286
+ ```python
287
+ query = {"match": {"industry": "Software Development"}}
288
+
289
+ for company_id in client.company_multi_source.iter_search_es_dsl(query):
290
+ ... # one ID at a time; each page is requested when the loop needs it
291
+ ```
292
+
293
+ Use `pages()` to work one page at a time, with each page's headers:
294
+
295
+ ```python
296
+ for page in client.company_multi_source.iter_search_es_dsl(query).pages():
297
+ print(len(page.data), page.total_results, page.credits_remaining)
298
+ ```
299
+
300
+ Preview iterators page through one snapshot of the results, up to page 50. Each preview page is charged
301
+ ([Credits](https://docs.coresignal.com/api-introduction/credits)), and without `max_pages` a preview iterator requests
302
+ up to 50 pages. `max_pages` limits how many pages are requested:
303
+
304
+ ```python
305
+ for preview in client.company_multi_source.iter_search_es_dsl_preview(query, max_pages=2):
306
+ print(preview["company_name"])
307
+ ```
308
+
309
+ ## Searching and collecting
310
+
311
+ `search_and_collect` searches with an Elasticsearch DSL query and collects the full record of each match, in the order
312
+ of `sort`, until it has `max_records` records:
313
+
314
+ ```python
315
+ query = {"match": {"company_name": "Example"}}
316
+
317
+ # The 10 best matches
318
+ result = client.company_multi_source.search_and_collect(query, sort="_score", max_records=10)
319
+
320
+ for company_id, company in result.records.items():
321
+ print(company_id, company["company_name"])
322
+
323
+ result.total_results # how many companies the query matched
324
+ result.credits_used # the credits this call used
325
+ ```
326
+
327
+ - `sort` and `max_records` are required. `sort` is one field name, sent as given, such as `"_score"` for the best
328
+ matches first or `"id"`. A query with its own `sort` raises `ValueError`.
329
+ - Each record uses one `collect` request, charged like any other. A record that cannot be collected, such as one
330
+ removed since the search, is listed in `result.errors`, and the next match is taken instead.
331
+ - Requests are spaced to `requests_per_second`, 5 by default. Set it to your plan's rate limit.
332
+ - A `PaymentRequiredError`, `AuthenticationError`, `RateLimitError`, `TransportError`, `RequestValidationError`, a
333
+ third `ServerError` in a row or an error from a search request stops the run. It returns the records collected so
334
+ far, with the error in `result.stopped_by`, and the records that failed last are tried first when it is resumed. A
335
+ record whose request may have reached the API before the connection failed is listed in `result.errors` instead,
336
+ so a resume does not send it again.
337
+ - A `RequestValidationError` before any record was collected, such as for a misspelled field in `fields`, is raised.
338
+ - `result.resume` carries on where the run stopped, after an error or to collect the next `max_records` records. Pass
339
+ it with the same query and sort. It is `None` when every match was tried:
340
+
341
+ ```python
342
+ companies = client.company_multi_source
343
+ collected = {}
344
+
345
+ result = companies.search_and_collect(query, sort="id", max_records=500)
346
+ collected.update(result.records)
347
+ while result.stopped_by is None and result.resume is not None: # the next 500
348
+ result = companies.search_and_collect(query, sort="id", max_records=500, resume=result.resume)
349
+ collected.update(result.records)
350
+ ```
351
+
352
+ For company and employee data, `search_filter_and_collect` does the same with the filters of `search_filter` instead
353
+ of a query. Supported `sort` values are `"id"` and `"last_updated"`:
354
+
355
+ ```python
356
+ result = client.company_multi_source.search_filter_and_collect(
357
+ sort="last_updated", max_records=100, hq_country_iso2="US", industry="Software Development"
358
+ )
359
+ ```
360
+
361
+ ## Agentic Search
362
+
363
+ `client.agentic_search.get_query_by_nl_query` turns a plain-English prompt into an Elasticsearch DSL query and counts
364
+ the records it matches, before collecting any. Check the count, then collect as many records as you need:
365
+
366
+ ```python
367
+ found = client.agentic_search.get_query_by_nl_query(
368
+ "Software companies in Germany with more than 200 employees", entity="company"
369
+ )
370
+ print(found.total_results) # how many companies the query matches
371
+
372
+ result = client.company_multi_source.search_and_collect(found.query, sort=found.sort, max_records=100)
373
+ ```
374
+
375
+ - `mode` is `"fast"`, optimized for speed and the default, or `"advanced"`, for more complex prompts and slower. Both
376
+ take the same arguments and return the same result.
377
+ - `entity` is `"employee"`, `"company"` or `"job"`, or `"auto"` to detect it from the prompt. Without it, employee
378
+ data is searched. `threshold`, from 0 to 1, is the minimum similarity for a synonym to be added to the search.
379
+ - Generating the query is charged ([Pricing](https://docs.coresignal.com/pricing)). The search that counts its
380
+ matches is not. If that search fails, the query is still returned, with the error in `found.search_error` and
381
+ `found.total_results` set to `None`.
382
+ - `found.query` has no sort. The field the query sorts by is in `found.sort`, or `"_score"` when it names none.
383
+ - `max_records=100` collects the first 100 matches in the order of `found.sort`. They are the top 100 by a field only
384
+ when the prompt asks for that order, such as "the 100 largest software companies in Germany by employee count".
385
+ Otherwise the sort is `"_score"`, which ranks records by how well they match the query, not by size, date or any
386
+ other field.
387
+ - Every sort field except `id` sorts in descending order, and `id` in ascending order. A prompt that asks for the
388
+ smallest, fewest or oldest records still gets the largest, most or newest first, or the `"_score"` order.
389
+
390
+ `found.entity` names the data the query searches. With `entity="auto"`, collect from the dataset it names. When the
391
+ account runs out of credits, top up and carry on with `resume`: running the query again would pay again for the
392
+ records already collected.
393
+
394
+ ```python
395
+ from coresignal import CompanyMultiSource, EmployeeMultiSource, JobMultiSource, PaymentRequiredError
396
+
397
+ found = client.agentic_search.get_query_by_nl_query("Data engineers in Berlin", entity="auto")
398
+ datasets: dict[str, CompanyMultiSource | EmployeeMultiSource | JobMultiSource] = {
399
+ "company": client.company_multi_source,
400
+ "employee": client.employee_multi_source,
401
+ "job": client.job_multi_source,
402
+ }
403
+ dataset = datasets[found.entity]
404
+
405
+ result = dataset.search_and_collect(found.query, sort=found.sort, max_records=500)
406
+ if isinstance(result.stopped_by, PaymentRequiredError):
407
+ ... # top up the account, then collect the rest
408
+ rest = dataset.search_and_collect(
409
+ found.query, sort=found.sort, max_records=500 - len(result.records), resume=result.resume
410
+ )
411
+ ```
412
+
413
+ ## Collecting many records
414
+
415
+ `collect_many` collects a list of records in the order given. Each ID is one `collect` request, charged like any
416
+ other:
417
+
418
+ ```python
419
+ result = client.company_multi_source.collect_many([12345, 12346, 12347], fields=["id", "company_name"])
420
+
421
+ result.records # {12345: {...}, 12347: {...}}
422
+ result.errors # {12346: NotFoundError(...)}
423
+ result.not_collected # the IDs not tried after the run stopped
424
+ ```
425
+
426
+ - Each record is collected once, even when its ID is given twice or in two forms, such as `1` and `"1"`.
427
+ - Pass the IDs themselves. A semantic search page's `data` holds them in `results`, so pass `page.data["results"]`. A
428
+ mapping or a single string raises `TypeError`.
429
+ - An ID that fails does not stop the others. A `PaymentRequiredError`, `AuthenticationError` or `RateLimitError` does,
430
+ and so does a third `ServerError` in a row: later IDs would fail the same way, so they are listed in `not_collected`.
431
+ - The results come back when the run ends. Collect long lists in batches, for example, one search page at a time,
432
+ and keep each batch's records before the next page:
433
+
434
+ ```python
435
+ from itertools import islice
436
+
437
+ collected = {}
438
+ for page in islice(client.company_multi_source.iter_search_es_dsl(query).pages(), 3): # the first 3 pages
439
+ result = client.company_multi_source.collect_many(page.data)
440
+ collected.update(result.records)
441
+ ```
442
+
443
+ ## Bulk Collect
444
+
445
+ Bulk Collect gets many records in one request: up to 10,000 records by ID, or the records an Elasticsearch DSL query
446
+ matches. The API prepares them as files. Start a request on a dataset, wait for its files, then save them:
447
+
448
+ ```python
449
+ from pathlib import Path
450
+
451
+ started = client.company_multi_source.bulk_collect_es_dsl(query, limit=1000)
452
+ request_id = started.data["request_id"]
453
+
454
+ for file_name in client.data_requests.wait_for_files(request_id):
455
+ client.data_requests.download(request_id, file_name, Path(file_name).name)
456
+ ```
457
+
458
+ - `bulk_collect_ids` takes up to 10,000 IDs, each given once. `bulk_collect_es_dsl` takes the same `query` as
459
+ `search_es_dsl`. A request that matches more than 10,000 records fails, so set a `limit` for a broad query.
460
+ - Credits are deducted for the records a request matches, as the
461
+ [Bulk Collect](https://docs.coresignal.com/api-introduction/requests/bulk-collect) page describes.
462
+ - Pass `webhook_url` to get notified when the data request is ready.
463
+ - A `bulk_collect_es_dsl` request identical to one still in progress, with the same query, `limit` and `webhook_url`,
464
+ raises an `APIStatusError` with status 409. Any other repeat, a repeated `bulk_collect_ids` included, starts a new
465
+ request that is charged again, so a request sent again after a `TransportError` may be charged twice.
466
+ - `wait_for_files` checks every 10 seconds and raises `TimeoutError` after half an hour. Change that with
467
+ `poll_interval` and `max_wait`.
468
+ - `download` saves a file as the API sends it, gzip-compressed JSON, to a path or into a binary file you opened, such as
469
+ an `io.BytesIO`. A path gets the file only once all of it has arrived. Each file can be downloaded for 30 days.
470
+
471
+ `files` checks once, without waiting. Its `data` lists the files in `data_request_files` once the data is ready, and
472
+ has no `data_request_files` before that:
473
+
474
+ ```python
475
+ check = client.data_requests.files(request_id)
476
+ check.data.get("data_request_files") # None until the data is ready
477
+ ```
478
+
479
+ ## Errors and retries
480
+
481
+ Every error from the API or the connection is a `CoresignalError`, and so is a missing or invalid API key when the
482
+ client is created. An invalid argument raises `ValueError`. IDs given to `collect_many` or `bulk_collect_ids` as a
483
+ single string, bytes, a mapping or a value that is not iterable, and a `download` destination of the wrong type, raise
484
+ `TypeError`. When the API answers with an error status, the error is an `APIStatusError`, with the API's own message
485
+ in `message`, and its `status_code`, `body` and `headers`:
486
+
487
+ | Error | Status |
488
+ | --- | --- |
489
+ | `RequestValidationError` | 400, 422 |
490
+ | `AuthenticationError` | 401, 403 |
491
+ | `PaymentRequiredError` | 402 |
492
+ | `NotFoundError` | 404 |
493
+ | `RateLimitError` | 429 |
494
+ | `ServerError` | 500 and above |
495
+ | `APIStatusError` | Any other error status |
496
+
497
+ A `TransportError` means no answer came back, for example because the connection failed.
498
+
499
+ ```python
500
+ from coresignal import NotFoundError, PaymentRequiredError
501
+
502
+ try:
503
+ client.company_multi_source.collect(12345)
504
+ except NotFoundError:
505
+ print("No such company")
506
+ except PaymentRequiredError as error:
507
+ print(error.message)
508
+ ```
509
+
510
+ A request is retried automatically only when it cannot have run: a 429 or 503 response, a refused connection, or a
511
+ connection timeout. The client waits 0.5 seconds before the first retry and doubles the wait each time, up to 60
512
+ seconds. When the API says how long to wait, the client waits that long instead; when that is more than 60 seconds,
513
+ the request is not retried and the error is raised at once, with the wait in `retry_after`. Any other failure is
514
+ raised at once, so your code decides whether to send the request again.
515
+
516
+ By default a request is retried up to 2 times, each step of a request may take up to 60 seconds, and connecting may
517
+ take up to 10 seconds. Change the defaults on the client, or for one request:
518
+
519
+ ```python
520
+ client = Coresignal(timeout=30, max_retries=5)
521
+ client.company_multi_source.collect(12345, timeout=120, max_retries=0)
522
+ ```
523
+
524
+ ## Versioning
525
+
526
+ The SDK follows [Semantic Versioning](https://semver.org/):
527
+
528
+ - While the version is 0.x, a release that breaks the SDK's interface raises the minor version. From 1.0.0 on, it
529
+ raises the major version.
530
+ - The interface is the client, its endpoint groups (`CompanyMultiSource`, `EmployeeMultiSource`, `JobMultiSource`,
531
+ `DataRequests` and `AgenticSearch`), their functions and parameters, `ApiResponse`, `Paginator`,
532
+ `CollectManyResult`, `SearchAndCollectResult`, `SearchAndCollectResume`, `NlQueryResult`, the types in
533
+ `coresignal.types` and the error classes.
534
+ - What the SDK generates from the API's specification follows the API: the fields in responses, the filter keyword
535
+ arguments, the `bundle` values and the type names in `coresignal.types.company_multi_source`,
536
+ `coresignal.types.employee_multi_source` and `coresignal.types.job_multi_source`. When the API adds, removes or
537
+ renames one of these, the SDK changes with it without a major release.
538
+ - A function or parameter is removed only after it has emitted a `DeprecationWarning` that names its replacement for
539
+ at least one minor release.
540
+ - A Python version is dropped only in a minor release, after its end of life.
541
+
542
+ Every release is listed in the
543
+ [changelog](https://github.com/Coresignal-com/coresignal-sdk-python/blob/main/CHANGELOG.md).
544
+
545
+ ## Support
546
+
547
+ Do you have questions about setting the SDK up or about our pricing?
548
+ [Contact us](https://coresignal.com/contact-us/?utm_source=sdk_readme&utm_medium=referral&utm_campaign=sdk_launch_python&utm_content=contact_us).
549
+
550
+ ## About Coresignal
551
+
552
+ [Coresignal](https://coresignal.com/?utm_source=sdk_readme&utm_medium=referral&utm_campaign=sdk_launch_python&utm_content=homepage)
553
+ is a public web data provider that offers multi-source data on companies, jobs, and employees for organizations
554
+ worldwide in investment, sales tech, HR tech, market research, and beyond.
555
+
556
+ ## License
557
+
558
+ MIT. See [LICENSE](https://github.com/Coresignal-com/coresignal-sdk-python/blob/main/LICENSE).
559
+