newscatcher-catchall-sdk 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.
Files changed (74) hide show
  1. newscatcher_catchall_sdk-0.1.0/LICENSE +21 -0
  2. newscatcher_catchall_sdk-0.1.0/PKG-INFO +224 -0
  3. newscatcher_catchall_sdk-0.1.0/README.md +194 -0
  4. newscatcher_catchall_sdk-0.1.0/pyproject.toml +85 -0
  5. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/__init__.py +149 -0
  6. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/client.py +211 -0
  7. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/__init__.py +105 -0
  8. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/api_error.py +23 -0
  9. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/client_wrapper.py +79 -0
  10. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/datetime_utils.py +28 -0
  11. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/file.py +67 -0
  12. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/force_multipart.py +18 -0
  13. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/http_client.py +543 -0
  14. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/http_response.py +55 -0
  15. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/http_sse/__init__.py +42 -0
  16. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/http_sse/_api.py +112 -0
  17. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/http_sse/_decoders.py +61 -0
  18. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/http_sse/_exceptions.py +7 -0
  19. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/http_sse/_models.py +17 -0
  20. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/jsonable_encoder.py +100 -0
  21. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/pydantic_utilities.py +260 -0
  22. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/query_encoder.py +58 -0
  23. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/remove_none_from_dict.py +11 -0
  24. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/request_options.py +35 -0
  25. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/core/serialization.py +276 -0
  26. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/environment.py +7 -0
  27. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/errors/__init__.py +40 -0
  28. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/errors/forbidden_error.py +11 -0
  29. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/errors/not_found_error.py +11 -0
  30. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/errors/unprocessable_entity_error.py +11 -0
  31. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/jobs/__init__.py +4 -0
  32. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/jobs/client.py +389 -0
  33. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/jobs/raw_client.py +538 -0
  34. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/meta/__init__.py +34 -0
  35. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/meta/client.py +161 -0
  36. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/meta/raw_client.py +166 -0
  37. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/meta/types/__init__.py +38 -0
  38. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/meta/types/get_version_response.py +19 -0
  39. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/meta/types/health_check_response.py +19 -0
  40. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/monitors/__init__.py +38 -0
  41. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/monitors/client.py +550 -0
  42. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/monitors/raw_client.py +874 -0
  43. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/monitors/types/__init__.py +40 -0
  44. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/monitors/types/disable_monitor_response.py +19 -0
  45. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/monitors/types/enable_monitor_response.py +19 -0
  46. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/monitors/types/list_monitor_jobs_request_sort.py +5 -0
  47. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/py.typed +0 -0
  48. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/__init__.py +110 -0
  49. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/citation.py +33 -0
  50. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/context.py +3 -0
  51. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/create_monitor_response_dto.py +27 -0
  52. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/error.py +22 -0
  53. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/job_status.py +21 -0
  54. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/list_monitors_response_dto.py +28 -0
  55. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/list_user_jobs_response_dto.py +27 -0
  56. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/monitor_job_item.py +42 -0
  57. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/monitor_list_item.py +53 -0
  58. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/pull_job_response_dto.py +80 -0
  59. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/pull_job_response_dto_date_range.py +21 -0
  60. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/pull_monitor_response_dto.py +69 -0
  61. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/pull_monitor_response_dto_date_range.py +32 -0
  62. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/pull_monitor_response_dto_reference_job.py +31 -0
  63. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/query.py +3 -0
  64. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/record.py +40 -0
  65. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/schema.py +3 -0
  66. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/status_response_dto.py +25 -0
  67. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/submit_response_body.py +22 -0
  68. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/validation_error_detail.py +33 -0
  69. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/validation_error_detail_loc_item.py +5 -0
  70. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/validation_error_response.py +20 -0
  71. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/webhook_dto.py +43 -0
  72. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/webhook_dto_method.py +5 -0
  73. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/types/webhook_payload.py +44 -0
  74. newscatcher_catchall_sdk-0.1.0/src/newscatcher_catchall/version.py +3 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Newscatcher
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,224 @@
1
+ Metadata-Version: 2.1
2
+ Name: newscatcher-catchall-sdk
3
+ Version: 0.1.0
4
+ Summary:
5
+ License: MIT
6
+ Requires-Python: >=3.8,<4.0
7
+ Classifier: Intended Audience :: Developers
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: MacOS
10
+ Classifier: Operating System :: Microsoft :: Windows
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Operating System :: POSIX
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Requires-Dist: httpx (>=0.21.2)
24
+ Requires-Dist: pydantic (>=1.9.2)
25
+ Requires-Dist: pydantic-core (>=2.18.2)
26
+ Requires-Dist: typing_extensions (>=4.0.0)
27
+ Project-URL: Repository, https://github.com/Newscatcher/newscatcher-catchall-python
28
+ Description-Content-Type: text/markdown
29
+
30
+ # Newscatcher CatchAll Python Library
31
+
32
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FNewscatcher%2Fnewscatcher-catchall-python)
33
+ [![pypi](https://img.shields.io/pypi/v/newscatcher-catchall-sdk)](https://pypi.python.org/pypi/newscatcher-catchall-sdk)
34
+
35
+ The Newscatcher CatchAll Python library provides access to the [CatchAll API](https://www.newscatcherapi.com/docs/v3/catch-all/overview/introduction), which transforms natural language queries into structured data extracted from web sources.
36
+
37
+ ## Installation
38
+
39
+ ```sh
40
+ pip install newscatcher-catchall-sdk
41
+ ```
42
+
43
+ ## Reference
44
+
45
+ A full reference for this library is available [here](./reference.md).
46
+
47
+ ## Usage
48
+
49
+ ### Jobs
50
+
51
+ Submit a query and retrieve structured results:
52
+
53
+ ```python
54
+ from newscatcher_catchall import CatchAllApi
55
+ import time
56
+
57
+ client = CatchAllApi(api_key="YOUR_API_KEY")
58
+
59
+ # Create a job
60
+ job = client.jobs.create_job(
61
+ query="Tech company earnings this quarter",
62
+ context="Focus on revenue and profit margins",
63
+ schema="Company [NAME] earned [REVENUE] in [QUARTER]",
64
+ )
65
+
66
+ # Poll for completion
67
+ while True:
68
+ status = client.jobs.get_job_status(job.job_id)
69
+ if status.status == "job_completed":
70
+ break
71
+ time.sleep(60)
72
+
73
+ # Retrieve results
74
+ results = client.jobs.get_job_results(job.job_id)
75
+ for record in results.all_records:
76
+ print(record.record_title)
77
+ print(record.enrichment)
78
+ ```
79
+
80
+ Jobs process asynchronously and typically complete in 10-15 minutes. To learn more, see the [Quickstart](https://www.newscatcherapi.com/docs/v3/catch-all/overview/quickstart).
81
+
82
+ ### Monitors
83
+
84
+ Automate recurring queries with scheduled execution:
85
+
86
+ ```python
87
+ from newscatcher_catchall import CatchAllApi
88
+
89
+ client = CatchAllApi(api_key="YOUR_API_KEY")
90
+
91
+ # Create a monitor from a completed job
92
+ monitor = client.monitors.create_monitor(
93
+ reference_job_id=job.job_id,
94
+ schedule="every day at 12 PM UTC",
95
+ webhook={
96
+ "url": "https://your-endpoint.com/webhook",
97
+ "method": "POST",
98
+ "headers": {"Authorization": "Bearer YOUR_TOKEN"},
99
+ },
100
+ )
101
+
102
+ # List all monitors
103
+ monitors = client.monitors.list_monitors()
104
+
105
+ # Get aggregated results
106
+ results = client.monitors.pull_monitor_results(monitor.monitor_id)
107
+ ```
108
+
109
+ Monitors run jobs on your schedule and send webhook notifications when complete. See the [Monitors documentation](https://www.newscatcherapi.com/docs/v3/catch-all/overview/monitors) for setup and configuration.
110
+
111
+ ## Async client
112
+
113
+ Use the async client for non-blocking API calls:
114
+
115
+ ```python
116
+ import asyncio
117
+ from newscatcher_catchall import AsyncCatchAllApi
118
+
119
+ client = AsyncCatchAllApi(api_key="YOUR_API_KEY")
120
+
121
+ async def main() -> None:
122
+ job = await client.jobs.create_job(
123
+ query="Tech company earnings this quarter",
124
+ context="Focus on revenue and profit margins",
125
+ )
126
+ print(f"Job created: {job.job_id}")
127
+
128
+ asyncio.run(main())
129
+ ```
130
+
131
+ ## Exception handling
132
+
133
+ Handle API errors with the `ApiError` exception:
134
+
135
+ ```python
136
+ from newscatcher_catchall.core.api_error import ApiError
137
+
138
+ try:
139
+ client.jobs.create_job(query="...")
140
+ except ApiError as e:
141
+ print(f"Status: {e.status_code}")
142
+ print(f"Error: {e.body}")
143
+ ```
144
+
145
+ ## Advanced
146
+
147
+ ### Pagination
148
+
149
+ Retrieve large result sets with pagination:
150
+
151
+ ```python
152
+ results = client.jobs.get_job_results(
153
+ job_id="...",
154
+ page=1,
155
+ page_size=100, # Default: 100, Max: 1000
156
+ )
157
+ ```
158
+
159
+ ### Access raw response data
160
+
161
+ Access response headers and raw data:
162
+
163
+ ```python
164
+ response = client.jobs.with_raw_response.create_job(query="...")
165
+ print(response.headers)
166
+ print(response.data)
167
+ ```
168
+
169
+ ### Retries
170
+
171
+ The SDK retries failed requests automatically with exponential backoff. Configure retry behavior:
172
+
173
+ ```python
174
+ client.jobs.create_job(
175
+ query="...",
176
+ request_options={"max_retries": 3},
177
+ )
178
+ ```
179
+
180
+ ### Timeouts
181
+
182
+ Set custom timeouts at the client or request level:
183
+
184
+ ```python
185
+ # Client-level timeout
186
+ client = CatchAllApi(api_key="YOUR_API_KEY", timeout=30.0)
187
+
188
+ # Request-level timeout
189
+ client.jobs.create_job(
190
+ query="...",
191
+ request_options={"timeout_in_seconds": 10},
192
+ )
193
+ ```
194
+
195
+ ### Custom HTTP client
196
+
197
+ Customize the underlying HTTP client for proxies or custom transports:
198
+
199
+ ```python
200
+ import httpx
201
+ from newscatcher_catchall import CatchAllApi
202
+
203
+ client = CatchAllApi(
204
+ api_key="YOUR_API_KEY",
205
+ httpx_client=httpx.Client(
206
+ proxy="http://my.proxy.example.com",
207
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
208
+ ),
209
+ )
210
+ ```
211
+
212
+ ## Beta status
213
+
214
+ CatchAll API is in beta. Breaking changes may occur in minor version updates. See the [Changelog](https://www.newscatcherapi.com/docs/v3/catch-all/overview/changelog) for updates.
215
+
216
+ ## Contributing
217
+
218
+ This library is generated programmatically from our API specification. Direct contributions to the generated code cannot be merged, but README improvements are welcome. To suggest SDK changes, please [open an issue](https://github.com/Newscatcher/newscatcher-catchall-python/issues).
219
+
220
+ ## Support
221
+
222
+ - Documentation: [https://www.newscatcherapi.com/docs/v3/catch-all](https://www.newscatcherapi.com/docs/v3/catch-all)
223
+ - Support: <support@newscatcherapi.com>
224
+
@@ -0,0 +1,194 @@
1
+ # Newscatcher CatchAll Python Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FNewscatcher%2Fnewscatcher-catchall-python)
4
+ [![pypi](https://img.shields.io/pypi/v/newscatcher-catchall-sdk)](https://pypi.python.org/pypi/newscatcher-catchall-sdk)
5
+
6
+ The Newscatcher CatchAll Python library provides access to the [CatchAll API](https://www.newscatcherapi.com/docs/v3/catch-all/overview/introduction), which transforms natural language queries into structured data extracted from web sources.
7
+
8
+ ## Installation
9
+
10
+ ```sh
11
+ pip install newscatcher-catchall-sdk
12
+ ```
13
+
14
+ ## Reference
15
+
16
+ A full reference for this library is available [here](./reference.md).
17
+
18
+ ## Usage
19
+
20
+ ### Jobs
21
+
22
+ Submit a query and retrieve structured results:
23
+
24
+ ```python
25
+ from newscatcher_catchall import CatchAllApi
26
+ import time
27
+
28
+ client = CatchAllApi(api_key="YOUR_API_KEY")
29
+
30
+ # Create a job
31
+ job = client.jobs.create_job(
32
+ query="Tech company earnings this quarter",
33
+ context="Focus on revenue and profit margins",
34
+ schema="Company [NAME] earned [REVENUE] in [QUARTER]",
35
+ )
36
+
37
+ # Poll for completion
38
+ while True:
39
+ status = client.jobs.get_job_status(job.job_id)
40
+ if status.status == "job_completed":
41
+ break
42
+ time.sleep(60)
43
+
44
+ # Retrieve results
45
+ results = client.jobs.get_job_results(job.job_id)
46
+ for record in results.all_records:
47
+ print(record.record_title)
48
+ print(record.enrichment)
49
+ ```
50
+
51
+ Jobs process asynchronously and typically complete in 10-15 minutes. To learn more, see the [Quickstart](https://www.newscatcherapi.com/docs/v3/catch-all/overview/quickstart).
52
+
53
+ ### Monitors
54
+
55
+ Automate recurring queries with scheduled execution:
56
+
57
+ ```python
58
+ from newscatcher_catchall import CatchAllApi
59
+
60
+ client = CatchAllApi(api_key="YOUR_API_KEY")
61
+
62
+ # Create a monitor from a completed job
63
+ monitor = client.monitors.create_monitor(
64
+ reference_job_id=job.job_id,
65
+ schedule="every day at 12 PM UTC",
66
+ webhook={
67
+ "url": "https://your-endpoint.com/webhook",
68
+ "method": "POST",
69
+ "headers": {"Authorization": "Bearer YOUR_TOKEN"},
70
+ },
71
+ )
72
+
73
+ # List all monitors
74
+ monitors = client.monitors.list_monitors()
75
+
76
+ # Get aggregated results
77
+ results = client.monitors.pull_monitor_results(monitor.monitor_id)
78
+ ```
79
+
80
+ Monitors run jobs on your schedule and send webhook notifications when complete. See the [Monitors documentation](https://www.newscatcherapi.com/docs/v3/catch-all/overview/monitors) for setup and configuration.
81
+
82
+ ## Async client
83
+
84
+ Use the async client for non-blocking API calls:
85
+
86
+ ```python
87
+ import asyncio
88
+ from newscatcher_catchall import AsyncCatchAllApi
89
+
90
+ client = AsyncCatchAllApi(api_key="YOUR_API_KEY")
91
+
92
+ async def main() -> None:
93
+ job = await client.jobs.create_job(
94
+ query="Tech company earnings this quarter",
95
+ context="Focus on revenue and profit margins",
96
+ )
97
+ print(f"Job created: {job.job_id}")
98
+
99
+ asyncio.run(main())
100
+ ```
101
+
102
+ ## Exception handling
103
+
104
+ Handle API errors with the `ApiError` exception:
105
+
106
+ ```python
107
+ from newscatcher_catchall.core.api_error import ApiError
108
+
109
+ try:
110
+ client.jobs.create_job(query="...")
111
+ except ApiError as e:
112
+ print(f"Status: {e.status_code}")
113
+ print(f"Error: {e.body}")
114
+ ```
115
+
116
+ ## Advanced
117
+
118
+ ### Pagination
119
+
120
+ Retrieve large result sets with pagination:
121
+
122
+ ```python
123
+ results = client.jobs.get_job_results(
124
+ job_id="...",
125
+ page=1,
126
+ page_size=100, # Default: 100, Max: 1000
127
+ )
128
+ ```
129
+
130
+ ### Access raw response data
131
+
132
+ Access response headers and raw data:
133
+
134
+ ```python
135
+ response = client.jobs.with_raw_response.create_job(query="...")
136
+ print(response.headers)
137
+ print(response.data)
138
+ ```
139
+
140
+ ### Retries
141
+
142
+ The SDK retries failed requests automatically with exponential backoff. Configure retry behavior:
143
+
144
+ ```python
145
+ client.jobs.create_job(
146
+ query="...",
147
+ request_options={"max_retries": 3},
148
+ )
149
+ ```
150
+
151
+ ### Timeouts
152
+
153
+ Set custom timeouts at the client or request level:
154
+
155
+ ```python
156
+ # Client-level timeout
157
+ client = CatchAllApi(api_key="YOUR_API_KEY", timeout=30.0)
158
+
159
+ # Request-level timeout
160
+ client.jobs.create_job(
161
+ query="...",
162
+ request_options={"timeout_in_seconds": 10},
163
+ )
164
+ ```
165
+
166
+ ### Custom HTTP client
167
+
168
+ Customize the underlying HTTP client for proxies or custom transports:
169
+
170
+ ```python
171
+ import httpx
172
+ from newscatcher_catchall import CatchAllApi
173
+
174
+ client = CatchAllApi(
175
+ api_key="YOUR_API_KEY",
176
+ httpx_client=httpx.Client(
177
+ proxy="http://my.proxy.example.com",
178
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
179
+ ),
180
+ )
181
+ ```
182
+
183
+ ## Beta status
184
+
185
+ CatchAll API is in beta. Breaking changes may occur in minor version updates. See the [Changelog](https://www.newscatcherapi.com/docs/v3/catch-all/overview/changelog) for updates.
186
+
187
+ ## Contributing
188
+
189
+ This library is generated programmatically from our API specification. Direct contributions to the generated code cannot be merged, but README improvements are welcome. To suggest SDK changes, please [open an issue](https://github.com/Newscatcher/newscatcher-catchall-python/issues).
190
+
191
+ ## Support
192
+
193
+ - Documentation: [https://www.newscatcherapi.com/docs/v3/catch-all](https://www.newscatcherapi.com/docs/v3/catch-all)
194
+ - Support: <support@newscatcherapi.com>
@@ -0,0 +1,85 @@
1
+ [project]
2
+ name = "newscatcher-catchall-sdk"
3
+
4
+ [tool.poetry]
5
+ name = "newscatcher-catchall-sdk"
6
+ version = "0.1.0"
7
+ description = ""
8
+ readme = "README.md"
9
+ authors = []
10
+ keywords = []
11
+ license = "MIT"
12
+ classifiers = [
13
+ "Intended Audience :: Developers",
14
+ "Programming Language :: Python",
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
+ "Operating System :: OS Independent",
22
+ "Operating System :: POSIX",
23
+ "Operating System :: MacOS",
24
+ "Operating System :: POSIX :: Linux",
25
+ "Operating System :: Microsoft :: Windows",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ "Typing :: Typed",
28
+ "License :: OSI Approved :: MIT License"
29
+ ]
30
+ packages = [
31
+ { include = "newscatcher_catchall", from = "src"}
32
+ ]
33
+
34
+ [tool.poetry.urls]
35
+ Repository = 'https://github.com/Newscatcher/newscatcher-catchall-python'
36
+
37
+ [tool.poetry.dependencies]
38
+ python = "^3.8"
39
+ httpx = ">=0.21.2"
40
+ pydantic = ">= 1.9.2"
41
+ pydantic-core = ">=2.18.2"
42
+ typing_extensions = ">= 4.0.0"
43
+
44
+ [tool.poetry.group.dev.dependencies]
45
+ mypy = "==1.13.0"
46
+ pytest = "^7.4.0"
47
+ pytest-asyncio = "^0.23.5"
48
+ python-dateutil = "^2.9.0"
49
+ types-python-dateutil = "^2.9.0.20240316"
50
+ ruff = "==0.11.5"
51
+
52
+ [tool.pytest.ini_options]
53
+ testpaths = [ "tests" ]
54
+ asyncio_mode = "auto"
55
+
56
+ [tool.mypy]
57
+ plugins = ["pydantic.mypy"]
58
+
59
+ [tool.ruff]
60
+ line-length = 120
61
+
62
+ [tool.ruff.lint]
63
+ select = [
64
+ "E", # pycodestyle errors
65
+ "F", # pyflakes
66
+ "I", # isort
67
+ ]
68
+ ignore = [
69
+ "E402", # Module level import not at top of file
70
+ "E501", # Line too long
71
+ "E711", # Comparison to `None` should be `cond is not None`
72
+ "E712", # Avoid equality comparisons to `True`; use `if ...:` checks
73
+ "E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for insinstance checks
74
+ "E722", # Do not use bare `except`
75
+ "E731", # Do not assign a `lambda` expression, use a `def`
76
+ "F821", # Undefined name
77
+ "F841" # Local variable ... is assigned to but never used
78
+ ]
79
+
80
+ [tool.ruff.lint.isort]
81
+ section-order = ["future", "standard-library", "third-party", "first-party"]
82
+
83
+ [build-system]
84
+ requires = ["poetry-core"]
85
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,149 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .types import (
10
+ Citation,
11
+ Context,
12
+ CreateMonitorResponseDto,
13
+ Error,
14
+ JobStatus,
15
+ ListMonitorsResponseDto,
16
+ ListUserJobsResponseDto,
17
+ MonitorJobItem,
18
+ MonitorListItem,
19
+ PullJobResponseDto,
20
+ PullJobResponseDtoDateRange,
21
+ PullMonitorResponseDto,
22
+ PullMonitorResponseDtoDateRange,
23
+ PullMonitorResponseDtoReferenceJob,
24
+ Query,
25
+ Record,
26
+ Schema,
27
+ StatusResponseDto,
28
+ SubmitResponseBody,
29
+ ValidationErrorDetail,
30
+ ValidationErrorDetailLocItem,
31
+ ValidationErrorResponse,
32
+ WebhookDto,
33
+ WebhookDtoMethod,
34
+ WebhookPayload,
35
+ )
36
+ from .errors import ForbiddenError, NotFoundError, UnprocessableEntityError
37
+ from . import jobs, meta, monitors
38
+ from .client import AsyncCatchAllApi, CatchAllApi
39
+ from .environment import CatchAllApiEnvironment
40
+ from .meta import GetVersionResponse, HealthCheckResponse
41
+ from .monitors import DisableMonitorResponse, EnableMonitorResponse, ListMonitorJobsRequestSort
42
+ from .version import __version__
43
+ _dynamic_imports: typing.Dict[str, str] = {
44
+ "AsyncCatchAllApi": ".client",
45
+ "CatchAllApi": ".client",
46
+ "CatchAllApiEnvironment": ".environment",
47
+ "Citation": ".types",
48
+ "Context": ".types",
49
+ "CreateMonitorResponseDto": ".types",
50
+ "DisableMonitorResponse": ".monitors",
51
+ "EnableMonitorResponse": ".monitors",
52
+ "Error": ".types",
53
+ "ForbiddenError": ".errors",
54
+ "GetVersionResponse": ".meta",
55
+ "HealthCheckResponse": ".meta",
56
+ "JobStatus": ".types",
57
+ "ListMonitorJobsRequestSort": ".monitors",
58
+ "ListMonitorsResponseDto": ".types",
59
+ "ListUserJobsResponseDto": ".types",
60
+ "MonitorJobItem": ".types",
61
+ "MonitorListItem": ".types",
62
+ "NotFoundError": ".errors",
63
+ "PullJobResponseDto": ".types",
64
+ "PullJobResponseDtoDateRange": ".types",
65
+ "PullMonitorResponseDto": ".types",
66
+ "PullMonitorResponseDtoDateRange": ".types",
67
+ "PullMonitorResponseDtoReferenceJob": ".types",
68
+ "Query": ".types",
69
+ "Record": ".types",
70
+ "Schema": ".types",
71
+ "StatusResponseDto": ".types",
72
+ "SubmitResponseBody": ".types",
73
+ "UnprocessableEntityError": ".errors",
74
+ "ValidationErrorDetail": ".types",
75
+ "ValidationErrorDetailLocItem": ".types",
76
+ "ValidationErrorResponse": ".types",
77
+ "WebhookDto": ".types",
78
+ "WebhookDtoMethod": ".types",
79
+ "WebhookPayload": ".types",
80
+ "__version__": ".version",
81
+ "jobs": ".jobs",
82
+ "meta": ".meta",
83
+ "monitors": ".monitors",
84
+ }
85
+
86
+
87
+ def __getattr__(attr_name: str) -> typing.Any:
88
+ module_name = _dynamic_imports.get(attr_name)
89
+ if module_name is None:
90
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
91
+ try:
92
+ module = import_module(module_name, __package__)
93
+ if module_name == f".{attr_name}":
94
+ return module
95
+ else:
96
+ return getattr(module, attr_name)
97
+ except ImportError as e:
98
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
99
+ except AttributeError as e:
100
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
101
+
102
+
103
+ def __dir__():
104
+ lazy_attrs = list(_dynamic_imports.keys())
105
+ return sorted(lazy_attrs)
106
+
107
+
108
+ __all__ = [
109
+ "AsyncCatchAllApi",
110
+ "CatchAllApi",
111
+ "CatchAllApiEnvironment",
112
+ "Citation",
113
+ "Context",
114
+ "CreateMonitorResponseDto",
115
+ "DisableMonitorResponse",
116
+ "EnableMonitorResponse",
117
+ "Error",
118
+ "ForbiddenError",
119
+ "GetVersionResponse",
120
+ "HealthCheckResponse",
121
+ "JobStatus",
122
+ "ListMonitorJobsRequestSort",
123
+ "ListMonitorsResponseDto",
124
+ "ListUserJobsResponseDto",
125
+ "MonitorJobItem",
126
+ "MonitorListItem",
127
+ "NotFoundError",
128
+ "PullJobResponseDto",
129
+ "PullJobResponseDtoDateRange",
130
+ "PullMonitorResponseDto",
131
+ "PullMonitorResponseDtoDateRange",
132
+ "PullMonitorResponseDtoReferenceJob",
133
+ "Query",
134
+ "Record",
135
+ "Schema",
136
+ "StatusResponseDto",
137
+ "SubmitResponseBody",
138
+ "UnprocessableEntityError",
139
+ "ValidationErrorDetail",
140
+ "ValidationErrorDetailLocItem",
141
+ "ValidationErrorResponse",
142
+ "WebhookDto",
143
+ "WebhookDtoMethod",
144
+ "WebhookPayload",
145
+ "__version__",
146
+ "jobs",
147
+ "meta",
148
+ "monitors",
149
+ ]