cartography-client 0.0.1__py3-none-any.whl

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.

Potentially problematic release.


This version of cartography-client might be problematic. Click here for more details.

Files changed (70) hide show
  1. cartography/__init__.py +100 -0
  2. cartography/_base_client.py +1995 -0
  3. cartography/_client.py +444 -0
  4. cartography/_compat.py +219 -0
  5. cartography/_constants.py +14 -0
  6. cartography/_exceptions.py +108 -0
  7. cartography/_files.py +123 -0
  8. cartography/_models.py +829 -0
  9. cartography/_qs.py +150 -0
  10. cartography/_resource.py +43 -0
  11. cartography/_response.py +832 -0
  12. cartography/_streaming.py +333 -0
  13. cartography/_types.py +219 -0
  14. cartography/_utils/__init__.py +57 -0
  15. cartography/_utils/_logs.py +25 -0
  16. cartography/_utils/_proxy.py +65 -0
  17. cartography/_utils/_reflection.py +42 -0
  18. cartography/_utils/_resources_proxy.py +24 -0
  19. cartography/_utils/_streams.py +12 -0
  20. cartography/_utils/_sync.py +86 -0
  21. cartography/_utils/_transform.py +447 -0
  22. cartography/_utils/_typing.py +151 -0
  23. cartography/_utils/_utils.py +422 -0
  24. cartography/_version.py +4 -0
  25. cartography/lib/.keep +4 -0
  26. cartography/py.typed +0 -0
  27. cartography/resources/__init__.py +89 -0
  28. cartography/resources/api_info.py +135 -0
  29. cartography/resources/crawl.py +279 -0
  30. cartography/resources/download.py +376 -0
  31. cartography/resources/health.py +143 -0
  32. cartography/resources/scrape.py +331 -0
  33. cartography/resources/workflows/__init__.py +33 -0
  34. cartography/resources/workflows/request/__init__.py +33 -0
  35. cartography/resources/workflows/request/crawl.py +295 -0
  36. cartography/resources/workflows/request/request.py +221 -0
  37. cartography/resources/workflows/workflows.py +274 -0
  38. cartography/types/__init__.py +23 -0
  39. cartography/types/api_info_retrieve_response.py +8 -0
  40. cartography/types/bulk_download_result.py +23 -0
  41. cartography/types/bulk_scrape_result.py +19 -0
  42. cartography/types/crawl_create_graph_params.py +46 -0
  43. cartography/types/crawl_create_graph_response.py +37 -0
  44. cartography/types/download_create_bulk_params.py +37 -0
  45. cartography/types/download_create_bulk_response.py +41 -0
  46. cartography/types/download_create_single_params.py +32 -0
  47. cartography/types/download_create_single_response.py +21 -0
  48. cartography/types/downloader_type.py +7 -0
  49. cartography/types/health_check_response.py +8 -0
  50. cartography/types/scrape_engine_param.py +28 -0
  51. cartography/types/scrape_scrape_bulk_params.py +33 -0
  52. cartography/types/scrape_scrape_bulk_response.py +41 -0
  53. cartography/types/scrape_scrape_single_params.py +17 -0
  54. cartography/types/scrape_scrape_single_response.py +23 -0
  55. cartography/types/wait_until.py +7 -0
  56. cartography/types/workflow_describe_response.py +8 -0
  57. cartography/types/workflow_results_response.py +8 -0
  58. cartography/types/workflows/__init__.py +6 -0
  59. cartography/types/workflows/request/__init__.py +9 -0
  60. cartography/types/workflows/request/crawl_create_bulk_params.py +14 -0
  61. cartography/types/workflows/request/crawl_create_bulk_response.py +22 -0
  62. cartography/types/workflows/request/crawl_create_params.py +32 -0
  63. cartography/types/workflows/request/crawl_request_param.py +32 -0
  64. cartography/types/workflows/request/workflow_result.py +11 -0
  65. cartography/types/workflows/request_create_download_params.py +18 -0
  66. cartography/types/workflows/request_create_download_response.py +8 -0
  67. cartography_client-0.0.1.dist-info/METADATA +399 -0
  68. cartography_client-0.0.1.dist-info/RECORD +70 -0
  69. cartography_client-0.0.1.dist-info/WHEEL +4 -0
  70. cartography_client-0.0.1.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,376 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import List, Optional
6
+
7
+ import httpx
8
+
9
+ from ..types import WaitUntil, DownloaderType, download_create_bulk_params, download_create_single_params
10
+ from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11
+ from .._utils import maybe_transform, async_maybe_transform
12
+ from .._compat import cached_property
13
+ from .._resource import SyncAPIResource, AsyncAPIResource
14
+ from .._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from .._base_client import make_request_options
21
+ from ..types.wait_until import WaitUntil
22
+ from ..types.downloader_type import DownloaderType
23
+ from ..types.download_create_bulk_response import DownloadCreateBulkResponse
24
+ from ..types.download_create_single_response import DownloadCreateSingleResponse
25
+
26
+ __all__ = ["DownloadResource", "AsyncDownloadResource"]
27
+
28
+
29
+ class DownloadResource(SyncAPIResource):
30
+ @cached_property
31
+ def with_raw_response(self) -> DownloadResourceWithRawResponse:
32
+ """
33
+ This property can be used as a prefix for any HTTP method call to return
34
+ the raw response object instead of the parsed content.
35
+
36
+ For more information, see https://www.github.com/evrimai/cartography-client#accessing-raw-response-data-eg-headers
37
+ """
38
+ return DownloadResourceWithRawResponse(self)
39
+
40
+ @cached_property
41
+ def with_streaming_response(self) -> DownloadResourceWithStreamingResponse:
42
+ """
43
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
44
+
45
+ For more information, see https://www.github.com/evrimai/cartography-client#with_streaming_response
46
+ """
47
+ return DownloadResourceWithStreamingResponse(self)
48
+
49
+ def create_bulk(
50
+ self,
51
+ *,
52
+ crawl_id: str,
53
+ s3_bucket: str,
54
+ urls: List[str],
55
+ batch_size: int | NotGiven = NOT_GIVEN,
56
+ debug: bool | NotGiven = NOT_GIVEN,
57
+ downloader_type: DownloaderType | NotGiven = NOT_GIVEN,
58
+ max_workers: int | NotGiven = NOT_GIVEN,
59
+ wait_until: WaitUntil | NotGiven = NOT_GIVEN,
60
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61
+ # The extra values given here take precedence over values defined on the client or passed to this method.
62
+ extra_headers: Headers | None = None,
63
+ extra_query: Query | None = None,
64
+ extra_body: Body | None = None,
65
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
66
+ ) -> DownloadCreateBulkResponse:
67
+ """
68
+ Bulk download multiple files with checkpointing to S3
69
+
70
+ Requires permission: download:write
71
+
72
+ Args:
73
+ crawl_id: Unique identifier for this crawl
74
+
75
+ s3_bucket: S3 bucket for storage and checkpoints
76
+
77
+ urls: List of URLs to download
78
+
79
+ batch_size: URLs per batch
80
+
81
+ debug: Enable debug information
82
+
83
+ downloader_type: Available downloader types
84
+
85
+ max_workers: Maximum concurrent workers
86
+
87
+ wait_until: When to consider downloads complete
88
+
89
+ extra_headers: Send extra headers
90
+
91
+ extra_query: Add additional query parameters to the request
92
+
93
+ extra_body: Add additional JSON properties to the request
94
+
95
+ timeout: Override the client-level default timeout for this request, in seconds
96
+ """
97
+ return self._post(
98
+ "/download/bulk",
99
+ body=maybe_transform(
100
+ {
101
+ "crawl_id": crawl_id,
102
+ "s3_bucket": s3_bucket,
103
+ "urls": urls,
104
+ "batch_size": batch_size,
105
+ "debug": debug,
106
+ "downloader_type": downloader_type,
107
+ "max_workers": max_workers,
108
+ "wait_until": wait_until,
109
+ },
110
+ download_create_bulk_params.DownloadCreateBulkParams,
111
+ ),
112
+ options=make_request_options(
113
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
114
+ ),
115
+ cast_to=DownloadCreateBulkResponse,
116
+ )
117
+
118
+ def create_single(
119
+ self,
120
+ *,
121
+ s3_bucket: str,
122
+ url: str,
123
+ downloader_type: DownloaderType | NotGiven = NOT_GIVEN,
124
+ s3_key: Optional[str] | NotGiven = NOT_GIVEN,
125
+ api_timeout: int | NotGiven = NOT_GIVEN,
126
+ wait_until: WaitUntil | NotGiven = NOT_GIVEN,
127
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
128
+ # The extra values given here take precedence over values defined on the client or passed to this method.
129
+ extra_headers: Headers | None = None,
130
+ extra_query: Query | None = None,
131
+ extra_body: Body | None = None,
132
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
133
+ ) -> DownloadCreateSingleResponse:
134
+ """
135
+ Download a single file to S3
136
+
137
+ Requires permission: download:write
138
+
139
+ Args:
140
+ s3_bucket: S3 bucket for storage
141
+
142
+ url: URL to download
143
+
144
+ downloader_type: Available downloader types
145
+
146
+ s3_key: S3 key for the file
147
+
148
+ api_timeout: Timeout in milliseconds
149
+
150
+ wait_until: When to consider download complete
151
+
152
+ extra_headers: Send extra headers
153
+
154
+ extra_query: Add additional query parameters to the request
155
+
156
+ extra_body: Add additional JSON properties to the request
157
+
158
+ timeout: Override the client-level default timeout for this request, in seconds
159
+ """
160
+ return self._post(
161
+ "/download/single",
162
+ body=maybe_transform(
163
+ {
164
+ "s3_bucket": s3_bucket,
165
+ "url": url,
166
+ "downloader_type": downloader_type,
167
+ "s3_key": s3_key,
168
+ "api_timeout": api_timeout,
169
+ "wait_until": wait_until,
170
+ },
171
+ download_create_single_params.DownloadCreateSingleParams,
172
+ ),
173
+ options=make_request_options(
174
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
175
+ ),
176
+ cast_to=DownloadCreateSingleResponse,
177
+ )
178
+
179
+
180
+ class AsyncDownloadResource(AsyncAPIResource):
181
+ @cached_property
182
+ def with_raw_response(self) -> AsyncDownloadResourceWithRawResponse:
183
+ """
184
+ This property can be used as a prefix for any HTTP method call to return
185
+ the raw response object instead of the parsed content.
186
+
187
+ For more information, see https://www.github.com/evrimai/cartography-client#accessing-raw-response-data-eg-headers
188
+ """
189
+ return AsyncDownloadResourceWithRawResponse(self)
190
+
191
+ @cached_property
192
+ def with_streaming_response(self) -> AsyncDownloadResourceWithStreamingResponse:
193
+ """
194
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
195
+
196
+ For more information, see https://www.github.com/evrimai/cartography-client#with_streaming_response
197
+ """
198
+ return AsyncDownloadResourceWithStreamingResponse(self)
199
+
200
+ async def create_bulk(
201
+ self,
202
+ *,
203
+ crawl_id: str,
204
+ s3_bucket: str,
205
+ urls: List[str],
206
+ batch_size: int | NotGiven = NOT_GIVEN,
207
+ debug: bool | NotGiven = NOT_GIVEN,
208
+ downloader_type: DownloaderType | NotGiven = NOT_GIVEN,
209
+ max_workers: int | NotGiven = NOT_GIVEN,
210
+ wait_until: WaitUntil | NotGiven = NOT_GIVEN,
211
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
212
+ # The extra values given here take precedence over values defined on the client or passed to this method.
213
+ extra_headers: Headers | None = None,
214
+ extra_query: Query | None = None,
215
+ extra_body: Body | None = None,
216
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
217
+ ) -> DownloadCreateBulkResponse:
218
+ """
219
+ Bulk download multiple files with checkpointing to S3
220
+
221
+ Requires permission: download:write
222
+
223
+ Args:
224
+ crawl_id: Unique identifier for this crawl
225
+
226
+ s3_bucket: S3 bucket for storage and checkpoints
227
+
228
+ urls: List of URLs to download
229
+
230
+ batch_size: URLs per batch
231
+
232
+ debug: Enable debug information
233
+
234
+ downloader_type: Available downloader types
235
+
236
+ max_workers: Maximum concurrent workers
237
+
238
+ wait_until: When to consider downloads complete
239
+
240
+ extra_headers: Send extra headers
241
+
242
+ extra_query: Add additional query parameters to the request
243
+
244
+ extra_body: Add additional JSON properties to the request
245
+
246
+ timeout: Override the client-level default timeout for this request, in seconds
247
+ """
248
+ return await self._post(
249
+ "/download/bulk",
250
+ body=await async_maybe_transform(
251
+ {
252
+ "crawl_id": crawl_id,
253
+ "s3_bucket": s3_bucket,
254
+ "urls": urls,
255
+ "batch_size": batch_size,
256
+ "debug": debug,
257
+ "downloader_type": downloader_type,
258
+ "max_workers": max_workers,
259
+ "wait_until": wait_until,
260
+ },
261
+ download_create_bulk_params.DownloadCreateBulkParams,
262
+ ),
263
+ options=make_request_options(
264
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
265
+ ),
266
+ cast_to=DownloadCreateBulkResponse,
267
+ )
268
+
269
+ async def create_single(
270
+ self,
271
+ *,
272
+ s3_bucket: str,
273
+ url: str,
274
+ downloader_type: DownloaderType | NotGiven = NOT_GIVEN,
275
+ s3_key: Optional[str] | NotGiven = NOT_GIVEN,
276
+ api_timeout: int | NotGiven = NOT_GIVEN,
277
+ wait_until: WaitUntil | NotGiven = NOT_GIVEN,
278
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
279
+ # The extra values given here take precedence over values defined on the client or passed to this method.
280
+ extra_headers: Headers | None = None,
281
+ extra_query: Query | None = None,
282
+ extra_body: Body | None = None,
283
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
284
+ ) -> DownloadCreateSingleResponse:
285
+ """
286
+ Download a single file to S3
287
+
288
+ Requires permission: download:write
289
+
290
+ Args:
291
+ s3_bucket: S3 bucket for storage
292
+
293
+ url: URL to download
294
+
295
+ downloader_type: Available downloader types
296
+
297
+ s3_key: S3 key for the file
298
+
299
+ api_timeout: Timeout in milliseconds
300
+
301
+ wait_until: When to consider download complete
302
+
303
+ extra_headers: Send extra headers
304
+
305
+ extra_query: Add additional query parameters to the request
306
+
307
+ extra_body: Add additional JSON properties to the request
308
+
309
+ timeout: Override the client-level default timeout for this request, in seconds
310
+ """
311
+ return await self._post(
312
+ "/download/single",
313
+ body=await async_maybe_transform(
314
+ {
315
+ "s3_bucket": s3_bucket,
316
+ "url": url,
317
+ "downloader_type": downloader_type,
318
+ "s3_key": s3_key,
319
+ "api_timeout": api_timeout,
320
+ "wait_until": wait_until,
321
+ },
322
+ download_create_single_params.DownloadCreateSingleParams,
323
+ ),
324
+ options=make_request_options(
325
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
326
+ ),
327
+ cast_to=DownloadCreateSingleResponse,
328
+ )
329
+
330
+
331
+ class DownloadResourceWithRawResponse:
332
+ def __init__(self, download: DownloadResource) -> None:
333
+ self._download = download
334
+
335
+ self.create_bulk = to_raw_response_wrapper(
336
+ download.create_bulk,
337
+ )
338
+ self.create_single = to_raw_response_wrapper(
339
+ download.create_single,
340
+ )
341
+
342
+
343
+ class AsyncDownloadResourceWithRawResponse:
344
+ def __init__(self, download: AsyncDownloadResource) -> None:
345
+ self._download = download
346
+
347
+ self.create_bulk = async_to_raw_response_wrapper(
348
+ download.create_bulk,
349
+ )
350
+ self.create_single = async_to_raw_response_wrapper(
351
+ download.create_single,
352
+ )
353
+
354
+
355
+ class DownloadResourceWithStreamingResponse:
356
+ def __init__(self, download: DownloadResource) -> None:
357
+ self._download = download
358
+
359
+ self.create_bulk = to_streamed_response_wrapper(
360
+ download.create_bulk,
361
+ )
362
+ self.create_single = to_streamed_response_wrapper(
363
+ download.create_single,
364
+ )
365
+
366
+
367
+ class AsyncDownloadResourceWithStreamingResponse:
368
+ def __init__(self, download: AsyncDownloadResource) -> None:
369
+ self._download = download
370
+
371
+ self.create_bulk = async_to_streamed_response_wrapper(
372
+ download.create_bulk,
373
+ )
374
+ self.create_single = async_to_streamed_response_wrapper(
375
+ download.create_single,
376
+ )
@@ -0,0 +1,143 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import httpx
6
+
7
+ from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
8
+ from .._compat import cached_property
9
+ from .._resource import SyncAPIResource, AsyncAPIResource
10
+ from .._response import (
11
+ to_raw_response_wrapper,
12
+ to_streamed_response_wrapper,
13
+ async_to_raw_response_wrapper,
14
+ async_to_streamed_response_wrapper,
15
+ )
16
+ from .._base_client import make_request_options
17
+ from ..types.health_check_response import HealthCheckResponse
18
+
19
+ __all__ = ["HealthResource", "AsyncHealthResource"]
20
+
21
+
22
+ class HealthResource(SyncAPIResource):
23
+ @cached_property
24
+ def with_raw_response(self) -> HealthResourceWithRawResponse:
25
+ """
26
+ This property can be used as a prefix for any HTTP method call to return
27
+ the raw response object instead of the parsed content.
28
+
29
+ For more information, see https://www.github.com/evrimai/cartography-client#accessing-raw-response-data-eg-headers
30
+ """
31
+ return HealthResourceWithRawResponse(self)
32
+
33
+ @cached_property
34
+ def with_streaming_response(self) -> HealthResourceWithStreamingResponse:
35
+ """
36
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
37
+
38
+ For more information, see https://www.github.com/evrimai/cartography-client#with_streaming_response
39
+ """
40
+ return HealthResourceWithStreamingResponse(self)
41
+
42
+ def check(
43
+ self,
44
+ *,
45
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
46
+ # The extra values given here take precedence over values defined on the client or passed to this method.
47
+ extra_headers: Headers | None = None,
48
+ extra_query: Query | None = None,
49
+ extra_body: Body | None = None,
50
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
51
+ ) -> HealthCheckResponse:
52
+ """
53
+ Health check endpoint
54
+
55
+ Returns server status and basic information
56
+ """
57
+ return self._get(
58
+ "/health/",
59
+ options=make_request_options(
60
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
61
+ ),
62
+ cast_to=HealthCheckResponse,
63
+ )
64
+
65
+
66
+ class AsyncHealthResource(AsyncAPIResource):
67
+ @cached_property
68
+ def with_raw_response(self) -> AsyncHealthResourceWithRawResponse:
69
+ """
70
+ This property can be used as a prefix for any HTTP method call to return
71
+ the raw response object instead of the parsed content.
72
+
73
+ For more information, see https://www.github.com/evrimai/cartography-client#accessing-raw-response-data-eg-headers
74
+ """
75
+ return AsyncHealthResourceWithRawResponse(self)
76
+
77
+ @cached_property
78
+ def with_streaming_response(self) -> AsyncHealthResourceWithStreamingResponse:
79
+ """
80
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
81
+
82
+ For more information, see https://www.github.com/evrimai/cartography-client#with_streaming_response
83
+ """
84
+ return AsyncHealthResourceWithStreamingResponse(self)
85
+
86
+ async def check(
87
+ self,
88
+ *,
89
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
90
+ # The extra values given here take precedence over values defined on the client or passed to this method.
91
+ extra_headers: Headers | None = None,
92
+ extra_query: Query | None = None,
93
+ extra_body: Body | None = None,
94
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
95
+ ) -> HealthCheckResponse:
96
+ """
97
+ Health check endpoint
98
+
99
+ Returns server status and basic information
100
+ """
101
+ return await self._get(
102
+ "/health/",
103
+ options=make_request_options(
104
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
105
+ ),
106
+ cast_to=HealthCheckResponse,
107
+ )
108
+
109
+
110
+ class HealthResourceWithRawResponse:
111
+ def __init__(self, health: HealthResource) -> None:
112
+ self._health = health
113
+
114
+ self.check = to_raw_response_wrapper(
115
+ health.check,
116
+ )
117
+
118
+
119
+ class AsyncHealthResourceWithRawResponse:
120
+ def __init__(self, health: AsyncHealthResource) -> None:
121
+ self._health = health
122
+
123
+ self.check = async_to_raw_response_wrapper(
124
+ health.check,
125
+ )
126
+
127
+
128
+ class HealthResourceWithStreamingResponse:
129
+ def __init__(self, health: HealthResource) -> None:
130
+ self._health = health
131
+
132
+ self.check = to_streamed_response_wrapper(
133
+ health.check,
134
+ )
135
+
136
+
137
+ class AsyncHealthResourceWithStreamingResponse:
138
+ def __init__(self, health: AsyncHealthResource) -> None:
139
+ self._health = health
140
+
141
+ self.check = async_to_streamed_response_wrapper(
142
+ health.check,
143
+ )