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,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="ScreenshotRequestHeaders")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@_attrs_define
|
|
11
|
+
class ScreenshotRequestHeaders:
|
|
12
|
+
""" """
|
|
13
|
+
|
|
14
|
+
additional_properties: dict[str, str] = _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
|
+
screenshot_request_headers = cls()
|
|
26
|
+
|
|
27
|
+
screenshot_request_headers.additional_properties = d
|
|
28
|
+
return screenshot_request_headers
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def additional_keys(self) -> list[str]:
|
|
32
|
+
return list(self.additional_properties.keys())
|
|
33
|
+
|
|
34
|
+
def __getitem__(self, key: str) -> str:
|
|
35
|
+
return self.additional_properties[key]
|
|
36
|
+
|
|
37
|
+
def __setitem__(self, key: str, value: str) -> 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
|
|
@@ -0,0 +1,264 @@
|
|
|
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.screenshot_response_status import ScreenshotResponseStatus
|
|
15
|
+
|
|
16
|
+
T = TypeVar("T", bound="ScreenshotResponse")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@_attrs_define
|
|
20
|
+
class ScreenshotResponse:
|
|
21
|
+
"""
|
|
22
|
+
Attributes:
|
|
23
|
+
id (str): Example: ss_01j9abc123.
|
|
24
|
+
status (ScreenshotResponseStatus):
|
|
25
|
+
url (str):
|
|
26
|
+
image_url (Union[None, str]):
|
|
27
|
+
page_title (Union[None, str]):
|
|
28
|
+
image_width (Union[None, int]):
|
|
29
|
+
image_height (Union[None, int]):
|
|
30
|
+
file_size_bytes (Union[None, int]): Size of the generated image file (PNG/JPEG), in bytes. Informational only —
|
|
31
|
+
screenshots are billed on bandwidth, not on the image file size. The two are
|
|
32
|
+
uncorrelated (a heavy page can produce a small image, and vice versa).
|
|
33
|
+
credits_charged (Union[None, int]):
|
|
34
|
+
error_code (Union[None, str]):
|
|
35
|
+
error_message (Union[None, str]):
|
|
36
|
+
created_at (datetime.datetime):
|
|
37
|
+
completed_at (Union[None, datetime.datetime]):
|
|
38
|
+
expires_at (Union[None, datetime.datetime]):
|
|
39
|
+
poll_url (str):
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
id: str
|
|
43
|
+
status: ScreenshotResponseStatus
|
|
44
|
+
url: str
|
|
45
|
+
image_url: Union[None, str]
|
|
46
|
+
page_title: Union[None, str]
|
|
47
|
+
image_width: Union[None, int]
|
|
48
|
+
image_height: Union[None, int]
|
|
49
|
+
file_size_bytes: Union[None, int]
|
|
50
|
+
credits_charged: Union[None, int]
|
|
51
|
+
error_code: Union[None, str]
|
|
52
|
+
error_message: Union[None, str]
|
|
53
|
+
created_at: datetime.datetime
|
|
54
|
+
completed_at: Union[None, datetime.datetime]
|
|
55
|
+
expires_at: Union[None, datetime.datetime]
|
|
56
|
+
poll_url: str
|
|
57
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
58
|
+
|
|
59
|
+
def to_dict(self) -> dict[str, Any]:
|
|
60
|
+
id = self.id
|
|
61
|
+
|
|
62
|
+
status = self.status.value
|
|
63
|
+
|
|
64
|
+
url = self.url
|
|
65
|
+
|
|
66
|
+
image_url: Union[None, str]
|
|
67
|
+
image_url = self.image_url
|
|
68
|
+
|
|
69
|
+
page_title: Union[None, str]
|
|
70
|
+
page_title = self.page_title
|
|
71
|
+
|
|
72
|
+
image_width: Union[None, int]
|
|
73
|
+
image_width = self.image_width
|
|
74
|
+
|
|
75
|
+
image_height: Union[None, int]
|
|
76
|
+
image_height = self.image_height
|
|
77
|
+
|
|
78
|
+
file_size_bytes: Union[None, int]
|
|
79
|
+
file_size_bytes = self.file_size_bytes
|
|
80
|
+
|
|
81
|
+
credits_charged: Union[None, int]
|
|
82
|
+
credits_charged = self.credits_charged
|
|
83
|
+
|
|
84
|
+
error_code: Union[None, str]
|
|
85
|
+
error_code = self.error_code
|
|
86
|
+
|
|
87
|
+
error_message: Union[None, str]
|
|
88
|
+
error_message = self.error_message
|
|
89
|
+
|
|
90
|
+
created_at = self.created_at.isoformat()
|
|
91
|
+
|
|
92
|
+
completed_at: Union[None, str]
|
|
93
|
+
if isinstance(self.completed_at, datetime.datetime):
|
|
94
|
+
completed_at = self.completed_at.isoformat()
|
|
95
|
+
else:
|
|
96
|
+
completed_at = self.completed_at
|
|
97
|
+
|
|
98
|
+
expires_at: Union[None, str]
|
|
99
|
+
if isinstance(self.expires_at, datetime.datetime):
|
|
100
|
+
expires_at = self.expires_at.isoformat()
|
|
101
|
+
else:
|
|
102
|
+
expires_at = self.expires_at
|
|
103
|
+
|
|
104
|
+
poll_url = self.poll_url
|
|
105
|
+
|
|
106
|
+
field_dict: dict[str, Any] = {}
|
|
107
|
+
field_dict.update(self.additional_properties)
|
|
108
|
+
field_dict.update(
|
|
109
|
+
{
|
|
110
|
+
"id": id,
|
|
111
|
+
"status": status,
|
|
112
|
+
"url": url,
|
|
113
|
+
"image_url": image_url,
|
|
114
|
+
"page_title": page_title,
|
|
115
|
+
"image_width": image_width,
|
|
116
|
+
"image_height": image_height,
|
|
117
|
+
"file_size_bytes": file_size_bytes,
|
|
118
|
+
"credits_charged": credits_charged,
|
|
119
|
+
"error_code": error_code,
|
|
120
|
+
"error_message": error_message,
|
|
121
|
+
"created_at": created_at,
|
|
122
|
+
"completed_at": completed_at,
|
|
123
|
+
"expires_at": expires_at,
|
|
124
|
+
"poll_url": poll_url,
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
return field_dict
|
|
129
|
+
|
|
130
|
+
@classmethod
|
|
131
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
132
|
+
d = dict(src_dict)
|
|
133
|
+
id = d.pop("id")
|
|
134
|
+
|
|
135
|
+
status = ScreenshotResponseStatus(d.pop("status"))
|
|
136
|
+
|
|
137
|
+
url = d.pop("url")
|
|
138
|
+
|
|
139
|
+
def _parse_image_url(data: object) -> Union[None, str]:
|
|
140
|
+
if data is None:
|
|
141
|
+
return data
|
|
142
|
+
return cast(Union[None, str], data)
|
|
143
|
+
|
|
144
|
+
image_url = _parse_image_url(d.pop("image_url"))
|
|
145
|
+
|
|
146
|
+
def _parse_page_title(data: object) -> Union[None, str]:
|
|
147
|
+
if data is None:
|
|
148
|
+
return data
|
|
149
|
+
return cast(Union[None, str], data)
|
|
150
|
+
|
|
151
|
+
page_title = _parse_page_title(d.pop("page_title"))
|
|
152
|
+
|
|
153
|
+
def _parse_image_width(data: object) -> Union[None, int]:
|
|
154
|
+
if data is None:
|
|
155
|
+
return data
|
|
156
|
+
return cast(Union[None, int], data)
|
|
157
|
+
|
|
158
|
+
image_width = _parse_image_width(d.pop("image_width"))
|
|
159
|
+
|
|
160
|
+
def _parse_image_height(data: object) -> Union[None, int]:
|
|
161
|
+
if data is None:
|
|
162
|
+
return data
|
|
163
|
+
return cast(Union[None, int], data)
|
|
164
|
+
|
|
165
|
+
image_height = _parse_image_height(d.pop("image_height"))
|
|
166
|
+
|
|
167
|
+
def _parse_file_size_bytes(data: object) -> Union[None, int]:
|
|
168
|
+
if data is None:
|
|
169
|
+
return data
|
|
170
|
+
return cast(Union[None, int], data)
|
|
171
|
+
|
|
172
|
+
file_size_bytes = _parse_file_size_bytes(d.pop("file_size_bytes"))
|
|
173
|
+
|
|
174
|
+
def _parse_credits_charged(data: object) -> Union[None, int]:
|
|
175
|
+
if data is None:
|
|
176
|
+
return data
|
|
177
|
+
return cast(Union[None, int], data)
|
|
178
|
+
|
|
179
|
+
credits_charged = _parse_credits_charged(d.pop("credits_charged"))
|
|
180
|
+
|
|
181
|
+
def _parse_error_code(data: object) -> Union[None, str]:
|
|
182
|
+
if data is None:
|
|
183
|
+
return data
|
|
184
|
+
return cast(Union[None, str], data)
|
|
185
|
+
|
|
186
|
+
error_code = _parse_error_code(d.pop("error_code"))
|
|
187
|
+
|
|
188
|
+
def _parse_error_message(data: object) -> Union[None, str]:
|
|
189
|
+
if data is None:
|
|
190
|
+
return data
|
|
191
|
+
return cast(Union[None, str], data)
|
|
192
|
+
|
|
193
|
+
error_message = _parse_error_message(d.pop("error_message"))
|
|
194
|
+
|
|
195
|
+
created_at = isoparse(d.pop("created_at"))
|
|
196
|
+
|
|
197
|
+
def _parse_completed_at(data: object) -> Union[None, datetime.datetime]:
|
|
198
|
+
if data is None:
|
|
199
|
+
return data
|
|
200
|
+
try:
|
|
201
|
+
if not isinstance(data, str):
|
|
202
|
+
raise TypeError()
|
|
203
|
+
completed_at_type_0 = isoparse(data)
|
|
204
|
+
|
|
205
|
+
return completed_at_type_0
|
|
206
|
+
except: # noqa: E722
|
|
207
|
+
pass
|
|
208
|
+
return cast(Union[None, datetime.datetime], data)
|
|
209
|
+
|
|
210
|
+
completed_at = _parse_completed_at(d.pop("completed_at"))
|
|
211
|
+
|
|
212
|
+
def _parse_expires_at(data: object) -> Union[None, datetime.datetime]:
|
|
213
|
+
if data is None:
|
|
214
|
+
return data
|
|
215
|
+
try:
|
|
216
|
+
if not isinstance(data, str):
|
|
217
|
+
raise TypeError()
|
|
218
|
+
expires_at_type_0 = isoparse(data)
|
|
219
|
+
|
|
220
|
+
return expires_at_type_0
|
|
221
|
+
except: # noqa: E722
|
|
222
|
+
pass
|
|
223
|
+
return cast(Union[None, datetime.datetime], data)
|
|
224
|
+
|
|
225
|
+
expires_at = _parse_expires_at(d.pop("expires_at"))
|
|
226
|
+
|
|
227
|
+
poll_url = d.pop("poll_url")
|
|
228
|
+
|
|
229
|
+
screenshot_response = cls(
|
|
230
|
+
id=id,
|
|
231
|
+
status=status,
|
|
232
|
+
url=url,
|
|
233
|
+
image_url=image_url,
|
|
234
|
+
page_title=page_title,
|
|
235
|
+
image_width=image_width,
|
|
236
|
+
image_height=image_height,
|
|
237
|
+
file_size_bytes=file_size_bytes,
|
|
238
|
+
credits_charged=credits_charged,
|
|
239
|
+
error_code=error_code,
|
|
240
|
+
error_message=error_message,
|
|
241
|
+
created_at=created_at,
|
|
242
|
+
completed_at=completed_at,
|
|
243
|
+
expires_at=expires_at,
|
|
244
|
+
poll_url=poll_url,
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
screenshot_response.additional_properties = d
|
|
248
|
+
return screenshot_response
|
|
249
|
+
|
|
250
|
+
@property
|
|
251
|
+
def additional_keys(self) -> list[str]:
|
|
252
|
+
return list(self.additional_properties.keys())
|
|
253
|
+
|
|
254
|
+
def __getitem__(self, key: str) -> Any:
|
|
255
|
+
return self.additional_properties[key]
|
|
256
|
+
|
|
257
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
258
|
+
self.additional_properties[key] = value
|
|
259
|
+
|
|
260
|
+
def __delitem__(self, key: str) -> None:
|
|
261
|
+
del self.additional_properties[key]
|
|
262
|
+
|
|
263
|
+
def __contains__(self, key: str) -> bool:
|
|
264
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,210 @@
|
|
|
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
|
+
from attrs import field as _attrs_field
|
|
12
|
+
|
|
13
|
+
from ..models.sitemap_request_strategy import SitemapRequestStrategy
|
|
14
|
+
from ..types import UNSET, Unset
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from ..models.metadata import Metadata
|
|
18
|
+
from ..models.sitemap_request_process_type_0 import SitemapRequestProcessType0
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
T = TypeVar("T", bound="SitemapRequest")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@_attrs_define
|
|
25
|
+
class SitemapRequest:
|
|
26
|
+
"""
|
|
27
|
+
Attributes:
|
|
28
|
+
url (str):
|
|
29
|
+
strategy (Union[Unset, SitemapRequestStrategy]):
|
|
30
|
+
max_depth (Union[Unset, int]):
|
|
31
|
+
max_urls (Union[Unset, int]):
|
|
32
|
+
process (Union['SitemapRequestProcessType0', None, Unset]):
|
|
33
|
+
webhook_url (Union[Unset, str]): Optional webhook endpoint URL (HTTPS only; http:// rejected with 400
|
|
34
|
+
invalid_url, reason scheme_unsupported). When omitted, no `sitemap.completed`/`sitemap.failed` webhook is
|
|
35
|
+
delivered and the job is poll-only via `GET /v1/sitemap/{id}`. When present, delivery is unchanged.
|
|
36
|
+
`webhook_secret` is ignored when `webhook_url` is absent.
|
|
37
|
+
webhook_secret (Union[None, Unset, str]):
|
|
38
|
+
cache_ttl (Union[Unset, str]): Max 90 days.
|
|
39
|
+
compact (Union[Unset, bool]):
|
|
40
|
+
metadata (Union[Unset, Metadata]): Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
url: str
|
|
44
|
+
strategy: Union[Unset, SitemapRequestStrategy] = UNSET
|
|
45
|
+
max_depth: Union[Unset, int] = UNSET
|
|
46
|
+
max_urls: Union[Unset, int] = UNSET
|
|
47
|
+
process: Union["SitemapRequestProcessType0", None, Unset] = UNSET
|
|
48
|
+
webhook_url: Union[Unset, str] = UNSET
|
|
49
|
+
webhook_secret: Union[None, Unset, str] = UNSET
|
|
50
|
+
cache_ttl: Union[Unset, str] = UNSET
|
|
51
|
+
compact: Union[Unset, bool] = UNSET
|
|
52
|
+
metadata: Union[Unset, "Metadata"] = UNSET
|
|
53
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> dict[str, Any]:
|
|
56
|
+
from ..models.sitemap_request_process_type_0 import SitemapRequestProcessType0
|
|
57
|
+
|
|
58
|
+
url = self.url
|
|
59
|
+
|
|
60
|
+
strategy: Union[Unset, str] = UNSET
|
|
61
|
+
if not isinstance(self.strategy, Unset):
|
|
62
|
+
strategy = self.strategy.value
|
|
63
|
+
|
|
64
|
+
max_depth = self.max_depth
|
|
65
|
+
|
|
66
|
+
max_urls = self.max_urls
|
|
67
|
+
|
|
68
|
+
process: Union[None, Unset, dict[str, Any]]
|
|
69
|
+
if isinstance(self.process, Unset):
|
|
70
|
+
process = UNSET
|
|
71
|
+
elif isinstance(self.process, SitemapRequestProcessType0):
|
|
72
|
+
process = self.process.to_dict()
|
|
73
|
+
else:
|
|
74
|
+
process = self.process
|
|
75
|
+
|
|
76
|
+
webhook_url = self.webhook_url
|
|
77
|
+
|
|
78
|
+
webhook_secret: Union[None, Unset, str]
|
|
79
|
+
if isinstance(self.webhook_secret, Unset):
|
|
80
|
+
webhook_secret = UNSET
|
|
81
|
+
else:
|
|
82
|
+
webhook_secret = self.webhook_secret
|
|
83
|
+
|
|
84
|
+
cache_ttl = self.cache_ttl
|
|
85
|
+
|
|
86
|
+
compact = self.compact
|
|
87
|
+
|
|
88
|
+
metadata: Union[Unset, dict[str, Any]] = UNSET
|
|
89
|
+
if not isinstance(self.metadata, Unset):
|
|
90
|
+
metadata = self.metadata.to_dict()
|
|
91
|
+
|
|
92
|
+
field_dict: dict[str, Any] = {}
|
|
93
|
+
field_dict.update(self.additional_properties)
|
|
94
|
+
field_dict.update(
|
|
95
|
+
{
|
|
96
|
+
"url": url,
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
if strategy is not UNSET:
|
|
100
|
+
field_dict["strategy"] = strategy
|
|
101
|
+
if max_depth is not UNSET:
|
|
102
|
+
field_dict["max_depth"] = max_depth
|
|
103
|
+
if max_urls is not UNSET:
|
|
104
|
+
field_dict["max_urls"] = max_urls
|
|
105
|
+
if process is not UNSET:
|
|
106
|
+
field_dict["process"] = process
|
|
107
|
+
if webhook_url is not UNSET:
|
|
108
|
+
field_dict["webhook_url"] = webhook_url
|
|
109
|
+
if webhook_secret is not UNSET:
|
|
110
|
+
field_dict["webhook_secret"] = webhook_secret
|
|
111
|
+
if cache_ttl is not UNSET:
|
|
112
|
+
field_dict["cache_ttl"] = cache_ttl
|
|
113
|
+
if compact is not UNSET:
|
|
114
|
+
field_dict["compact"] = compact
|
|
115
|
+
if metadata is not UNSET:
|
|
116
|
+
field_dict["metadata"] = metadata
|
|
117
|
+
|
|
118
|
+
return field_dict
|
|
119
|
+
|
|
120
|
+
@classmethod
|
|
121
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
122
|
+
from ..models.metadata import Metadata
|
|
123
|
+
from ..models.sitemap_request_process_type_0 import SitemapRequestProcessType0
|
|
124
|
+
|
|
125
|
+
d = dict(src_dict)
|
|
126
|
+
url = d.pop("url")
|
|
127
|
+
|
|
128
|
+
_strategy = d.pop("strategy", UNSET)
|
|
129
|
+
strategy: Union[Unset, SitemapRequestStrategy]
|
|
130
|
+
if isinstance(_strategy, Unset):
|
|
131
|
+
strategy = UNSET
|
|
132
|
+
else:
|
|
133
|
+
strategy = SitemapRequestStrategy(_strategy)
|
|
134
|
+
|
|
135
|
+
max_depth = d.pop("max_depth", UNSET)
|
|
136
|
+
|
|
137
|
+
max_urls = d.pop("max_urls", UNSET)
|
|
138
|
+
|
|
139
|
+
def _parse_process(
|
|
140
|
+
data: object,
|
|
141
|
+
) -> Union["SitemapRequestProcessType0", None, Unset]:
|
|
142
|
+
if data is None:
|
|
143
|
+
return data
|
|
144
|
+
if isinstance(data, Unset):
|
|
145
|
+
return data
|
|
146
|
+
try:
|
|
147
|
+
if not isinstance(data, dict):
|
|
148
|
+
raise TypeError()
|
|
149
|
+
process_type_0 = SitemapRequestProcessType0.from_dict(data)
|
|
150
|
+
|
|
151
|
+
return process_type_0
|
|
152
|
+
except: # noqa: E722
|
|
153
|
+
pass
|
|
154
|
+
return cast(Union["SitemapRequestProcessType0", None, Unset], data)
|
|
155
|
+
|
|
156
|
+
process = _parse_process(d.pop("process", UNSET))
|
|
157
|
+
|
|
158
|
+
webhook_url = d.pop("webhook_url", UNSET)
|
|
159
|
+
|
|
160
|
+
def _parse_webhook_secret(data: object) -> Union[None, Unset, str]:
|
|
161
|
+
if data is None:
|
|
162
|
+
return data
|
|
163
|
+
if isinstance(data, Unset):
|
|
164
|
+
return data
|
|
165
|
+
return cast(Union[None, Unset, str], data)
|
|
166
|
+
|
|
167
|
+
webhook_secret = _parse_webhook_secret(d.pop("webhook_secret", UNSET))
|
|
168
|
+
|
|
169
|
+
cache_ttl = d.pop("cache_ttl", UNSET)
|
|
170
|
+
|
|
171
|
+
compact = d.pop("compact", UNSET)
|
|
172
|
+
|
|
173
|
+
_metadata = d.pop("metadata", UNSET)
|
|
174
|
+
metadata: Union[Unset, Metadata]
|
|
175
|
+
if isinstance(_metadata, Unset):
|
|
176
|
+
metadata = UNSET
|
|
177
|
+
else:
|
|
178
|
+
metadata = Metadata.from_dict(_metadata)
|
|
179
|
+
|
|
180
|
+
sitemap_request = cls(
|
|
181
|
+
url=url,
|
|
182
|
+
strategy=strategy,
|
|
183
|
+
max_depth=max_depth,
|
|
184
|
+
max_urls=max_urls,
|
|
185
|
+
process=process,
|
|
186
|
+
webhook_url=webhook_url,
|
|
187
|
+
webhook_secret=webhook_secret,
|
|
188
|
+
cache_ttl=cache_ttl,
|
|
189
|
+
compact=compact,
|
|
190
|
+
metadata=metadata,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
sitemap_request.additional_properties = d
|
|
194
|
+
return sitemap_request
|
|
195
|
+
|
|
196
|
+
@property
|
|
197
|
+
def additional_keys(self) -> list[str]:
|
|
198
|
+
return list(self.additional_properties.keys())
|
|
199
|
+
|
|
200
|
+
def __getitem__(self, key: str) -> Any:
|
|
201
|
+
return self.additional_properties[key]
|
|
202
|
+
|
|
203
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
204
|
+
self.additional_properties[key] = value
|
|
205
|
+
|
|
206
|
+
def __delitem__(self, key: str) -> None:
|
|
207
|
+
del self.additional_properties[key]
|
|
208
|
+
|
|
209
|
+
def __contains__(self, key: str) -> bool:
|
|
210
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import (
|
|
3
|
+
TYPE_CHECKING,
|
|
4
|
+
Any,
|
|
5
|
+
TypeVar,
|
|
6
|
+
Union,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
from attrs import define as _attrs_define
|
|
10
|
+
from attrs import field as _attrs_field
|
|
11
|
+
|
|
12
|
+
from ..types import UNSET, Unset
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from ..models.sitemap_request_process_type_0_options import (
|
|
16
|
+
SitemapRequestProcessType0Options,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
T = TypeVar("T", bound="SitemapRequestProcessType0")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@_attrs_define
|
|
24
|
+
class SitemapRequestProcessType0:
|
|
25
|
+
"""
|
|
26
|
+
Attributes:
|
|
27
|
+
action (Union[Unset, str]):
|
|
28
|
+
options (Union[Unset, SitemapRequestProcessType0Options]):
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
action: Union[Unset, str] = UNSET
|
|
32
|
+
options: Union[Unset, "SitemapRequestProcessType0Options"] = UNSET
|
|
33
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
34
|
+
|
|
35
|
+
def to_dict(self) -> dict[str, Any]:
|
|
36
|
+
action = self.action
|
|
37
|
+
|
|
38
|
+
options: Union[Unset, dict[str, Any]] = UNSET
|
|
39
|
+
if not isinstance(self.options, Unset):
|
|
40
|
+
options = self.options.to_dict()
|
|
41
|
+
|
|
42
|
+
field_dict: dict[str, Any] = {}
|
|
43
|
+
field_dict.update(self.additional_properties)
|
|
44
|
+
field_dict.update({})
|
|
45
|
+
if action is not UNSET:
|
|
46
|
+
field_dict["action"] = action
|
|
47
|
+
if options is not UNSET:
|
|
48
|
+
field_dict["options"] = options
|
|
49
|
+
|
|
50
|
+
return field_dict
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
54
|
+
from ..models.sitemap_request_process_type_0_options import (
|
|
55
|
+
SitemapRequestProcessType0Options,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
d = dict(src_dict)
|
|
59
|
+
action = d.pop("action", UNSET)
|
|
60
|
+
|
|
61
|
+
_options = d.pop("options", UNSET)
|
|
62
|
+
options: Union[Unset, SitemapRequestProcessType0Options]
|
|
63
|
+
if isinstance(_options, Unset):
|
|
64
|
+
options = UNSET
|
|
65
|
+
else:
|
|
66
|
+
options = SitemapRequestProcessType0Options.from_dict(_options)
|
|
67
|
+
|
|
68
|
+
sitemap_request_process_type_0 = cls(
|
|
69
|
+
action=action,
|
|
70
|
+
options=options,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
sitemap_request_process_type_0.additional_properties = d
|
|
74
|
+
return sitemap_request_process_type_0
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def additional_keys(self) -> list[str]:
|
|
78
|
+
return list(self.additional_properties.keys())
|
|
79
|
+
|
|
80
|
+
def __getitem__(self, key: str) -> Any:
|
|
81
|
+
return self.additional_properties[key]
|
|
82
|
+
|
|
83
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
84
|
+
self.additional_properties[key] = value
|
|
85
|
+
|
|
86
|
+
def __delitem__(self, key: str) -> None:
|
|
87
|
+
del self.additional_properties[key]
|
|
88
|
+
|
|
89
|
+
def __contains__(self, key: str) -> bool:
|
|
90
|
+
return key in self.additional_properties
|