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.
Files changed (227) hide show
  1. bytekit/__init__.py +8 -0
  2. bytekit/api/__init__.py +1 -0
  3. bytekit/api/account/__init__.py +1 -0
  4. bytekit/api/account/get_account.py +157 -0
  5. bytekit/api/bulk/__init__.py +1 -0
  6. bytekit/api/bulk/create_bulk.py +204 -0
  7. bytekit/api/bulk/delete_bulk.py +177 -0
  8. bytekit/api/bulk/get_bulk.py +157 -0
  9. bytekit/api/bulk/list_bulk_screenshots.py +152 -0
  10. bytekit/api/fetch/__init__.py +1 -0
  11. bytekit/api/fetch/get_fetch.py +254 -0
  12. bytekit/api/fetch/post_fetch.py +178 -0
  13. bytekit/api/fetch_bulk/__init__.py +1 -0
  14. bytekit/api/fetch_bulk/create_fetch_bulk.py +180 -0
  15. bytekit/api/fetch_bulk/get_fetch_bulk.py +157 -0
  16. bytekit/api/monitors/__init__.py +1 -0
  17. bytekit/api/monitors/create_monitor.py +180 -0
  18. bytekit/api/monitors/delete_monitor.py +155 -0
  19. bytekit/api/monitors/get_monitor.py +157 -0
  20. bytekit/api/monitors/list_monitor_captures.py +188 -0
  21. bytekit/api/monitors/list_monitors.py +193 -0
  22. bytekit/api/monitors/update_monitor.py +191 -0
  23. bytekit/api/scrape/__init__.py +1 -0
  24. bytekit/api/scrape/create_scrape.py +197 -0
  25. bytekit/api/scrape/get_scrape.py +231 -0
  26. bytekit/api/scrape_bulk/__init__.py +1 -0
  27. bytekit/api/scrape_bulk/create_scrape_bulk.py +188 -0
  28. bytekit/api/scrape_bulk/get_scrape_bulk.py +157 -0
  29. bytekit/api/screenshots/__init__.py +1 -0
  30. bytekit/api/screenshots/create_screenshot.py +208 -0
  31. bytekit/api/screenshots/get_screenshot.py +177 -0
  32. bytekit/api/search/__init__.py +1 -0
  33. bytekit/api/search/create_search.py +225 -0
  34. bytekit/api/sitemap/__init__.py +1 -0
  35. bytekit/api/sitemap/create_sitemap.py +192 -0
  36. bytekit/api/sitemap/get_sitemap.py +157 -0
  37. bytekit/api/usage/__init__.py +1 -0
  38. bytekit/api/usage/get_usage.py +126 -0
  39. bytekit/api/usage/get_usage_by_endpoint.py +215 -0
  40. bytekit/api/usage/get_usage_daily.py +203 -0
  41. bytekit/api/webhooks/__init__.py +1 -0
  42. bytekit/api/webhooks/list_webhook_deliveries.py +214 -0
  43. bytekit/api/webhooks/retry_webhook_delivery.py +165 -0
  44. bytekit/client.py +418 -0
  45. bytekit/errors.py +18 -0
  46. bytekit/models/__init__.py +401 -0
  47. bytekit/models/account_bearer_response.py +207 -0
  48. bytekit/models/account_bearer_response_api_key.py +134 -0
  49. bytekit/models/account_bearer_response_api_key_environment.py +8 -0
  50. bytekit/models/account_bearer_response_auto_topup.py +83 -0
  51. bytekit/models/account_bearer_response_plan.py +150 -0
  52. bytekit/models/account_bearer_response_subscription.py +85 -0
  53. bytekit/models/account_bearer_response_subscription_plan.py +99 -0
  54. bytekit/models/account_bearer_response_subscription_status.py +10 -0
  55. bytekit/models/account_session_response.py +164 -0
  56. bytekit/models/account_session_response_notifications.py +51 -0
  57. bytekit/models/account_session_response_plan.py +150 -0
  58. bytekit/models/bandwidth_balance.py +91 -0
  59. bytekit/models/capture_response.py +216 -0
  60. bytekit/models/capture_response_outcome.py +10 -0
  61. bytekit/models/clip.py +83 -0
  62. bytekit/models/cookie.py +90 -0
  63. bytekit/models/create_bulk_body.py +155 -0
  64. bytekit/models/create_bulk_body_defaults.py +423 -0
  65. bytekit/models/create_bulk_body_defaults_device.py +9 -0
  66. bytekit/models/create_bulk_body_defaults_device_scale_factor_type_1.py +9 -0
  67. bytekit/models/create_bulk_body_defaults_device_scale_factor_type_2_type_1.py +9 -0
  68. bytekit/models/create_bulk_body_defaults_device_scale_factor_type_3_type_1.py +9 -0
  69. bytekit/models/create_bulk_body_defaults_formats_item.py +12 -0
  70. bytekit/models/create_bulk_body_defaults_type.py +9 -0
  71. bytekit/models/create_bulk_body_defaults_viewport_type_0.py +67 -0
  72. bytekit/models/create_bulk_body_defaults_wait_until.py +10 -0
  73. bytekit/models/create_bulk_body_items_item.py +380 -0
  74. bytekit/models/create_bulk_body_items_item_device.py +9 -0
  75. bytekit/models/create_bulk_body_items_item_formats_item.py +12 -0
  76. bytekit/models/create_bulk_body_items_item_scenario.py +10 -0
  77. bytekit/models/create_bulk_body_items_item_type.py +9 -0
  78. bytekit/models/create_bulk_body_items_item_viewport_type_0.py +67 -0
  79. bytekit/models/create_bulk_body_items_item_wait_until.py +10 -0
  80. bytekit/models/create_bulk_response_202.py +164 -0
  81. bytekit/models/create_bulk_response_202_status.py +10 -0
  82. bytekit/models/create_fetch_bulk_body.py +161 -0
  83. bytekit/models/create_fetch_bulk_body_defaults.py +91 -0
  84. bytekit/models/create_fetch_bulk_body_defaults_format.py +9 -0
  85. bytekit/models/create_fetch_bulk_body_metadata.py +44 -0
  86. bytekit/models/create_fetch_bulk_body_urls_item_type_1.py +102 -0
  87. bytekit/models/create_fetch_bulk_body_urls_item_type_1_format.py +9 -0
  88. bytekit/models/create_fetch_bulk_response_202.py +44 -0
  89. bytekit/models/create_scrape_bulk_body.py +179 -0
  90. bytekit/models/create_scrape_bulk_body_custom.py +52 -0
  91. bytekit/models/create_scrape_bulk_body_defaults.py +167 -0
  92. bytekit/models/create_scrape_bulk_body_defaults_formats_item.py +12 -0
  93. bytekit/models/create_scrape_bulk_body_defaults_headers.py +44 -0
  94. bytekit/models/create_scrape_bulk_body_items_item.py +226 -0
  95. bytekit/models/create_scrape_bulk_body_items_item_custom.py +50 -0
  96. bytekit/models/create_scrape_bulk_body_items_item_formats_item.py +12 -0
  97. bytekit/models/create_scrape_bulk_body_items_item_headers.py +44 -0
  98. bytekit/models/create_scrape_bulk_body_items_item_metadata.py +44 -0
  99. bytekit/models/create_scrape_bulk_response_202.py +166 -0
  100. bytekit/models/create_scrape_bulk_response_202_status.py +10 -0
  101. bytekit/models/create_search_body.py +140 -0
  102. bytekit/models/create_search_body_date_range.py +13 -0
  103. bytekit/models/create_search_body_type.py +10 -0
  104. bytekit/models/create_search_response_200.py +119 -0
  105. bytekit/models/create_search_response_200_results_item.py +161 -0
  106. bytekit/models/create_search_response_200_results_item_image.py +113 -0
  107. bytekit/models/create_search_response_502.py +46 -0
  108. bytekit/models/create_search_response_502_error.py +8 -0
  109. bytekit/models/credit_balance.py +91 -0
  110. bytekit/models/delete_bulk_response_200.py +164 -0
  111. bytekit/models/delete_bulk_response_200_status.py +11 -0
  112. bytekit/models/error.py +83 -0
  113. bytekit/models/error_error.py +100 -0
  114. bytekit/models/error_status.py +8 -0
  115. bytekit/models/fetch_request.py +276 -0
  116. bytekit/models/fetch_request_cache_ttl_type_1.py +8 -0
  117. bytekit/models/fetch_request_custom.py +48 -0
  118. bytekit/models/fetch_request_format.py +9 -0
  119. bytekit/models/fetch_request_markdown_images.py +11 -0
  120. bytekit/models/fetch_request_markdown_links.py +11 -0
  121. bytekit/models/fetch_request_markdown_mode.py +10 -0
  122. bytekit/models/get_bulk_response_200.py +164 -0
  123. bytekit/models/get_bulk_response_200_status.py +11 -0
  124. bytekit/models/get_fetch_bulk_response_200.py +44 -0
  125. bytekit/models/get_fetch_cache_ttl_type_1.py +8 -0
  126. bytekit/models/get_fetch_format.py +9 -0
  127. bytekit/models/get_scrape_bulk_response_200.py +164 -0
  128. bytekit/models/get_scrape_bulk_response_200_status.py +11 -0
  129. bytekit/models/get_usage_by_endpoint_response_200.py +114 -0
  130. bytekit/models/get_usage_by_endpoint_response_200_rows_item.py +90 -0
  131. bytekit/models/get_usage_by_endpoint_response_200_rows_item_endpoint.py +17 -0
  132. bytekit/models/get_usage_by_endpoint_response_200_totals.py +67 -0
  133. bytekit/models/get_usage_daily_response_200.py +97 -0
  134. bytekit/models/get_usage_daily_response_200_data_item.py +219 -0
  135. bytekit/models/get_usage_response_200.py +344 -0
  136. bytekit/models/get_usage_response_200_plan_type.py +10 -0
  137. bytekit/models/list_bulk_screenshots_response_200.py +44 -0
  138. bytekit/models/list_monitor_captures_response_200.py +101 -0
  139. bytekit/models/list_monitors_response_200.py +101 -0
  140. bytekit/models/list_monitors_status.py +12 -0
  141. bytekit/models/list_webhook_deliveries_response_200.py +101 -0
  142. bytekit/models/list_webhook_deliveries_status.py +11 -0
  143. bytekit/models/metadata.py +44 -0
  144. bytekit/models/monitor_create_request.py +219 -0
  145. bytekit/models/monitor_create_request_interval_type.py +11 -0
  146. bytekit/models/monitor_create_request_notify_on.py +9 -0
  147. bytekit/models/monitor_create_request_options.py +44 -0
  148. bytekit/models/monitor_create_request_scrape_options.py +44 -0
  149. bytekit/models/monitor_create_request_type.py +9 -0
  150. bytekit/models/monitor_create_request_webhook_headers.py +44 -0
  151. bytekit/models/monitor_create_response.py +423 -0
  152. bytekit/models/monitor_response.py +411 -0
  153. bytekit/models/monitor_response_interval_type.py +11 -0
  154. bytekit/models/monitor_response_metadata_type_0.py +44 -0
  155. bytekit/models/monitor_response_status.py +12 -0
  156. bytekit/models/monitor_response_type.py +9 -0
  157. bytekit/models/monitor_response_webhook_headers_type_0.py +44 -0
  158. bytekit/models/monitor_update_request.py +223 -0
  159. bytekit/models/monitor_update_request_interval_type.py +11 -0
  160. bytekit/models/monitor_update_request_notify_on.py +9 -0
  161. bytekit/models/monitor_update_request_options.py +44 -0
  162. bytekit/models/monitor_update_request_scrape_options.py +44 -0
  163. bytekit/models/monitor_update_request_status.py +9 -0
  164. bytekit/models/monitor_update_request_webhook_headers.py +44 -0
  165. bytekit/models/scrape_error_envelope.py +113 -0
  166. bytekit/models/scrape_error_envelope_error.py +93 -0
  167. bytekit/models/scrape_error_envelope_error_code.py +18 -0
  168. bytekit/models/scrape_error_envelope_schema_version.py +8 -0
  169. bytekit/models/scrape_error_envelope_status.py +8 -0
  170. bytekit/models/scrape_formats.py +183 -0
  171. bytekit/models/scrape_markdown_tokens.py +75 -0
  172. bytekit/models/scrape_metadata.py +262 -0
  173. bytekit/models/scrape_queued_envelope.py +124 -0
  174. bytekit/models/scrape_queued_envelope_schema_version.py +8 -0
  175. bytekit/models/scrape_queued_envelope_status.py +8 -0
  176. bytekit/models/scrape_request.py +485 -0
  177. bytekit/models/scrape_request_cache_ttl_type_1.py +8 -0
  178. bytekit/models/scrape_request_custom.py +48 -0
  179. bytekit/models/scrape_request_events_item.py +10 -0
  180. bytekit/models/scrape_request_formats_item.py +12 -0
  181. bytekit/models/scrape_request_headers.py +44 -0
  182. bytekit/models/scrape_request_markdown_images.py +11 -0
  183. bytekit/models/scrape_request_markdown_links.py +11 -0
  184. bytekit/models/scrape_request_markdown_mode.py +10 -0
  185. bytekit/models/scrape_request_token_encoding.py +9 -0
  186. bytekit/models/scrape_request_x_internal_scrape_path.py +8 -0
  187. bytekit/models/scrape_scored_image.py +128 -0
  188. bytekit/models/scrape_scored_link.py +94 -0
  189. bytekit/models/scrape_stats.py +75 -0
  190. bytekit/models/scrape_success_envelope.py +345 -0
  191. bytekit/models/scrape_success_envelope_cache.py +10 -0
  192. bytekit/models/scrape_success_envelope_custom.py +48 -0
  193. bytekit/models/scrape_success_envelope_schema_version.py +8 -0
  194. bytekit/models/scrape_success_envelope_status.py +8 -0
  195. bytekit/models/scrape_table.py +96 -0
  196. bytekit/models/scrape_table_kind.py +10 -0
  197. bytekit/models/scrape_warning.py +88 -0
  198. bytekit/models/scrape_warning_code.py +17 -0
  199. bytekit/models/screenshot_request.py +445 -0
  200. bytekit/models/screenshot_request_device.py +9 -0
  201. bytekit/models/screenshot_request_device_scale_factor_type_1.py +9 -0
  202. bytekit/models/screenshot_request_device_scale_factor_type_2_type_1.py +9 -0
  203. bytekit/models/screenshot_request_device_scale_factor_type_3_type_1.py +9 -0
  204. bytekit/models/screenshot_request_format.py +9 -0
  205. bytekit/models/screenshot_request_headers.py +44 -0
  206. bytekit/models/screenshot_request_wait_until.py +10 -0
  207. bytekit/models/screenshot_response.py +264 -0
  208. bytekit/models/screenshot_response_status.py +11 -0
  209. bytekit/models/sitemap_request.py +210 -0
  210. bytekit/models/sitemap_request_process_type_0.py +90 -0
  211. bytekit/models/sitemap_request_process_type_0_options.py +44 -0
  212. bytekit/models/sitemap_request_strategy.py +10 -0
  213. bytekit/models/sitemap_response.py +418 -0
  214. bytekit/models/sitemap_response_cache.py +10 -0
  215. bytekit/models/sitemap_response_metadata_type_0.py +44 -0
  216. bytekit/models/sitemap_response_process_type_0.py +44 -0
  217. bytekit/models/sitemap_response_sources_type_0.py +44 -0
  218. bytekit/models/sitemap_response_status.py +11 -0
  219. bytekit/models/viewport.py +67 -0
  220. bytekit/models/webhook_delivery_response.py +270 -0
  221. bytekit/models/webhook_delivery_response_event_type.py +14 -0
  222. bytekit/models/webhook_delivery_response_status.py +11 -0
  223. bytekit/py.typed +0 -0
  224. bytekit/types.py +54 -0
  225. bytekit_sdk-0.3.0.dist-info/METADATA +141 -0
  226. bytekit_sdk-0.3.0.dist-info/RECORD +227 -0
  227. bytekit_sdk-0.3.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,157 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error import Error
9
+ from ...models.sitemap_response import SitemapResponse
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ id: str,
15
+ ) -> dict[str, Any]:
16
+ _kwargs: dict[str, Any] = {
17
+ "method": "get",
18
+ "url": "/v1/sitemap/{id}".format(
19
+ id=id,
20
+ ),
21
+ }
22
+
23
+ return _kwargs
24
+
25
+
26
+ def _parse_response(
27
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
28
+ ) -> Optional[Union[Error, SitemapResponse]]:
29
+ if response.status_code == 200:
30
+ response_200 = SitemapResponse.from_dict(response.json())
31
+
32
+ return response_200
33
+ if response.status_code == 404:
34
+ response_404 = Error.from_dict(response.json())
35
+
36
+ return response_404
37
+ if client.raise_on_unexpected_status:
38
+ raise errors.UnexpectedStatus(response.status_code, response.content)
39
+ else:
40
+ return None
41
+
42
+
43
+ def _build_response(
44
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
45
+ ) -> Response[Union[Error, SitemapResponse]]:
46
+ return Response(
47
+ status_code=HTTPStatus(response.status_code),
48
+ content=response.content,
49
+ headers=response.headers,
50
+ parsed=_parse_response(client=client, response=response),
51
+ )
52
+
53
+
54
+ def sync_detailed(
55
+ id: str,
56
+ *,
57
+ client: Union[AuthenticatedClient, Client],
58
+ ) -> Response[Union[Error, SitemapResponse]]:
59
+ """Get sitemap job status
60
+
61
+ Args:
62
+ id (str):
63
+
64
+ Raises:
65
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
66
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
67
+
68
+ Returns:
69
+ Response[Union[Error, SitemapResponse]]
70
+ """
71
+
72
+ kwargs = _get_kwargs(
73
+ id=id,
74
+ )
75
+
76
+ response = client.get_httpx_client().request(
77
+ **kwargs,
78
+ )
79
+
80
+ return _build_response(client=client, response=response)
81
+
82
+
83
+ def sync(
84
+ id: str,
85
+ *,
86
+ client: Union[AuthenticatedClient, Client],
87
+ ) -> Optional[Union[Error, SitemapResponse]]:
88
+ """Get sitemap job status
89
+
90
+ Args:
91
+ id (str):
92
+
93
+ Raises:
94
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
95
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
96
+
97
+ Returns:
98
+ Union[Error, SitemapResponse]
99
+ """
100
+
101
+ return sync_detailed(
102
+ id=id,
103
+ client=client,
104
+ ).parsed
105
+
106
+
107
+ async def asyncio_detailed(
108
+ id: str,
109
+ *,
110
+ client: Union[AuthenticatedClient, Client],
111
+ ) -> Response[Union[Error, SitemapResponse]]:
112
+ """Get sitemap job status
113
+
114
+ Args:
115
+ id (str):
116
+
117
+ Raises:
118
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
119
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
120
+
121
+ Returns:
122
+ Response[Union[Error, SitemapResponse]]
123
+ """
124
+
125
+ kwargs = _get_kwargs(
126
+ id=id,
127
+ )
128
+
129
+ response = await client.get_async_httpx_client().request(**kwargs)
130
+
131
+ return _build_response(client=client, response=response)
132
+
133
+
134
+ async def asyncio(
135
+ id: str,
136
+ *,
137
+ client: Union[AuthenticatedClient, Client],
138
+ ) -> Optional[Union[Error, SitemapResponse]]:
139
+ """Get sitemap job status
140
+
141
+ Args:
142
+ id (str):
143
+
144
+ Raises:
145
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
146
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
147
+
148
+ Returns:
149
+ Union[Error, SitemapResponse]
150
+ """
151
+
152
+ return (
153
+ await asyncio_detailed(
154
+ id=id,
155
+ client=client,
156
+ )
157
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,126 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.get_usage_response_200 import GetUsageResponse200
9
+ from ...types import Response
10
+
11
+
12
+ def _get_kwargs() -> dict[str, Any]:
13
+ _kwargs: dict[str, Any] = {
14
+ "method": "get",
15
+ "url": "/v1/usage",
16
+ }
17
+
18
+ return _kwargs
19
+
20
+
21
+ def _parse_response(
22
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
23
+ ) -> Optional[GetUsageResponse200]:
24
+ if response.status_code == 200:
25
+ response_200 = GetUsageResponse200.from_dict(response.json())
26
+
27
+ return response_200
28
+ if client.raise_on_unexpected_status:
29
+ raise errors.UnexpectedStatus(response.status_code, response.content)
30
+ else:
31
+ return None
32
+
33
+
34
+ def _build_response(
35
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
36
+ ) -> Response[GetUsageResponse200]:
37
+ return Response(
38
+ status_code=HTTPStatus(response.status_code),
39
+ content=response.content,
40
+ headers=response.headers,
41
+ parsed=_parse_response(client=client, response=response),
42
+ )
43
+
44
+
45
+ def sync_detailed(
46
+ *,
47
+ client: Union[AuthenticatedClient, Client],
48
+ ) -> Response[GetUsageResponse200]:
49
+ """Get current billing period usage
50
+
51
+ Raises:
52
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
53
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
54
+
55
+ Returns:
56
+ Response[GetUsageResponse200]
57
+ """
58
+
59
+ kwargs = _get_kwargs()
60
+
61
+ response = client.get_httpx_client().request(
62
+ **kwargs,
63
+ )
64
+
65
+ return _build_response(client=client, response=response)
66
+
67
+
68
+ def sync(
69
+ *,
70
+ client: Union[AuthenticatedClient, Client],
71
+ ) -> Optional[GetUsageResponse200]:
72
+ """Get current billing period usage
73
+
74
+ Raises:
75
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
76
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
77
+
78
+ Returns:
79
+ GetUsageResponse200
80
+ """
81
+
82
+ return sync_detailed(
83
+ client=client,
84
+ ).parsed
85
+
86
+
87
+ async def asyncio_detailed(
88
+ *,
89
+ client: Union[AuthenticatedClient, Client],
90
+ ) -> Response[GetUsageResponse200]:
91
+ """Get current billing period usage
92
+
93
+ Raises:
94
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
95
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
96
+
97
+ Returns:
98
+ Response[GetUsageResponse200]
99
+ """
100
+
101
+ kwargs = _get_kwargs()
102
+
103
+ response = await client.get_async_httpx_client().request(**kwargs)
104
+
105
+ return _build_response(client=client, response=response)
106
+
107
+
108
+ async def asyncio(
109
+ *,
110
+ client: Union[AuthenticatedClient, Client],
111
+ ) -> Optional[GetUsageResponse200]:
112
+ """Get current billing period usage
113
+
114
+ Raises:
115
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
117
+
118
+ Returns:
119
+ GetUsageResponse200
120
+ """
121
+
122
+ return (
123
+ await asyncio_detailed(
124
+ client=client,
125
+ )
126
+ ).parsed
@@ -0,0 +1,215 @@
1
+ import datetime
2
+ from http import HTTPStatus
3
+ from typing import Any, Optional, Union
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.get_usage_by_endpoint_response_200 import GetUsageByEndpointResponse200
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ from_: Union[Unset, datetime.date] = UNSET,
16
+ to: Union[Unset, datetime.date] = UNSET,
17
+ api_key: Union[Unset, str] = UNSET,
18
+ ) -> dict[str, Any]:
19
+ params: dict[str, Any] = {}
20
+
21
+ json_from_: Union[Unset, str] = UNSET
22
+ if not isinstance(from_, Unset):
23
+ json_from_ = from_.isoformat()
24
+ params["from"] = json_from_
25
+
26
+ json_to: Union[Unset, str] = UNSET
27
+ if not isinstance(to, Unset):
28
+ json_to = to.isoformat()
29
+ params["to"] = json_to
30
+
31
+ params["api_key"] = api_key
32
+
33
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
34
+
35
+ _kwargs: dict[str, Any] = {
36
+ "method": "get",
37
+ "url": "/v1/usage/by-endpoint",
38
+ "params": params,
39
+ }
40
+
41
+ return _kwargs
42
+
43
+
44
+ def _parse_response(
45
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
46
+ ) -> Optional[GetUsageByEndpointResponse200]:
47
+ if response.status_code == 200:
48
+ response_200 = GetUsageByEndpointResponse200.from_dict(response.json())
49
+
50
+ return response_200
51
+ if client.raise_on_unexpected_status:
52
+ raise errors.UnexpectedStatus(response.status_code, response.content)
53
+ else:
54
+ return None
55
+
56
+
57
+ def _build_response(
58
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
59
+ ) -> Response[GetUsageByEndpointResponse200]:
60
+ return Response(
61
+ status_code=HTTPStatus(response.status_code),
62
+ content=response.content,
63
+ headers=response.headers,
64
+ parsed=_parse_response(client=client, response=response),
65
+ )
66
+
67
+
68
+ def sync_detailed(
69
+ *,
70
+ client: Union[AuthenticatedClient, Client],
71
+ from_: Union[Unset, datetime.date] = UNSET,
72
+ to: Union[Unset, datetime.date] = UNSET,
73
+ api_key: Union[Unset, str] = UNSET,
74
+ ) -> Response[GetUsageByEndpointResponse200]:
75
+ """Get per-endpoint bandwidth breakdown
76
+
77
+ Returns bandwidth usage broken down by endpoint (screenshots, recordings, scrape, scrape_md, fetch,
78
+ fetch_md, crawl, crawl_links, sitemap, monitors) for a date range. Each row carries raw bytes, the
79
+ billing multiplier, and billable bytes. Endpoints with zero raw bytes for the range are omitted from
80
+ `rows`; `totals` is always present. Default range is the last 30 days; max 366 days.
81
+
82
+ Args:
83
+ from_ (Union[Unset, datetime.date]):
84
+ to (Union[Unset, datetime.date]):
85
+ api_key (Union[Unset, str]):
86
+
87
+ Raises:
88
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
89
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
90
+
91
+ Returns:
92
+ Response[GetUsageByEndpointResponse200]
93
+ """
94
+
95
+ kwargs = _get_kwargs(
96
+ from_=from_,
97
+ to=to,
98
+ api_key=api_key,
99
+ )
100
+
101
+ response = client.get_httpx_client().request(
102
+ **kwargs,
103
+ )
104
+
105
+ return _build_response(client=client, response=response)
106
+
107
+
108
+ def sync(
109
+ *,
110
+ client: Union[AuthenticatedClient, Client],
111
+ from_: Union[Unset, datetime.date] = UNSET,
112
+ to: Union[Unset, datetime.date] = UNSET,
113
+ api_key: Union[Unset, str] = UNSET,
114
+ ) -> Optional[GetUsageByEndpointResponse200]:
115
+ """Get per-endpoint bandwidth breakdown
116
+
117
+ Returns bandwidth usage broken down by endpoint (screenshots, recordings, scrape, scrape_md, fetch,
118
+ fetch_md, crawl, crawl_links, sitemap, monitors) for a date range. Each row carries raw bytes, the
119
+ billing multiplier, and billable bytes. Endpoints with zero raw bytes for the range are omitted from
120
+ `rows`; `totals` is always present. Default range is the last 30 days; max 366 days.
121
+
122
+ Args:
123
+ from_ (Union[Unset, datetime.date]):
124
+ to (Union[Unset, datetime.date]):
125
+ api_key (Union[Unset, str]):
126
+
127
+ Raises:
128
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
129
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
130
+
131
+ Returns:
132
+ GetUsageByEndpointResponse200
133
+ """
134
+
135
+ return sync_detailed(
136
+ client=client,
137
+ from_=from_,
138
+ to=to,
139
+ api_key=api_key,
140
+ ).parsed
141
+
142
+
143
+ async def asyncio_detailed(
144
+ *,
145
+ client: Union[AuthenticatedClient, Client],
146
+ from_: Union[Unset, datetime.date] = UNSET,
147
+ to: Union[Unset, datetime.date] = UNSET,
148
+ api_key: Union[Unset, str] = UNSET,
149
+ ) -> Response[GetUsageByEndpointResponse200]:
150
+ """Get per-endpoint bandwidth breakdown
151
+
152
+ Returns bandwidth usage broken down by endpoint (screenshots, recordings, scrape, scrape_md, fetch,
153
+ fetch_md, crawl, crawl_links, sitemap, monitors) for a date range. Each row carries raw bytes, the
154
+ billing multiplier, and billable bytes. Endpoints with zero raw bytes for the range are omitted from
155
+ `rows`; `totals` is always present. Default range is the last 30 days; max 366 days.
156
+
157
+ Args:
158
+ from_ (Union[Unset, datetime.date]):
159
+ to (Union[Unset, datetime.date]):
160
+ api_key (Union[Unset, str]):
161
+
162
+ Raises:
163
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
164
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
165
+
166
+ Returns:
167
+ Response[GetUsageByEndpointResponse200]
168
+ """
169
+
170
+ kwargs = _get_kwargs(
171
+ from_=from_,
172
+ to=to,
173
+ api_key=api_key,
174
+ )
175
+
176
+ response = await client.get_async_httpx_client().request(**kwargs)
177
+
178
+ return _build_response(client=client, response=response)
179
+
180
+
181
+ async def asyncio(
182
+ *,
183
+ client: Union[AuthenticatedClient, Client],
184
+ from_: Union[Unset, datetime.date] = UNSET,
185
+ to: Union[Unset, datetime.date] = UNSET,
186
+ api_key: Union[Unset, str] = UNSET,
187
+ ) -> Optional[GetUsageByEndpointResponse200]:
188
+ """Get per-endpoint bandwidth breakdown
189
+
190
+ Returns bandwidth usage broken down by endpoint (screenshots, recordings, scrape, scrape_md, fetch,
191
+ fetch_md, crawl, crawl_links, sitemap, monitors) for a date range. Each row carries raw bytes, the
192
+ billing multiplier, and billable bytes. Endpoints with zero raw bytes for the range are omitted from
193
+ `rows`; `totals` is always present. Default range is the last 30 days; max 366 days.
194
+
195
+ Args:
196
+ from_ (Union[Unset, datetime.date]):
197
+ to (Union[Unset, datetime.date]):
198
+ api_key (Union[Unset, str]):
199
+
200
+ Raises:
201
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
202
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
203
+
204
+ Returns:
205
+ GetUsageByEndpointResponse200
206
+ """
207
+
208
+ return (
209
+ await asyncio_detailed(
210
+ client=client,
211
+ from_=from_,
212
+ to=to,
213
+ api_key=api_key,
214
+ )
215
+ ).parsed
@@ -0,0 +1,203 @@
1
+ import datetime
2
+ from http import HTTPStatus
3
+ from typing import Any, Optional, Union
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.get_usage_daily_response_200 import GetUsageDailyResponse200
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ from_: Union[Unset, datetime.date] = UNSET,
16
+ to: Union[Unset, datetime.date] = UNSET,
17
+ api_key: Union[Unset, str] = UNSET,
18
+ ) -> dict[str, Any]:
19
+ params: dict[str, Any] = {}
20
+
21
+ json_from_: Union[Unset, str] = UNSET
22
+ if not isinstance(from_, Unset):
23
+ json_from_ = from_.isoformat()
24
+ params["from"] = json_from_
25
+
26
+ json_to: Union[Unset, str] = UNSET
27
+ if not isinstance(to, Unset):
28
+ json_to = to.isoformat()
29
+ params["to"] = json_to
30
+
31
+ params["api_key"] = api_key
32
+
33
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
34
+
35
+ _kwargs: dict[str, Any] = {
36
+ "method": "get",
37
+ "url": "/v1/usage/daily",
38
+ "params": params,
39
+ }
40
+
41
+ return _kwargs
42
+
43
+
44
+ def _parse_response(
45
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
46
+ ) -> Optional[GetUsageDailyResponse200]:
47
+ if response.status_code == 200:
48
+ response_200 = GetUsageDailyResponse200.from_dict(response.json())
49
+
50
+ return response_200
51
+ if client.raise_on_unexpected_status:
52
+ raise errors.UnexpectedStatus(response.status_code, response.content)
53
+ else:
54
+ return None
55
+
56
+
57
+ def _build_response(
58
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
59
+ ) -> Response[GetUsageDailyResponse200]:
60
+ return Response(
61
+ status_code=HTTPStatus(response.status_code),
62
+ content=response.content,
63
+ headers=response.headers,
64
+ parsed=_parse_response(client=client, response=response),
65
+ )
66
+
67
+
68
+ def sync_detailed(
69
+ *,
70
+ client: Union[AuthenticatedClient, Client],
71
+ from_: Union[Unset, datetime.date] = UNSET,
72
+ to: Union[Unset, datetime.date] = UNSET,
73
+ api_key: Union[Unset, str] = UNSET,
74
+ ) -> Response[GetUsageDailyResponse200]:
75
+ """Get daily usage breakdown
76
+
77
+ Default range is last 30 days. Max range is 366 days.
78
+
79
+ Args:
80
+ from_ (Union[Unset, datetime.date]):
81
+ to (Union[Unset, datetime.date]):
82
+ api_key (Union[Unset, str]):
83
+
84
+ Raises:
85
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
86
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
87
+
88
+ Returns:
89
+ Response[GetUsageDailyResponse200]
90
+ """
91
+
92
+ kwargs = _get_kwargs(
93
+ from_=from_,
94
+ to=to,
95
+ api_key=api_key,
96
+ )
97
+
98
+ response = client.get_httpx_client().request(
99
+ **kwargs,
100
+ )
101
+
102
+ return _build_response(client=client, response=response)
103
+
104
+
105
+ def sync(
106
+ *,
107
+ client: Union[AuthenticatedClient, Client],
108
+ from_: Union[Unset, datetime.date] = UNSET,
109
+ to: Union[Unset, datetime.date] = UNSET,
110
+ api_key: Union[Unset, str] = UNSET,
111
+ ) -> Optional[GetUsageDailyResponse200]:
112
+ """Get daily usage breakdown
113
+
114
+ Default range is last 30 days. Max range is 366 days.
115
+
116
+ Args:
117
+ from_ (Union[Unset, datetime.date]):
118
+ to (Union[Unset, datetime.date]):
119
+ api_key (Union[Unset, str]):
120
+
121
+ Raises:
122
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
123
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
124
+
125
+ Returns:
126
+ GetUsageDailyResponse200
127
+ """
128
+
129
+ return sync_detailed(
130
+ client=client,
131
+ from_=from_,
132
+ to=to,
133
+ api_key=api_key,
134
+ ).parsed
135
+
136
+
137
+ async def asyncio_detailed(
138
+ *,
139
+ client: Union[AuthenticatedClient, Client],
140
+ from_: Union[Unset, datetime.date] = UNSET,
141
+ to: Union[Unset, datetime.date] = UNSET,
142
+ api_key: Union[Unset, str] = UNSET,
143
+ ) -> Response[GetUsageDailyResponse200]:
144
+ """Get daily usage breakdown
145
+
146
+ Default range is last 30 days. Max range is 366 days.
147
+
148
+ Args:
149
+ from_ (Union[Unset, datetime.date]):
150
+ to (Union[Unset, datetime.date]):
151
+ api_key (Union[Unset, str]):
152
+
153
+ Raises:
154
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
155
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
156
+
157
+ Returns:
158
+ Response[GetUsageDailyResponse200]
159
+ """
160
+
161
+ kwargs = _get_kwargs(
162
+ from_=from_,
163
+ to=to,
164
+ api_key=api_key,
165
+ )
166
+
167
+ response = await client.get_async_httpx_client().request(**kwargs)
168
+
169
+ return _build_response(client=client, response=response)
170
+
171
+
172
+ async def asyncio(
173
+ *,
174
+ client: Union[AuthenticatedClient, Client],
175
+ from_: Union[Unset, datetime.date] = UNSET,
176
+ to: Union[Unset, datetime.date] = UNSET,
177
+ api_key: Union[Unset, str] = UNSET,
178
+ ) -> Optional[GetUsageDailyResponse200]:
179
+ """Get daily usage breakdown
180
+
181
+ Default range is last 30 days. Max range is 366 days.
182
+
183
+ Args:
184
+ from_ (Union[Unset, datetime.date]):
185
+ to (Union[Unset, datetime.date]):
186
+ api_key (Union[Unset, str]):
187
+
188
+ Raises:
189
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
190
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
191
+
192
+ Returns:
193
+ GetUsageDailyResponse200
194
+ """
195
+
196
+ return (
197
+ await asyncio_detailed(
198
+ client=client,
199
+ from_=from_,
200
+ to=to,
201
+ api_key=api_key,
202
+ )
203
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""