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,183 @@
|
|
|
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 ..types import UNSET, Unset
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
from ..models.scrape_scored_image import ScrapeScoredImage
|
|
17
|
+
from ..models.scrape_scored_link import ScrapeScoredLink
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
T = TypeVar("T", bound="ScrapeFormats")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@_attrs_define
|
|
24
|
+
class ScrapeFormats:
|
|
25
|
+
"""
|
|
26
|
+
Attributes:
|
|
27
|
+
raw_html (Union[Unset, str]):
|
|
28
|
+
html (Union[Unset, str]):
|
|
29
|
+
markdown (Union[Unset, str]):
|
|
30
|
+
links (Union[Unset, list['ScrapeScoredLink'], list[str]]): Plain URL strings by default. When
|
|
31
|
+
markdownIncludeMedia=true, an array of ScrapeScoredLink objects.
|
|
32
|
+
images (Union[Unset, list['ScrapeScoredImage'], list[str]]): Plain URL strings by default. When
|
|
33
|
+
markdownIncludeMedia=true, an array of ScrapeScoredImage objects.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
raw_html: Union[Unset, str] = UNSET
|
|
37
|
+
html: Union[Unset, str] = UNSET
|
|
38
|
+
markdown: Union[Unset, str] = UNSET
|
|
39
|
+
links: Union[Unset, list["ScrapeScoredLink"], list[str]] = UNSET
|
|
40
|
+
images: Union[Unset, list["ScrapeScoredImage"], list[str]] = UNSET
|
|
41
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
42
|
+
|
|
43
|
+
def to_dict(self) -> dict[str, Any]:
|
|
44
|
+
raw_html = self.raw_html
|
|
45
|
+
|
|
46
|
+
html = self.html
|
|
47
|
+
|
|
48
|
+
markdown = self.markdown
|
|
49
|
+
|
|
50
|
+
links: Union[Unset, list[dict[str, Any]], list[str]]
|
|
51
|
+
if isinstance(self.links, Unset):
|
|
52
|
+
links = UNSET
|
|
53
|
+
elif isinstance(self.links, list):
|
|
54
|
+
links = []
|
|
55
|
+
for links_type_0_item_data in self.links:
|
|
56
|
+
links_type_0_item = links_type_0_item_data.to_dict()
|
|
57
|
+
links.append(links_type_0_item)
|
|
58
|
+
|
|
59
|
+
else:
|
|
60
|
+
links = self.links
|
|
61
|
+
|
|
62
|
+
images: Union[Unset, list[dict[str, Any]], list[str]]
|
|
63
|
+
if isinstance(self.images, Unset):
|
|
64
|
+
images = UNSET
|
|
65
|
+
elif isinstance(self.images, list):
|
|
66
|
+
images = []
|
|
67
|
+
for images_type_0_item_data in self.images:
|
|
68
|
+
images_type_0_item = images_type_0_item_data.to_dict()
|
|
69
|
+
images.append(images_type_0_item)
|
|
70
|
+
|
|
71
|
+
else:
|
|
72
|
+
images = self.images
|
|
73
|
+
|
|
74
|
+
field_dict: dict[str, Any] = {}
|
|
75
|
+
field_dict.update(self.additional_properties)
|
|
76
|
+
field_dict.update({})
|
|
77
|
+
if raw_html is not UNSET:
|
|
78
|
+
field_dict["raw_html"] = raw_html
|
|
79
|
+
if html is not UNSET:
|
|
80
|
+
field_dict["html"] = html
|
|
81
|
+
if markdown is not UNSET:
|
|
82
|
+
field_dict["markdown"] = markdown
|
|
83
|
+
if links is not UNSET:
|
|
84
|
+
field_dict["links"] = links
|
|
85
|
+
if images is not UNSET:
|
|
86
|
+
field_dict["images"] = images
|
|
87
|
+
|
|
88
|
+
return field_dict
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
92
|
+
from ..models.scrape_scored_image import ScrapeScoredImage
|
|
93
|
+
from ..models.scrape_scored_link import ScrapeScoredLink
|
|
94
|
+
|
|
95
|
+
d = dict(src_dict)
|
|
96
|
+
raw_html = d.pop("raw_html", UNSET)
|
|
97
|
+
|
|
98
|
+
html = d.pop("html", UNSET)
|
|
99
|
+
|
|
100
|
+
markdown = d.pop("markdown", UNSET)
|
|
101
|
+
|
|
102
|
+
def _parse_links(
|
|
103
|
+
data: object,
|
|
104
|
+
) -> Union[Unset, list["ScrapeScoredLink"], list[str]]:
|
|
105
|
+
if isinstance(data, Unset):
|
|
106
|
+
return data
|
|
107
|
+
try:
|
|
108
|
+
if not isinstance(data, list):
|
|
109
|
+
raise TypeError()
|
|
110
|
+
links_type_0 = []
|
|
111
|
+
_links_type_0 = data
|
|
112
|
+
for links_type_0_item_data in _links_type_0:
|
|
113
|
+
links_type_0_item = ScrapeScoredLink.from_dict(
|
|
114
|
+
links_type_0_item_data
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
links_type_0.append(links_type_0_item)
|
|
118
|
+
|
|
119
|
+
return links_type_0
|
|
120
|
+
except: # noqa: E722
|
|
121
|
+
pass
|
|
122
|
+
if not isinstance(data, list):
|
|
123
|
+
raise TypeError()
|
|
124
|
+
links_type_1 = cast(list[str], data)
|
|
125
|
+
|
|
126
|
+
return links_type_1
|
|
127
|
+
|
|
128
|
+
links = _parse_links(d.pop("links", UNSET))
|
|
129
|
+
|
|
130
|
+
def _parse_images(
|
|
131
|
+
data: object,
|
|
132
|
+
) -> Union[Unset, list["ScrapeScoredImage"], list[str]]:
|
|
133
|
+
if isinstance(data, Unset):
|
|
134
|
+
return data
|
|
135
|
+
try:
|
|
136
|
+
if not isinstance(data, list):
|
|
137
|
+
raise TypeError()
|
|
138
|
+
images_type_0 = []
|
|
139
|
+
_images_type_0 = data
|
|
140
|
+
for images_type_0_item_data in _images_type_0:
|
|
141
|
+
images_type_0_item = ScrapeScoredImage.from_dict(
|
|
142
|
+
images_type_0_item_data
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
images_type_0.append(images_type_0_item)
|
|
146
|
+
|
|
147
|
+
return images_type_0
|
|
148
|
+
except: # noqa: E722
|
|
149
|
+
pass
|
|
150
|
+
if not isinstance(data, list):
|
|
151
|
+
raise TypeError()
|
|
152
|
+
images_type_1 = cast(list[str], data)
|
|
153
|
+
|
|
154
|
+
return images_type_1
|
|
155
|
+
|
|
156
|
+
images = _parse_images(d.pop("images", UNSET))
|
|
157
|
+
|
|
158
|
+
scrape_formats = cls(
|
|
159
|
+
raw_html=raw_html,
|
|
160
|
+
html=html,
|
|
161
|
+
markdown=markdown,
|
|
162
|
+
links=links,
|
|
163
|
+
images=images,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
scrape_formats.additional_properties = d
|
|
167
|
+
return scrape_formats
|
|
168
|
+
|
|
169
|
+
@property
|
|
170
|
+
def additional_keys(self) -> list[str]:
|
|
171
|
+
return list(self.additional_properties.keys())
|
|
172
|
+
|
|
173
|
+
def __getitem__(self, key: str) -> Any:
|
|
174
|
+
return self.additional_properties[key]
|
|
175
|
+
|
|
176
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
177
|
+
self.additional_properties[key] = value
|
|
178
|
+
|
|
179
|
+
def __delitem__(self, key: str) -> None:
|
|
180
|
+
del self.additional_properties[key]
|
|
181
|
+
|
|
182
|
+
def __contains__(self, key: str) -> bool:
|
|
183
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,75 @@
|
|
|
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="ScrapeMarkdownTokens")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@_attrs_define
|
|
11
|
+
class ScrapeMarkdownTokens:
|
|
12
|
+
"""
|
|
13
|
+
Attributes:
|
|
14
|
+
kept (int): Estimated token count of the returned (possibly truncated) markdown.
|
|
15
|
+
total (int): Estimated token count of the full markdown before any truncation.
|
|
16
|
+
truncated (bool): True when the output was truncated to fit within the requested `token_budget`.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
kept: int
|
|
20
|
+
total: int
|
|
21
|
+
truncated: bool
|
|
22
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
23
|
+
|
|
24
|
+
def to_dict(self) -> dict[str, Any]:
|
|
25
|
+
kept = self.kept
|
|
26
|
+
|
|
27
|
+
total = self.total
|
|
28
|
+
|
|
29
|
+
truncated = self.truncated
|
|
30
|
+
|
|
31
|
+
field_dict: dict[str, Any] = {}
|
|
32
|
+
field_dict.update(self.additional_properties)
|
|
33
|
+
field_dict.update(
|
|
34
|
+
{
|
|
35
|
+
"kept": kept,
|
|
36
|
+
"total": total,
|
|
37
|
+
"truncated": truncated,
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
return field_dict
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
45
|
+
d = dict(src_dict)
|
|
46
|
+
kept = d.pop("kept")
|
|
47
|
+
|
|
48
|
+
total = d.pop("total")
|
|
49
|
+
|
|
50
|
+
truncated = d.pop("truncated")
|
|
51
|
+
|
|
52
|
+
scrape_markdown_tokens = cls(
|
|
53
|
+
kept=kept,
|
|
54
|
+
total=total,
|
|
55
|
+
truncated=truncated,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
scrape_markdown_tokens.additional_properties = d
|
|
59
|
+
return scrape_markdown_tokens
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def additional_keys(self) -> list[str]:
|
|
63
|
+
return list(self.additional_properties.keys())
|
|
64
|
+
|
|
65
|
+
def __getitem__(self, key: str) -> Any:
|
|
66
|
+
return self.additional_properties[key]
|
|
67
|
+
|
|
68
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
69
|
+
self.additional_properties[key] = value
|
|
70
|
+
|
|
71
|
+
def __delitem__(self, key: str) -> None:
|
|
72
|
+
del self.additional_properties[key]
|
|
73
|
+
|
|
74
|
+
def __contains__(self, key: str) -> bool:
|
|
75
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,262 @@
|
|
|
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 ..types import UNSET, Unset
|
|
15
|
+
|
|
16
|
+
T = TypeVar("T", bound="ScrapeMetadata")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@_attrs_define
|
|
20
|
+
class ScrapeMetadata:
|
|
21
|
+
"""
|
|
22
|
+
Attributes:
|
|
23
|
+
title (Union[None, str]):
|
|
24
|
+
description (Union[None, str]):
|
|
25
|
+
language (Union[None, str]):
|
|
26
|
+
canonical_url (Union[None, str]):
|
|
27
|
+
og_title (Union[None, str]):
|
|
28
|
+
og_description (Union[None, str]):
|
|
29
|
+
og_image (Union[None, str]):
|
|
30
|
+
byline (Union[None, str]): Article byline (author). Always present in the metadata object. Null when not
|
|
31
|
+
extracted or not a structured-markdown request. Non-null values available only on the synchronous response and
|
|
32
|
+
webhook delivery. Always `null` on `GET /v1/scrape/:id`, bulk results, and cached hits.
|
|
33
|
+
published_at (Union[None, datetime.datetime]): Article published timestamp. Always present in the metadata
|
|
34
|
+
object. Null when not extracted or not a structured-markdown request. Non-null values available only on the
|
|
35
|
+
synchronous response and webhook delivery. Always `null` on `GET /v1/scrape/:id`, bulk results, and cached hits.
|
|
36
|
+
og_url (Union[None, Unset, str]):
|
|
37
|
+
og_site_name (Union[None, Unset, str]):
|
|
38
|
+
robots (Union[None, Unset, str]):
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
title: Union[None, str]
|
|
42
|
+
description: Union[None, str]
|
|
43
|
+
language: Union[None, str]
|
|
44
|
+
canonical_url: Union[None, str]
|
|
45
|
+
og_title: Union[None, str]
|
|
46
|
+
og_description: Union[None, str]
|
|
47
|
+
og_image: Union[None, str]
|
|
48
|
+
byline: Union[None, str]
|
|
49
|
+
published_at: Union[None, datetime.datetime]
|
|
50
|
+
og_url: Union[None, Unset, str] = UNSET
|
|
51
|
+
og_site_name: Union[None, Unset, str] = UNSET
|
|
52
|
+
robots: Union[None, Unset, str] = UNSET
|
|
53
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> dict[str, Any]:
|
|
56
|
+
title: Union[None, str]
|
|
57
|
+
title = self.title
|
|
58
|
+
|
|
59
|
+
description: Union[None, str]
|
|
60
|
+
description = self.description
|
|
61
|
+
|
|
62
|
+
language: Union[None, str]
|
|
63
|
+
language = self.language
|
|
64
|
+
|
|
65
|
+
canonical_url: Union[None, str]
|
|
66
|
+
canonical_url = self.canonical_url
|
|
67
|
+
|
|
68
|
+
og_title: Union[None, str]
|
|
69
|
+
og_title = self.og_title
|
|
70
|
+
|
|
71
|
+
og_description: Union[None, str]
|
|
72
|
+
og_description = self.og_description
|
|
73
|
+
|
|
74
|
+
og_image: Union[None, str]
|
|
75
|
+
og_image = self.og_image
|
|
76
|
+
|
|
77
|
+
byline: Union[None, str]
|
|
78
|
+
byline = self.byline
|
|
79
|
+
|
|
80
|
+
published_at: Union[None, str]
|
|
81
|
+
if isinstance(self.published_at, datetime.datetime):
|
|
82
|
+
published_at = self.published_at.isoformat()
|
|
83
|
+
else:
|
|
84
|
+
published_at = self.published_at
|
|
85
|
+
|
|
86
|
+
og_url: Union[None, Unset, str]
|
|
87
|
+
if isinstance(self.og_url, Unset):
|
|
88
|
+
og_url = UNSET
|
|
89
|
+
else:
|
|
90
|
+
og_url = self.og_url
|
|
91
|
+
|
|
92
|
+
og_site_name: Union[None, Unset, str]
|
|
93
|
+
if isinstance(self.og_site_name, Unset):
|
|
94
|
+
og_site_name = UNSET
|
|
95
|
+
else:
|
|
96
|
+
og_site_name = self.og_site_name
|
|
97
|
+
|
|
98
|
+
robots: Union[None, Unset, str]
|
|
99
|
+
if isinstance(self.robots, Unset):
|
|
100
|
+
robots = UNSET
|
|
101
|
+
else:
|
|
102
|
+
robots = self.robots
|
|
103
|
+
|
|
104
|
+
field_dict: dict[str, Any] = {}
|
|
105
|
+
field_dict.update(self.additional_properties)
|
|
106
|
+
field_dict.update(
|
|
107
|
+
{
|
|
108
|
+
"title": title,
|
|
109
|
+
"description": description,
|
|
110
|
+
"language": language,
|
|
111
|
+
"canonicalUrl": canonical_url,
|
|
112
|
+
"ogTitle": og_title,
|
|
113
|
+
"ogDescription": og_description,
|
|
114
|
+
"ogImage": og_image,
|
|
115
|
+
"byline": byline,
|
|
116
|
+
"publishedAt": published_at,
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
if og_url is not UNSET:
|
|
120
|
+
field_dict["ogUrl"] = og_url
|
|
121
|
+
if og_site_name is not UNSET:
|
|
122
|
+
field_dict["ogSiteName"] = og_site_name
|
|
123
|
+
if robots is not UNSET:
|
|
124
|
+
field_dict["robots"] = robots
|
|
125
|
+
|
|
126
|
+
return field_dict
|
|
127
|
+
|
|
128
|
+
@classmethod
|
|
129
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
130
|
+
d = dict(src_dict)
|
|
131
|
+
|
|
132
|
+
def _parse_title(data: object) -> Union[None, str]:
|
|
133
|
+
if data is None:
|
|
134
|
+
return data
|
|
135
|
+
return cast(Union[None, str], data)
|
|
136
|
+
|
|
137
|
+
title = _parse_title(d.pop("title"))
|
|
138
|
+
|
|
139
|
+
def _parse_description(data: object) -> Union[None, str]:
|
|
140
|
+
if data is None:
|
|
141
|
+
return data
|
|
142
|
+
return cast(Union[None, str], data)
|
|
143
|
+
|
|
144
|
+
description = _parse_description(d.pop("description"))
|
|
145
|
+
|
|
146
|
+
def _parse_language(data: object) -> Union[None, str]:
|
|
147
|
+
if data is None:
|
|
148
|
+
return data
|
|
149
|
+
return cast(Union[None, str], data)
|
|
150
|
+
|
|
151
|
+
language = _parse_language(d.pop("language"))
|
|
152
|
+
|
|
153
|
+
def _parse_canonical_url(data: object) -> Union[None, str]:
|
|
154
|
+
if data is None:
|
|
155
|
+
return data
|
|
156
|
+
return cast(Union[None, str], data)
|
|
157
|
+
|
|
158
|
+
canonical_url = _parse_canonical_url(d.pop("canonicalUrl"))
|
|
159
|
+
|
|
160
|
+
def _parse_og_title(data: object) -> Union[None, str]:
|
|
161
|
+
if data is None:
|
|
162
|
+
return data
|
|
163
|
+
return cast(Union[None, str], data)
|
|
164
|
+
|
|
165
|
+
og_title = _parse_og_title(d.pop("ogTitle"))
|
|
166
|
+
|
|
167
|
+
def _parse_og_description(data: object) -> Union[None, str]:
|
|
168
|
+
if data is None:
|
|
169
|
+
return data
|
|
170
|
+
return cast(Union[None, str], data)
|
|
171
|
+
|
|
172
|
+
og_description = _parse_og_description(d.pop("ogDescription"))
|
|
173
|
+
|
|
174
|
+
def _parse_og_image(data: object) -> Union[None, str]:
|
|
175
|
+
if data is None:
|
|
176
|
+
return data
|
|
177
|
+
return cast(Union[None, str], data)
|
|
178
|
+
|
|
179
|
+
og_image = _parse_og_image(d.pop("ogImage"))
|
|
180
|
+
|
|
181
|
+
def _parse_byline(data: object) -> Union[None, str]:
|
|
182
|
+
if data is None:
|
|
183
|
+
return data
|
|
184
|
+
return cast(Union[None, str], data)
|
|
185
|
+
|
|
186
|
+
byline = _parse_byline(d.pop("byline"))
|
|
187
|
+
|
|
188
|
+
def _parse_published_at(data: object) -> Union[None, datetime.datetime]:
|
|
189
|
+
if data is None:
|
|
190
|
+
return data
|
|
191
|
+
try:
|
|
192
|
+
if not isinstance(data, str):
|
|
193
|
+
raise TypeError()
|
|
194
|
+
published_at_type_0 = isoparse(data)
|
|
195
|
+
|
|
196
|
+
return published_at_type_0
|
|
197
|
+
except: # noqa: E722
|
|
198
|
+
pass
|
|
199
|
+
return cast(Union[None, datetime.datetime], data)
|
|
200
|
+
|
|
201
|
+
published_at = _parse_published_at(d.pop("publishedAt"))
|
|
202
|
+
|
|
203
|
+
def _parse_og_url(data: object) -> Union[None, Unset, str]:
|
|
204
|
+
if data is None:
|
|
205
|
+
return data
|
|
206
|
+
if isinstance(data, Unset):
|
|
207
|
+
return data
|
|
208
|
+
return cast(Union[None, Unset, str], data)
|
|
209
|
+
|
|
210
|
+
og_url = _parse_og_url(d.pop("ogUrl", UNSET))
|
|
211
|
+
|
|
212
|
+
def _parse_og_site_name(data: object) -> Union[None, Unset, str]:
|
|
213
|
+
if data is None:
|
|
214
|
+
return data
|
|
215
|
+
if isinstance(data, Unset):
|
|
216
|
+
return data
|
|
217
|
+
return cast(Union[None, Unset, str], data)
|
|
218
|
+
|
|
219
|
+
og_site_name = _parse_og_site_name(d.pop("ogSiteName", UNSET))
|
|
220
|
+
|
|
221
|
+
def _parse_robots(data: object) -> Union[None, Unset, str]:
|
|
222
|
+
if data is None:
|
|
223
|
+
return data
|
|
224
|
+
if isinstance(data, Unset):
|
|
225
|
+
return data
|
|
226
|
+
return cast(Union[None, Unset, str], data)
|
|
227
|
+
|
|
228
|
+
robots = _parse_robots(d.pop("robots", UNSET))
|
|
229
|
+
|
|
230
|
+
scrape_metadata = cls(
|
|
231
|
+
title=title,
|
|
232
|
+
description=description,
|
|
233
|
+
language=language,
|
|
234
|
+
canonical_url=canonical_url,
|
|
235
|
+
og_title=og_title,
|
|
236
|
+
og_description=og_description,
|
|
237
|
+
og_image=og_image,
|
|
238
|
+
byline=byline,
|
|
239
|
+
published_at=published_at,
|
|
240
|
+
og_url=og_url,
|
|
241
|
+
og_site_name=og_site_name,
|
|
242
|
+
robots=robots,
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
scrape_metadata.additional_properties = d
|
|
246
|
+
return scrape_metadata
|
|
247
|
+
|
|
248
|
+
@property
|
|
249
|
+
def additional_keys(self) -> list[str]:
|
|
250
|
+
return list(self.additional_properties.keys())
|
|
251
|
+
|
|
252
|
+
def __getitem__(self, key: str) -> Any:
|
|
253
|
+
return self.additional_properties[key]
|
|
254
|
+
|
|
255
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
256
|
+
self.additional_properties[key] = value
|
|
257
|
+
|
|
258
|
+
def __delitem__(self, key: str) -> None:
|
|
259
|
+
del self.additional_properties[key]
|
|
260
|
+
|
|
261
|
+
def __contains__(self, key: str) -> bool:
|
|
262
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from collections.abc import Mapping
|
|
3
|
+
from typing import (
|
|
4
|
+
Any,
|
|
5
|
+
TypeVar,
|
|
6
|
+
cast,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
from attrs import define as _attrs_define
|
|
10
|
+
from attrs import field as _attrs_field
|
|
11
|
+
from dateutil.parser import isoparse
|
|
12
|
+
|
|
13
|
+
from ..models.scrape_queued_envelope_schema_version import (
|
|
14
|
+
ScrapeQueuedEnvelopeSchemaVersion,
|
|
15
|
+
)
|
|
16
|
+
from ..models.scrape_queued_envelope_status import ScrapeQueuedEnvelopeStatus
|
|
17
|
+
|
|
18
|
+
T = TypeVar("T", bound="ScrapeQueuedEnvelope")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@_attrs_define
|
|
22
|
+
class ScrapeQueuedEnvelope:
|
|
23
|
+
"""
|
|
24
|
+
Example:
|
|
25
|
+
{'schema_version': 1, 'status': 'queued', 'id': 'sc_01j9abc123', 'url': 'https://example.com', 'status_url':
|
|
26
|
+
'https://api.bytekit.com/v1/scrape/sc_01j9abc123', 'queued_at': datetime.datetime(2025, 1, 15, 12, 0,
|
|
27
|
+
tzinfo=datetime.timezone(datetime.timedelta(0), 'Z')), 'events': []}
|
|
28
|
+
|
|
29
|
+
Attributes:
|
|
30
|
+
schema_version (ScrapeQueuedEnvelopeSchemaVersion): Envelope contract version emitted by current producers.
|
|
31
|
+
Consumers reading persisted envelopes must tolerate its absence as legacy v0 during rolling deploys.
|
|
32
|
+
status (ScrapeQueuedEnvelopeStatus):
|
|
33
|
+
id (str): Stable job identifier (sc_… prefixed).
|
|
34
|
+
url (str):
|
|
35
|
+
status_url (str):
|
|
36
|
+
queued_at (datetime.datetime):
|
|
37
|
+
events (list[str]):
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
schema_version: ScrapeQueuedEnvelopeSchemaVersion
|
|
41
|
+
status: ScrapeQueuedEnvelopeStatus
|
|
42
|
+
id: str
|
|
43
|
+
url: str
|
|
44
|
+
status_url: str
|
|
45
|
+
queued_at: datetime.datetime
|
|
46
|
+
events: list[str]
|
|
47
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
48
|
+
|
|
49
|
+
def to_dict(self) -> dict[str, Any]:
|
|
50
|
+
schema_version = self.schema_version.value
|
|
51
|
+
|
|
52
|
+
status = self.status.value
|
|
53
|
+
|
|
54
|
+
id = self.id
|
|
55
|
+
|
|
56
|
+
url = self.url
|
|
57
|
+
|
|
58
|
+
status_url = self.status_url
|
|
59
|
+
|
|
60
|
+
queued_at = self.queued_at.isoformat()
|
|
61
|
+
|
|
62
|
+
events = self.events
|
|
63
|
+
|
|
64
|
+
field_dict: dict[str, Any] = {}
|
|
65
|
+
field_dict.update(self.additional_properties)
|
|
66
|
+
field_dict.update(
|
|
67
|
+
{
|
|
68
|
+
"schema_version": schema_version,
|
|
69
|
+
"status": status,
|
|
70
|
+
"id": id,
|
|
71
|
+
"url": url,
|
|
72
|
+
"status_url": status_url,
|
|
73
|
+
"queued_at": queued_at,
|
|
74
|
+
"events": events,
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return field_dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
82
|
+
d = dict(src_dict)
|
|
83
|
+
schema_version = ScrapeQueuedEnvelopeSchemaVersion(d.pop("schema_version"))
|
|
84
|
+
|
|
85
|
+
status = ScrapeQueuedEnvelopeStatus(d.pop("status"))
|
|
86
|
+
|
|
87
|
+
id = d.pop("id")
|
|
88
|
+
|
|
89
|
+
url = d.pop("url")
|
|
90
|
+
|
|
91
|
+
status_url = d.pop("status_url")
|
|
92
|
+
|
|
93
|
+
queued_at = isoparse(d.pop("queued_at"))
|
|
94
|
+
|
|
95
|
+
events = cast(list[str], d.pop("events"))
|
|
96
|
+
|
|
97
|
+
scrape_queued_envelope = cls(
|
|
98
|
+
schema_version=schema_version,
|
|
99
|
+
status=status,
|
|
100
|
+
id=id,
|
|
101
|
+
url=url,
|
|
102
|
+
status_url=status_url,
|
|
103
|
+
queued_at=queued_at,
|
|
104
|
+
events=events,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
scrape_queued_envelope.additional_properties = d
|
|
108
|
+
return scrape_queued_envelope
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def additional_keys(self) -> list[str]:
|
|
112
|
+
return list(self.additional_properties.keys())
|
|
113
|
+
|
|
114
|
+
def __getitem__(self, key: str) -> Any:
|
|
115
|
+
return self.additional_properties[key]
|
|
116
|
+
|
|
117
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
118
|
+
self.additional_properties[key] = value
|
|
119
|
+
|
|
120
|
+
def __delitem__(self, key: str) -> None:
|
|
121
|
+
del self.additional_properties[key]
|
|
122
|
+
|
|
123
|
+
def __contains__(self, key: str) -> bool:
|
|
124
|
+
return key in self.additional_properties
|