bytekit-sdk 0.3.0__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.
- bytekit/__init__.py +8 -0
- bytekit/api/__init__.py +1 -0
- bytekit/api/account/__init__.py +1 -0
- bytekit/api/account/get_account.py +157 -0
- bytekit/api/bulk/__init__.py +1 -0
- bytekit/api/bulk/create_bulk.py +204 -0
- bytekit/api/bulk/delete_bulk.py +177 -0
- bytekit/api/bulk/get_bulk.py +157 -0
- bytekit/api/bulk/list_bulk_screenshots.py +152 -0
- bytekit/api/fetch/__init__.py +1 -0
- bytekit/api/fetch/get_fetch.py +254 -0
- bytekit/api/fetch/post_fetch.py +178 -0
- bytekit/api/fetch_bulk/__init__.py +1 -0
- bytekit/api/fetch_bulk/create_fetch_bulk.py +180 -0
- bytekit/api/fetch_bulk/get_fetch_bulk.py +157 -0
- bytekit/api/monitors/__init__.py +1 -0
- bytekit/api/monitors/create_monitor.py +180 -0
- bytekit/api/monitors/delete_monitor.py +155 -0
- bytekit/api/monitors/get_monitor.py +157 -0
- bytekit/api/monitors/list_monitor_captures.py +188 -0
- bytekit/api/monitors/list_monitors.py +193 -0
- bytekit/api/monitors/update_monitor.py +191 -0
- bytekit/api/scrape/__init__.py +1 -0
- bytekit/api/scrape/create_scrape.py +197 -0
- bytekit/api/scrape/get_scrape.py +231 -0
- bytekit/api/scrape_bulk/__init__.py +1 -0
- bytekit/api/scrape_bulk/create_scrape_bulk.py +188 -0
- bytekit/api/scrape_bulk/get_scrape_bulk.py +157 -0
- bytekit/api/screenshots/__init__.py +1 -0
- bytekit/api/screenshots/create_screenshot.py +208 -0
- bytekit/api/screenshots/get_screenshot.py +177 -0
- bytekit/api/search/__init__.py +1 -0
- bytekit/api/search/create_search.py +225 -0
- bytekit/api/sitemap/__init__.py +1 -0
- bytekit/api/sitemap/create_sitemap.py +192 -0
- bytekit/api/sitemap/get_sitemap.py +157 -0
- bytekit/api/usage/__init__.py +1 -0
- bytekit/api/usage/get_usage.py +126 -0
- bytekit/api/usage/get_usage_by_endpoint.py +215 -0
- bytekit/api/usage/get_usage_daily.py +203 -0
- bytekit/api/webhooks/__init__.py +1 -0
- bytekit/api/webhooks/list_webhook_deliveries.py +214 -0
- bytekit/api/webhooks/retry_webhook_delivery.py +165 -0
- bytekit/client.py +418 -0
- bytekit/errors.py +18 -0
- bytekit/models/__init__.py +401 -0
- bytekit/models/account_bearer_response.py +207 -0
- bytekit/models/account_bearer_response_api_key.py +134 -0
- bytekit/models/account_bearer_response_api_key_environment.py +8 -0
- bytekit/models/account_bearer_response_auto_topup.py +83 -0
- bytekit/models/account_bearer_response_plan.py +150 -0
- bytekit/models/account_bearer_response_subscription.py +85 -0
- bytekit/models/account_bearer_response_subscription_plan.py +99 -0
- bytekit/models/account_bearer_response_subscription_status.py +10 -0
- bytekit/models/account_session_response.py +164 -0
- bytekit/models/account_session_response_notifications.py +51 -0
- bytekit/models/account_session_response_plan.py +150 -0
- bytekit/models/bandwidth_balance.py +91 -0
- bytekit/models/capture_response.py +216 -0
- bytekit/models/capture_response_outcome.py +10 -0
- bytekit/models/clip.py +83 -0
- bytekit/models/cookie.py +90 -0
- bytekit/models/create_bulk_body.py +155 -0
- bytekit/models/create_bulk_body_defaults.py +423 -0
- bytekit/models/create_bulk_body_defaults_device.py +9 -0
- bytekit/models/create_bulk_body_defaults_device_scale_factor_type_1.py +9 -0
- bytekit/models/create_bulk_body_defaults_device_scale_factor_type_2_type_1.py +9 -0
- bytekit/models/create_bulk_body_defaults_device_scale_factor_type_3_type_1.py +9 -0
- bytekit/models/create_bulk_body_defaults_formats_item.py +12 -0
- bytekit/models/create_bulk_body_defaults_type.py +9 -0
- bytekit/models/create_bulk_body_defaults_viewport_type_0.py +67 -0
- bytekit/models/create_bulk_body_defaults_wait_until.py +10 -0
- bytekit/models/create_bulk_body_items_item.py +380 -0
- bytekit/models/create_bulk_body_items_item_device.py +9 -0
- bytekit/models/create_bulk_body_items_item_formats_item.py +12 -0
- bytekit/models/create_bulk_body_items_item_scenario.py +10 -0
- bytekit/models/create_bulk_body_items_item_type.py +9 -0
- bytekit/models/create_bulk_body_items_item_viewport_type_0.py +67 -0
- bytekit/models/create_bulk_body_items_item_wait_until.py +10 -0
- bytekit/models/create_bulk_response_202.py +164 -0
- bytekit/models/create_bulk_response_202_status.py +10 -0
- bytekit/models/create_fetch_bulk_body.py +161 -0
- bytekit/models/create_fetch_bulk_body_defaults.py +91 -0
- bytekit/models/create_fetch_bulk_body_defaults_format.py +9 -0
- bytekit/models/create_fetch_bulk_body_metadata.py +44 -0
- bytekit/models/create_fetch_bulk_body_urls_item_type_1.py +102 -0
- bytekit/models/create_fetch_bulk_body_urls_item_type_1_format.py +9 -0
- bytekit/models/create_fetch_bulk_response_202.py +44 -0
- bytekit/models/create_scrape_bulk_body.py +179 -0
- bytekit/models/create_scrape_bulk_body_custom.py +52 -0
- bytekit/models/create_scrape_bulk_body_defaults.py +167 -0
- bytekit/models/create_scrape_bulk_body_defaults_formats_item.py +12 -0
- bytekit/models/create_scrape_bulk_body_defaults_headers.py +44 -0
- bytekit/models/create_scrape_bulk_body_items_item.py +226 -0
- bytekit/models/create_scrape_bulk_body_items_item_custom.py +50 -0
- bytekit/models/create_scrape_bulk_body_items_item_formats_item.py +12 -0
- bytekit/models/create_scrape_bulk_body_items_item_headers.py +44 -0
- bytekit/models/create_scrape_bulk_body_items_item_metadata.py +44 -0
- bytekit/models/create_scrape_bulk_response_202.py +166 -0
- bytekit/models/create_scrape_bulk_response_202_status.py +10 -0
- bytekit/models/create_search_body.py +140 -0
- bytekit/models/create_search_body_date_range.py +13 -0
- bytekit/models/create_search_body_type.py +10 -0
- bytekit/models/create_search_response_200.py +119 -0
- bytekit/models/create_search_response_200_results_item.py +161 -0
- bytekit/models/create_search_response_200_results_item_image.py +113 -0
- bytekit/models/create_search_response_502.py +46 -0
- bytekit/models/create_search_response_502_error.py +8 -0
- bytekit/models/credit_balance.py +91 -0
- bytekit/models/delete_bulk_response_200.py +164 -0
- bytekit/models/delete_bulk_response_200_status.py +11 -0
- bytekit/models/error.py +83 -0
- bytekit/models/error_error.py +100 -0
- bytekit/models/error_status.py +8 -0
- bytekit/models/fetch_request.py +276 -0
- bytekit/models/fetch_request_cache_ttl_type_1.py +8 -0
- bytekit/models/fetch_request_custom.py +48 -0
- bytekit/models/fetch_request_format.py +9 -0
- bytekit/models/fetch_request_markdown_images.py +11 -0
- bytekit/models/fetch_request_markdown_links.py +11 -0
- bytekit/models/fetch_request_markdown_mode.py +10 -0
- bytekit/models/get_bulk_response_200.py +164 -0
- bytekit/models/get_bulk_response_200_status.py +11 -0
- bytekit/models/get_fetch_bulk_response_200.py +44 -0
- bytekit/models/get_fetch_cache_ttl_type_1.py +8 -0
- bytekit/models/get_fetch_format.py +9 -0
- bytekit/models/get_scrape_bulk_response_200.py +164 -0
- bytekit/models/get_scrape_bulk_response_200_status.py +11 -0
- bytekit/models/get_usage_by_endpoint_response_200.py +114 -0
- bytekit/models/get_usage_by_endpoint_response_200_rows_item.py +90 -0
- bytekit/models/get_usage_by_endpoint_response_200_rows_item_endpoint.py +17 -0
- bytekit/models/get_usage_by_endpoint_response_200_totals.py +67 -0
- bytekit/models/get_usage_daily_response_200.py +97 -0
- bytekit/models/get_usage_daily_response_200_data_item.py +219 -0
- bytekit/models/get_usage_response_200.py +344 -0
- bytekit/models/get_usage_response_200_plan_type.py +10 -0
- bytekit/models/list_bulk_screenshots_response_200.py +44 -0
- bytekit/models/list_monitor_captures_response_200.py +101 -0
- bytekit/models/list_monitors_response_200.py +101 -0
- bytekit/models/list_monitors_status.py +12 -0
- bytekit/models/list_webhook_deliveries_response_200.py +101 -0
- bytekit/models/list_webhook_deliveries_status.py +11 -0
- bytekit/models/metadata.py +44 -0
- bytekit/models/monitor_create_request.py +219 -0
- bytekit/models/monitor_create_request_interval_type.py +11 -0
- bytekit/models/monitor_create_request_notify_on.py +9 -0
- bytekit/models/monitor_create_request_options.py +44 -0
- bytekit/models/monitor_create_request_scrape_options.py +44 -0
- bytekit/models/monitor_create_request_type.py +9 -0
- bytekit/models/monitor_create_request_webhook_headers.py +44 -0
- bytekit/models/monitor_create_response.py +423 -0
- bytekit/models/monitor_response.py +411 -0
- bytekit/models/monitor_response_interval_type.py +11 -0
- bytekit/models/monitor_response_metadata_type_0.py +44 -0
- bytekit/models/monitor_response_status.py +12 -0
- bytekit/models/monitor_response_type.py +9 -0
- bytekit/models/monitor_response_webhook_headers_type_0.py +44 -0
- bytekit/models/monitor_update_request.py +223 -0
- bytekit/models/monitor_update_request_interval_type.py +11 -0
- bytekit/models/monitor_update_request_notify_on.py +9 -0
- bytekit/models/monitor_update_request_options.py +44 -0
- bytekit/models/monitor_update_request_scrape_options.py +44 -0
- bytekit/models/monitor_update_request_status.py +9 -0
- bytekit/models/monitor_update_request_webhook_headers.py +44 -0
- bytekit/models/scrape_error_envelope.py +113 -0
- bytekit/models/scrape_error_envelope_error.py +93 -0
- bytekit/models/scrape_error_envelope_error_code.py +18 -0
- bytekit/models/scrape_error_envelope_schema_version.py +8 -0
- bytekit/models/scrape_error_envelope_status.py +8 -0
- bytekit/models/scrape_formats.py +183 -0
- bytekit/models/scrape_markdown_tokens.py +75 -0
- bytekit/models/scrape_metadata.py +262 -0
- bytekit/models/scrape_queued_envelope.py +124 -0
- bytekit/models/scrape_queued_envelope_schema_version.py +8 -0
- bytekit/models/scrape_queued_envelope_status.py +8 -0
- bytekit/models/scrape_request.py +485 -0
- bytekit/models/scrape_request_cache_ttl_type_1.py +8 -0
- bytekit/models/scrape_request_custom.py +48 -0
- bytekit/models/scrape_request_events_item.py +10 -0
- bytekit/models/scrape_request_formats_item.py +12 -0
- bytekit/models/scrape_request_headers.py +44 -0
- bytekit/models/scrape_request_markdown_images.py +11 -0
- bytekit/models/scrape_request_markdown_links.py +11 -0
- bytekit/models/scrape_request_markdown_mode.py +10 -0
- bytekit/models/scrape_request_token_encoding.py +9 -0
- bytekit/models/scrape_request_x_internal_scrape_path.py +8 -0
- bytekit/models/scrape_scored_image.py +128 -0
- bytekit/models/scrape_scored_link.py +94 -0
- bytekit/models/scrape_stats.py +75 -0
- bytekit/models/scrape_success_envelope.py +345 -0
- bytekit/models/scrape_success_envelope_cache.py +10 -0
- bytekit/models/scrape_success_envelope_custom.py +48 -0
- bytekit/models/scrape_success_envelope_schema_version.py +8 -0
- bytekit/models/scrape_success_envelope_status.py +8 -0
- bytekit/models/scrape_table.py +96 -0
- bytekit/models/scrape_table_kind.py +10 -0
- bytekit/models/scrape_warning.py +88 -0
- bytekit/models/scrape_warning_code.py +17 -0
- bytekit/models/screenshot_request.py +445 -0
- bytekit/models/screenshot_request_device.py +9 -0
- bytekit/models/screenshot_request_device_scale_factor_type_1.py +9 -0
- bytekit/models/screenshot_request_device_scale_factor_type_2_type_1.py +9 -0
- bytekit/models/screenshot_request_device_scale_factor_type_3_type_1.py +9 -0
- bytekit/models/screenshot_request_format.py +9 -0
- bytekit/models/screenshot_request_headers.py +44 -0
- bytekit/models/screenshot_request_wait_until.py +10 -0
- bytekit/models/screenshot_response.py +264 -0
- bytekit/models/screenshot_response_status.py +11 -0
- bytekit/models/sitemap_request.py +210 -0
- bytekit/models/sitemap_request_process_type_0.py +90 -0
- bytekit/models/sitemap_request_process_type_0_options.py +44 -0
- bytekit/models/sitemap_request_strategy.py +10 -0
- bytekit/models/sitemap_response.py +418 -0
- bytekit/models/sitemap_response_cache.py +10 -0
- bytekit/models/sitemap_response_metadata_type_0.py +44 -0
- bytekit/models/sitemap_response_process_type_0.py +44 -0
- bytekit/models/sitemap_response_sources_type_0.py +44 -0
- bytekit/models/sitemap_response_status.py +11 -0
- bytekit/models/viewport.py +67 -0
- bytekit/models/webhook_delivery_response.py +270 -0
- bytekit/models/webhook_delivery_response_event_type.py +14 -0
- bytekit/models/webhook_delivery_response_status.py +11 -0
- bytekit/py.typed +0 -0
- bytekit/types.py +54 -0
- bytekit_sdk-0.3.0.dist-info/METADATA +141 -0
- bytekit_sdk-0.3.0.dist-info/RECORD +227 -0
- bytekit_sdk-0.3.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import (
|
|
3
|
+
TYPE_CHECKING,
|
|
4
|
+
Any,
|
|
5
|
+
TypeVar,
|
|
6
|
+
Union,
|
|
7
|
+
cast,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
from attrs import define as _attrs_define
|
|
11
|
+
|
|
12
|
+
from ..models.fetch_request_cache_ttl_type_1 import FetchRequestCacheTtlType1
|
|
13
|
+
from ..models.fetch_request_format import FetchRequestFormat
|
|
14
|
+
from ..models.fetch_request_markdown_images import FetchRequestMarkdownImages
|
|
15
|
+
from ..models.fetch_request_markdown_links import FetchRequestMarkdownLinks
|
|
16
|
+
from ..models.fetch_request_markdown_mode import FetchRequestMarkdownMode
|
|
17
|
+
from ..types import UNSET, Unset
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from ..models.fetch_request_custom import FetchRequestCustom
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
T = TypeVar("T", bound="FetchRequest")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@_attrs_define
|
|
27
|
+
class FetchRequest:
|
|
28
|
+
"""
|
|
29
|
+
Attributes:
|
|
30
|
+
url (str):
|
|
31
|
+
format_ (Union[Unset, FetchRequestFormat]):
|
|
32
|
+
country (Union[Unset, str]):
|
|
33
|
+
timeout_ms (Union[Unset, int]):
|
|
34
|
+
cache_ttl (Union[FetchRequestCacheTtlType1, Unset, str]): How long a freshly fetched URL may be served from
|
|
35
|
+
cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so
|
|
36
|
+
later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts
|
|
37
|
+
`Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values
|
|
38
|
+
receive a 422 validation_error with an actionable message.
|
|
39
|
+
custom (Union[Unset, FetchRequestCustom]): User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom`
|
|
40
|
+
response header so callers can correlate the response back to caller-side state (job IDs, batch metadata, etc.).
|
|
41
|
+
Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT affect cache-key inputs — two requests differing
|
|
42
|
+
only in `custom` share the same cache slot.
|
|
43
|
+
markdown_mode (Union[Unset, FetchRequestMarkdownMode]): Markdown processing mode. Only used when
|
|
44
|
+
format=markdown.
|
|
45
|
+
markdown_query (Union[Unset, str]): BM25 query string for relevance-ranked filtering. Only used when
|
|
46
|
+
format=markdown.
|
|
47
|
+
markdown_links (Union[Unset, FetchRequestMarkdownLinks]): Link rendering style. Only used when format=markdown.
|
|
48
|
+
markdown_images (Union[Unset, FetchRequestMarkdownImages]): Image retention mode. Only used when
|
|
49
|
+
format=markdown.
|
|
50
|
+
with_links_summary (Union[Unset, bool]): Append a Links footer to the markdown output. Only used when
|
|
51
|
+
format=markdown.
|
|
52
|
+
with_images_summary (Union[Unset, bool]): Append an Images footer to the markdown output. Only used when
|
|
53
|
+
format=markdown.
|
|
54
|
+
markdown_compact (Union[Unset, bool]): Compact whitespace output. Only used when format=markdown.
|
|
55
|
+
markdown_filter_images (Union[Unset, bool]): Filter low-signal images. Only used when format=markdown.
|
|
56
|
+
markdown_include_media (Union[Unset, bool]): When true, `formats.links` and `formats.images` return
|
|
57
|
+
`ScrapeScoredLink[]` / `ScrapeScoredImage[]` (rich objects) instead of `string[]`, and a top-level `tables`
|
|
58
|
+
array is included. Only used when format=markdown.
|
|
59
|
+
markdown_include_warnings (Union[Unset, bool]): When true, enables markdown-pipeline and tag-filter warnings for
|
|
60
|
+
affected html and markdown requests. Artifact availability warnings such as `artifact_unavailable` may appear
|
|
61
|
+
independently of this flag.
|
|
62
|
+
markdown_include_stats (Union[Unset, bool]): When true, includes a top-level `stats` object with `ScrapeStats`
|
|
63
|
+
(chars, tokens, blocks). Only used when format=markdown.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
url: str
|
|
67
|
+
format_: Union[Unset, FetchRequestFormat] = UNSET
|
|
68
|
+
country: Union[Unset, str] = UNSET
|
|
69
|
+
timeout_ms: Union[Unset, int] = UNSET
|
|
70
|
+
cache_ttl: Union[FetchRequestCacheTtlType1, Unset, str] = UNSET
|
|
71
|
+
custom: Union[Unset, "FetchRequestCustom"] = UNSET
|
|
72
|
+
markdown_mode: Union[Unset, FetchRequestMarkdownMode] = UNSET
|
|
73
|
+
markdown_query: Union[Unset, str] = UNSET
|
|
74
|
+
markdown_links: Union[Unset, FetchRequestMarkdownLinks] = UNSET
|
|
75
|
+
markdown_images: Union[Unset, FetchRequestMarkdownImages] = UNSET
|
|
76
|
+
with_links_summary: Union[Unset, bool] = UNSET
|
|
77
|
+
with_images_summary: Union[Unset, bool] = UNSET
|
|
78
|
+
markdown_compact: Union[Unset, bool] = UNSET
|
|
79
|
+
markdown_filter_images: Union[Unset, bool] = UNSET
|
|
80
|
+
markdown_include_media: Union[Unset, bool] = UNSET
|
|
81
|
+
markdown_include_warnings: Union[Unset, bool] = UNSET
|
|
82
|
+
markdown_include_stats: Union[Unset, bool] = UNSET
|
|
83
|
+
|
|
84
|
+
def to_dict(self) -> dict[str, Any]:
|
|
85
|
+
url = self.url
|
|
86
|
+
|
|
87
|
+
format_: Union[Unset, str] = UNSET
|
|
88
|
+
if not isinstance(self.format_, Unset):
|
|
89
|
+
format_ = self.format_.value
|
|
90
|
+
|
|
91
|
+
country = self.country
|
|
92
|
+
|
|
93
|
+
timeout_ms = self.timeout_ms
|
|
94
|
+
|
|
95
|
+
cache_ttl: Union[Unset, int, str]
|
|
96
|
+
if isinstance(self.cache_ttl, Unset):
|
|
97
|
+
cache_ttl = UNSET
|
|
98
|
+
elif isinstance(self.cache_ttl, FetchRequestCacheTtlType1):
|
|
99
|
+
cache_ttl = self.cache_ttl.value
|
|
100
|
+
else:
|
|
101
|
+
cache_ttl = self.cache_ttl
|
|
102
|
+
|
|
103
|
+
custom: Union[Unset, dict[str, Any]] = UNSET
|
|
104
|
+
if not isinstance(self.custom, Unset):
|
|
105
|
+
custom = self.custom.to_dict()
|
|
106
|
+
|
|
107
|
+
markdown_mode: Union[Unset, str] = UNSET
|
|
108
|
+
if not isinstance(self.markdown_mode, Unset):
|
|
109
|
+
markdown_mode = self.markdown_mode.value
|
|
110
|
+
|
|
111
|
+
markdown_query = self.markdown_query
|
|
112
|
+
|
|
113
|
+
markdown_links: Union[Unset, str] = UNSET
|
|
114
|
+
if not isinstance(self.markdown_links, Unset):
|
|
115
|
+
markdown_links = self.markdown_links.value
|
|
116
|
+
|
|
117
|
+
markdown_images: Union[Unset, str] = UNSET
|
|
118
|
+
if not isinstance(self.markdown_images, Unset):
|
|
119
|
+
markdown_images = self.markdown_images.value
|
|
120
|
+
|
|
121
|
+
with_links_summary = self.with_links_summary
|
|
122
|
+
|
|
123
|
+
with_images_summary = self.with_images_summary
|
|
124
|
+
|
|
125
|
+
markdown_compact = self.markdown_compact
|
|
126
|
+
|
|
127
|
+
markdown_filter_images = self.markdown_filter_images
|
|
128
|
+
|
|
129
|
+
markdown_include_media = self.markdown_include_media
|
|
130
|
+
|
|
131
|
+
markdown_include_warnings = self.markdown_include_warnings
|
|
132
|
+
|
|
133
|
+
markdown_include_stats = self.markdown_include_stats
|
|
134
|
+
|
|
135
|
+
field_dict: dict[str, Any] = {}
|
|
136
|
+
|
|
137
|
+
field_dict.update(
|
|
138
|
+
{
|
|
139
|
+
"url": url,
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
if format_ is not UNSET:
|
|
143
|
+
field_dict["format"] = format_
|
|
144
|
+
if country is not UNSET:
|
|
145
|
+
field_dict["country"] = country
|
|
146
|
+
if timeout_ms is not UNSET:
|
|
147
|
+
field_dict["timeout_ms"] = timeout_ms
|
|
148
|
+
if cache_ttl is not UNSET:
|
|
149
|
+
field_dict["cache_ttl"] = cache_ttl
|
|
150
|
+
if custom is not UNSET:
|
|
151
|
+
field_dict["custom"] = custom
|
|
152
|
+
if markdown_mode is not UNSET:
|
|
153
|
+
field_dict["markdown_mode"] = markdown_mode
|
|
154
|
+
if markdown_query is not UNSET:
|
|
155
|
+
field_dict["markdown_query"] = markdown_query
|
|
156
|
+
if markdown_links is not UNSET:
|
|
157
|
+
field_dict["markdown_links"] = markdown_links
|
|
158
|
+
if markdown_images is not UNSET:
|
|
159
|
+
field_dict["markdown_images"] = markdown_images
|
|
160
|
+
if with_links_summary is not UNSET:
|
|
161
|
+
field_dict["with_links_summary"] = with_links_summary
|
|
162
|
+
if with_images_summary is not UNSET:
|
|
163
|
+
field_dict["with_images_summary"] = with_images_summary
|
|
164
|
+
if markdown_compact is not UNSET:
|
|
165
|
+
field_dict["markdown_compact"] = markdown_compact
|
|
166
|
+
if markdown_filter_images is not UNSET:
|
|
167
|
+
field_dict["markdown_filter_images"] = markdown_filter_images
|
|
168
|
+
if markdown_include_media is not UNSET:
|
|
169
|
+
field_dict["markdown_include_media"] = markdown_include_media
|
|
170
|
+
if markdown_include_warnings is not UNSET:
|
|
171
|
+
field_dict["markdown_include_warnings"] = markdown_include_warnings
|
|
172
|
+
if markdown_include_stats is not UNSET:
|
|
173
|
+
field_dict["markdown_include_stats"] = markdown_include_stats
|
|
174
|
+
|
|
175
|
+
return field_dict
|
|
176
|
+
|
|
177
|
+
@classmethod
|
|
178
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
179
|
+
from ..models.fetch_request_custom import FetchRequestCustom
|
|
180
|
+
|
|
181
|
+
d = dict(src_dict)
|
|
182
|
+
url = d.pop("url")
|
|
183
|
+
|
|
184
|
+
_format_ = d.pop("format", UNSET)
|
|
185
|
+
format_: Union[Unset, FetchRequestFormat]
|
|
186
|
+
if isinstance(_format_, Unset):
|
|
187
|
+
format_ = UNSET
|
|
188
|
+
else:
|
|
189
|
+
format_ = FetchRequestFormat(_format_)
|
|
190
|
+
|
|
191
|
+
country = d.pop("country", UNSET)
|
|
192
|
+
|
|
193
|
+
timeout_ms = d.pop("timeout_ms", UNSET)
|
|
194
|
+
|
|
195
|
+
def _parse_cache_ttl(
|
|
196
|
+
data: object,
|
|
197
|
+
) -> Union[FetchRequestCacheTtlType1, Unset, str]:
|
|
198
|
+
if isinstance(data, Unset):
|
|
199
|
+
return data
|
|
200
|
+
try:
|
|
201
|
+
if not isinstance(data, int):
|
|
202
|
+
raise TypeError()
|
|
203
|
+
cache_ttl_type_1 = FetchRequestCacheTtlType1(data)
|
|
204
|
+
|
|
205
|
+
return cache_ttl_type_1
|
|
206
|
+
except: # noqa: E722
|
|
207
|
+
pass
|
|
208
|
+
return cast(Union[FetchRequestCacheTtlType1, Unset, str], data)
|
|
209
|
+
|
|
210
|
+
cache_ttl = _parse_cache_ttl(d.pop("cache_ttl", UNSET))
|
|
211
|
+
|
|
212
|
+
_custom = d.pop("custom", UNSET)
|
|
213
|
+
custom: Union[Unset, FetchRequestCustom]
|
|
214
|
+
if isinstance(_custom, Unset):
|
|
215
|
+
custom = UNSET
|
|
216
|
+
else:
|
|
217
|
+
custom = FetchRequestCustom.from_dict(_custom)
|
|
218
|
+
|
|
219
|
+
_markdown_mode = d.pop("markdown_mode", UNSET)
|
|
220
|
+
markdown_mode: Union[Unset, FetchRequestMarkdownMode]
|
|
221
|
+
if isinstance(_markdown_mode, Unset):
|
|
222
|
+
markdown_mode = UNSET
|
|
223
|
+
else:
|
|
224
|
+
markdown_mode = FetchRequestMarkdownMode(_markdown_mode)
|
|
225
|
+
|
|
226
|
+
markdown_query = d.pop("markdown_query", UNSET)
|
|
227
|
+
|
|
228
|
+
_markdown_links = d.pop("markdown_links", UNSET)
|
|
229
|
+
markdown_links: Union[Unset, FetchRequestMarkdownLinks]
|
|
230
|
+
if isinstance(_markdown_links, Unset):
|
|
231
|
+
markdown_links = UNSET
|
|
232
|
+
else:
|
|
233
|
+
markdown_links = FetchRequestMarkdownLinks(_markdown_links)
|
|
234
|
+
|
|
235
|
+
_markdown_images = d.pop("markdown_images", UNSET)
|
|
236
|
+
markdown_images: Union[Unset, FetchRequestMarkdownImages]
|
|
237
|
+
if isinstance(_markdown_images, Unset):
|
|
238
|
+
markdown_images = UNSET
|
|
239
|
+
else:
|
|
240
|
+
markdown_images = FetchRequestMarkdownImages(_markdown_images)
|
|
241
|
+
|
|
242
|
+
with_links_summary = d.pop("with_links_summary", UNSET)
|
|
243
|
+
|
|
244
|
+
with_images_summary = d.pop("with_images_summary", UNSET)
|
|
245
|
+
|
|
246
|
+
markdown_compact = d.pop("markdown_compact", UNSET)
|
|
247
|
+
|
|
248
|
+
markdown_filter_images = d.pop("markdown_filter_images", UNSET)
|
|
249
|
+
|
|
250
|
+
markdown_include_media = d.pop("markdown_include_media", UNSET)
|
|
251
|
+
|
|
252
|
+
markdown_include_warnings = d.pop("markdown_include_warnings", UNSET)
|
|
253
|
+
|
|
254
|
+
markdown_include_stats = d.pop("markdown_include_stats", UNSET)
|
|
255
|
+
|
|
256
|
+
fetch_request = cls(
|
|
257
|
+
url=url,
|
|
258
|
+
format_=format_,
|
|
259
|
+
country=country,
|
|
260
|
+
timeout_ms=timeout_ms,
|
|
261
|
+
cache_ttl=cache_ttl,
|
|
262
|
+
custom=custom,
|
|
263
|
+
markdown_mode=markdown_mode,
|
|
264
|
+
markdown_query=markdown_query,
|
|
265
|
+
markdown_links=markdown_links,
|
|
266
|
+
markdown_images=markdown_images,
|
|
267
|
+
with_links_summary=with_links_summary,
|
|
268
|
+
with_images_summary=with_images_summary,
|
|
269
|
+
markdown_compact=markdown_compact,
|
|
270
|
+
markdown_filter_images=markdown_filter_images,
|
|
271
|
+
markdown_include_media=markdown_include_media,
|
|
272
|
+
markdown_include_warnings=markdown_include_warnings,
|
|
273
|
+
markdown_include_stats=markdown_include_stats,
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
return fetch_request
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
T = TypeVar("T", bound="FetchRequestCustom")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@_attrs_define
|
|
11
|
+
class FetchRequestCustom:
|
|
12
|
+
"""User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom` response header so callers can correlate the
|
|
13
|
+
response back to caller-side state (job IDs, batch metadata, etc.). Capped at 4096 UTF-8 bytes after JSON
|
|
14
|
+
serialization. Does NOT affect cache-key inputs — two requests differing only in `custom` share the same cache slot.
|
|
15
|
+
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
19
|
+
|
|
20
|
+
def to_dict(self) -> dict[str, Any]:
|
|
21
|
+
field_dict: dict[str, Any] = {}
|
|
22
|
+
field_dict.update(self.additional_properties)
|
|
23
|
+
|
|
24
|
+
return field_dict
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
28
|
+
d = dict(src_dict)
|
|
29
|
+
fetch_request_custom = cls()
|
|
30
|
+
|
|
31
|
+
fetch_request_custom.additional_properties = d
|
|
32
|
+
return fetch_request_custom
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def additional_keys(self) -> list[str]:
|
|
36
|
+
return list(self.additional_properties.keys())
|
|
37
|
+
|
|
38
|
+
def __getitem__(self, key: str) -> Any:
|
|
39
|
+
return self.additional_properties[key]
|
|
40
|
+
|
|
41
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
42
|
+
self.additional_properties[key] = value
|
|
43
|
+
|
|
44
|
+
def __delitem__(self, key: str) -> None:
|
|
45
|
+
del self.additional_properties[key]
|
|
46
|
+
|
|
47
|
+
def __contains__(self, key: str) -> bool:
|
|
48
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from collections.abc import Mapping
|
|
3
|
+
from typing import (
|
|
4
|
+
Any,
|
|
5
|
+
TypeVar,
|
|
6
|
+
Union,
|
|
7
|
+
cast,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
from attrs import define as _attrs_define
|
|
11
|
+
from attrs import field as _attrs_field
|
|
12
|
+
from dateutil.parser import isoparse
|
|
13
|
+
|
|
14
|
+
from ..models.get_bulk_response_200_status import GetBulkResponse200Status
|
|
15
|
+
|
|
16
|
+
T = TypeVar("T", bound="GetBulkResponse200")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@_attrs_define
|
|
20
|
+
class GetBulkResponse200:
|
|
21
|
+
"""
|
|
22
|
+
Attributes:
|
|
23
|
+
id (str): Example: bulk_01j9abc123.
|
|
24
|
+
status (GetBulkResponse200Status):
|
|
25
|
+
total (int):
|
|
26
|
+
completed (int):
|
|
27
|
+
failed (int):
|
|
28
|
+
created_at (datetime.datetime):
|
|
29
|
+
completed_at (Union[None, datetime.datetime]):
|
|
30
|
+
total_credits_charged (int):
|
|
31
|
+
estimated_credits (Union[None, int]): Null in GET responses (computed at submission time only).
|
|
32
|
+
webhook_url (str): Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason
|
|
33
|
+
scheme_unsupported)
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
id: str
|
|
37
|
+
status: GetBulkResponse200Status
|
|
38
|
+
total: int
|
|
39
|
+
completed: int
|
|
40
|
+
failed: int
|
|
41
|
+
created_at: datetime.datetime
|
|
42
|
+
completed_at: Union[None, datetime.datetime]
|
|
43
|
+
total_credits_charged: int
|
|
44
|
+
estimated_credits: Union[None, int]
|
|
45
|
+
webhook_url: str
|
|
46
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
47
|
+
|
|
48
|
+
def to_dict(self) -> dict[str, Any]:
|
|
49
|
+
id = self.id
|
|
50
|
+
|
|
51
|
+
status = self.status.value
|
|
52
|
+
|
|
53
|
+
total = self.total
|
|
54
|
+
|
|
55
|
+
completed = self.completed
|
|
56
|
+
|
|
57
|
+
failed = self.failed
|
|
58
|
+
|
|
59
|
+
created_at = self.created_at.isoformat()
|
|
60
|
+
|
|
61
|
+
completed_at: Union[None, str]
|
|
62
|
+
if isinstance(self.completed_at, datetime.datetime):
|
|
63
|
+
completed_at = self.completed_at.isoformat()
|
|
64
|
+
else:
|
|
65
|
+
completed_at = self.completed_at
|
|
66
|
+
|
|
67
|
+
total_credits_charged = self.total_credits_charged
|
|
68
|
+
|
|
69
|
+
estimated_credits: Union[None, int]
|
|
70
|
+
estimated_credits = self.estimated_credits
|
|
71
|
+
|
|
72
|
+
webhook_url = self.webhook_url
|
|
73
|
+
|
|
74
|
+
field_dict: dict[str, Any] = {}
|
|
75
|
+
field_dict.update(self.additional_properties)
|
|
76
|
+
field_dict.update(
|
|
77
|
+
{
|
|
78
|
+
"id": id,
|
|
79
|
+
"status": status,
|
|
80
|
+
"total": total,
|
|
81
|
+
"completed": completed,
|
|
82
|
+
"failed": failed,
|
|
83
|
+
"created_at": created_at,
|
|
84
|
+
"completed_at": completed_at,
|
|
85
|
+
"total_credits_charged": total_credits_charged,
|
|
86
|
+
"estimated_credits": estimated_credits,
|
|
87
|
+
"webhook_url": webhook_url,
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
return field_dict
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
95
|
+
d = dict(src_dict)
|
|
96
|
+
id = d.pop("id")
|
|
97
|
+
|
|
98
|
+
status = GetBulkResponse200Status(d.pop("status"))
|
|
99
|
+
|
|
100
|
+
total = d.pop("total")
|
|
101
|
+
|
|
102
|
+
completed = d.pop("completed")
|
|
103
|
+
|
|
104
|
+
failed = d.pop("failed")
|
|
105
|
+
|
|
106
|
+
created_at = isoparse(d.pop("created_at"))
|
|
107
|
+
|
|
108
|
+
def _parse_completed_at(data: object) -> Union[None, datetime.datetime]:
|
|
109
|
+
if data is None:
|
|
110
|
+
return data
|
|
111
|
+
try:
|
|
112
|
+
if not isinstance(data, str):
|
|
113
|
+
raise TypeError()
|
|
114
|
+
completed_at_type_0 = isoparse(data)
|
|
115
|
+
|
|
116
|
+
return completed_at_type_0
|
|
117
|
+
except: # noqa: E722
|
|
118
|
+
pass
|
|
119
|
+
return cast(Union[None, datetime.datetime], data)
|
|
120
|
+
|
|
121
|
+
completed_at = _parse_completed_at(d.pop("completed_at"))
|
|
122
|
+
|
|
123
|
+
total_credits_charged = d.pop("total_credits_charged")
|
|
124
|
+
|
|
125
|
+
def _parse_estimated_credits(data: object) -> Union[None, int]:
|
|
126
|
+
if data is None:
|
|
127
|
+
return data
|
|
128
|
+
return cast(Union[None, int], data)
|
|
129
|
+
|
|
130
|
+
estimated_credits = _parse_estimated_credits(d.pop("estimated_credits"))
|
|
131
|
+
|
|
132
|
+
webhook_url = d.pop("webhook_url")
|
|
133
|
+
|
|
134
|
+
get_bulk_response_200 = cls(
|
|
135
|
+
id=id,
|
|
136
|
+
status=status,
|
|
137
|
+
total=total,
|
|
138
|
+
completed=completed,
|
|
139
|
+
failed=failed,
|
|
140
|
+
created_at=created_at,
|
|
141
|
+
completed_at=completed_at,
|
|
142
|
+
total_credits_charged=total_credits_charged,
|
|
143
|
+
estimated_credits=estimated_credits,
|
|
144
|
+
webhook_url=webhook_url,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
get_bulk_response_200.additional_properties = d
|
|
148
|
+
return get_bulk_response_200
|
|
149
|
+
|
|
150
|
+
@property
|
|
151
|
+
def additional_keys(self) -> list[str]:
|
|
152
|
+
return list(self.additional_properties.keys())
|
|
153
|
+
|
|
154
|
+
def __getitem__(self, key: str) -> Any:
|
|
155
|
+
return self.additional_properties[key]
|
|
156
|
+
|
|
157
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
158
|
+
self.additional_properties[key] = value
|
|
159
|
+
|
|
160
|
+
def __delitem__(self, key: str) -> None:
|
|
161
|
+
del self.additional_properties[key]
|
|
162
|
+
|
|
163
|
+
def __contains__(self, key: str) -> bool:
|
|
164
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
T = TypeVar("T", bound="GetFetchBulkResponse200")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@_attrs_define
|
|
11
|
+
class GetFetchBulkResponse200:
|
|
12
|
+
""" """
|
|
13
|
+
|
|
14
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
15
|
+
|
|
16
|
+
def to_dict(self) -> dict[str, Any]:
|
|
17
|
+
field_dict: dict[str, Any] = {}
|
|
18
|
+
field_dict.update(self.additional_properties)
|
|
19
|
+
|
|
20
|
+
return field_dict
|
|
21
|
+
|
|
22
|
+
@classmethod
|
|
23
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
24
|
+
d = dict(src_dict)
|
|
25
|
+
get_fetch_bulk_response_200 = cls()
|
|
26
|
+
|
|
27
|
+
get_fetch_bulk_response_200.additional_properties = d
|
|
28
|
+
return get_fetch_bulk_response_200
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def additional_keys(self) -> list[str]:
|
|
32
|
+
return list(self.additional_properties.keys())
|
|
33
|
+
|
|
34
|
+
def __getitem__(self, key: str) -> Any:
|
|
35
|
+
return self.additional_properties[key]
|
|
36
|
+
|
|
37
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
38
|
+
self.additional_properties[key] = value
|
|
39
|
+
|
|
40
|
+
def __delitem__(self, key: str) -> None:
|
|
41
|
+
del self.additional_properties[key]
|
|
42
|
+
|
|
43
|
+
def __contains__(self, key: str) -> bool:
|
|
44
|
+
return key in self.additional_properties
|