|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | 5 | import os |
6 | | -from typing import Any, List, Union, Mapping |
| 6 | +from typing import Any, List, Mapping |
7 | 7 | from typing_extensions import Self, Literal, override |
8 | 8 |
|
9 | 9 | import httpx |
|
12 | 12 | from ._qs import Querystring |
13 | 13 | from .types import client_pdf_params, client_scrape_params, client_screenshot_params |
14 | 14 | from ._types import ( |
15 | | - NOT_GIVEN, |
16 | 15 | Body, |
17 | 16 | Omit, |
18 | 17 | Query, |
|
22 | 21 | Transport, |
23 | 22 | ProxiesTypes, |
24 | 23 | RequestOptions, |
| 24 | + omit, |
| 25 | + not_given, |
25 | 26 | ) |
26 | 27 | from ._utils import ( |
27 | 28 | is_given, |
@@ -69,7 +70,7 @@ def __init__( |
69 | 70 | *, |
70 | 71 | steel_api_key: str | None = None, |
71 | 72 | base_url: str | httpx.URL | None = None, |
72 | | - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, |
| 73 | + timeout: float | Timeout | None | NotGiven = not_given, |
73 | 74 | max_retries: int = DEFAULT_MAX_RETRIES, |
74 | 75 | default_headers: Mapping[str, str] | None = None, |
75 | 76 | default_query: Mapping[str, object] | None = None, |
@@ -145,9 +146,9 @@ def copy( |
145 | 146 | *, |
146 | 147 | steel_api_key: str | None = None, |
147 | 148 | base_url: str | httpx.URL | None = None, |
148 | | - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, |
| 149 | + timeout: float | Timeout | None | NotGiven = not_given, |
149 | 150 | http_client: httpx.Client | None = None, |
150 | | - max_retries: int | NotGiven = NOT_GIVEN, |
| 151 | + max_retries: int | NotGiven = not_given, |
151 | 152 | default_headers: Mapping[str, str] | None = None, |
152 | 153 | set_default_headers: Mapping[str, str] | None = None, |
153 | 154 | default_query: Mapping[str, object] | None = None, |
@@ -195,15 +196,15 @@ def pdf( |
195 | 196 | self, |
196 | 197 | *, |
197 | 198 | url: str, |
198 | | - delay: float | NotGiven = NOT_GIVEN, |
199 | | - region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | NotGiven = NOT_GIVEN, |
200 | | - use_proxy: bool | NotGiven = NOT_GIVEN, |
| 199 | + delay: float | Omit = omit, |
| 200 | + region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | Omit = omit, |
| 201 | + use_proxy: bool | Omit = omit, |
201 | 202 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
202 | 203 | # The extra values given here take precedence over values defined on the client or passed to this method. |
203 | 204 | extra_headers: Headers | None = None, |
204 | 205 | extra_query: Query | None = None, |
205 | 206 | extra_body: Body | None = None, |
206 | | - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 207 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
207 | 208 | ) -> PdfResponse: |
208 | 209 | """ |
209 | 210 | Generates a PDF from a specified webpage. |
@@ -246,18 +247,18 @@ def scrape( |
246 | 247 | self, |
247 | 248 | *, |
248 | 249 | url: str, |
249 | | - delay: float | NotGiven = NOT_GIVEN, |
250 | | - format: List[Literal["html", "readability", "cleaned_html", "markdown"]] | NotGiven = NOT_GIVEN, |
251 | | - pdf: bool | NotGiven = NOT_GIVEN, |
252 | | - region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | NotGiven = NOT_GIVEN, |
253 | | - screenshot: bool | NotGiven = NOT_GIVEN, |
254 | | - use_proxy: bool | NotGiven = NOT_GIVEN, |
| 250 | + delay: float | Omit = omit, |
| 251 | + format: List[Literal["html", "readability", "cleaned_html", "markdown"]] | Omit = omit, |
| 252 | + pdf: bool | Omit = omit, |
| 253 | + region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | Omit = omit, |
| 254 | + screenshot: bool | Omit = omit, |
| 255 | + use_proxy: bool | Omit = omit, |
255 | 256 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
256 | 257 | # The extra values given here take precedence over values defined on the client or passed to this method. |
257 | 258 | extra_headers: Headers | None = None, |
258 | 259 | extra_query: Query | None = None, |
259 | 260 | extra_body: Body | None = None, |
260 | | - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 261 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
261 | 262 | ) -> ScrapeResponse: |
262 | 263 | """ |
263 | 264 | Extracts content from a specified URL. |
@@ -309,16 +310,16 @@ def screenshot( |
309 | 310 | self, |
310 | 311 | *, |
311 | 312 | url: str, |
312 | | - delay: float | NotGiven = NOT_GIVEN, |
313 | | - full_page: bool | NotGiven = NOT_GIVEN, |
314 | | - region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | NotGiven = NOT_GIVEN, |
315 | | - use_proxy: bool | NotGiven = NOT_GIVEN, |
| 313 | + delay: float | Omit = omit, |
| 314 | + full_page: bool | Omit = omit, |
| 315 | + region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | Omit = omit, |
| 316 | + use_proxy: bool | Omit = omit, |
316 | 317 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
317 | 318 | # The extra values given here take precedence over values defined on the client or passed to this method. |
318 | 319 | extra_headers: Headers | None = None, |
319 | 320 | extra_query: Query | None = None, |
320 | 321 | extra_body: Body | None = None, |
321 | | - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 322 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
322 | 323 | ) -> ScreenshotResponse: |
323 | 324 | """ |
324 | 325 | Captures a screenshot of a specified webpage. |
@@ -410,7 +411,7 @@ def __init__( |
410 | 411 | *, |
411 | 412 | steel_api_key: str | None = None, |
412 | 413 | base_url: str | httpx.URL | None = None, |
413 | | - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, |
| 414 | + timeout: float | Timeout | None | NotGiven = not_given, |
414 | 415 | max_retries: int = DEFAULT_MAX_RETRIES, |
415 | 416 | default_headers: Mapping[str, str] | None = None, |
416 | 417 | default_query: Mapping[str, object] | None = None, |
@@ -486,9 +487,9 @@ def copy( |
486 | 487 | *, |
487 | 488 | steel_api_key: str | None = None, |
488 | 489 | base_url: str | httpx.URL | None = None, |
489 | | - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, |
| 490 | + timeout: float | Timeout | None | NotGiven = not_given, |
490 | 491 | http_client: httpx.AsyncClient | None = None, |
491 | | - max_retries: int | NotGiven = NOT_GIVEN, |
| 492 | + max_retries: int | NotGiven = not_given, |
492 | 493 | default_headers: Mapping[str, str] | None = None, |
493 | 494 | set_default_headers: Mapping[str, str] | None = None, |
494 | 495 | default_query: Mapping[str, object] | None = None, |
@@ -536,15 +537,15 @@ async def pdf( |
536 | 537 | self, |
537 | 538 | *, |
538 | 539 | url: str, |
539 | | - delay: float | NotGiven = NOT_GIVEN, |
540 | | - region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | NotGiven = NOT_GIVEN, |
541 | | - use_proxy: bool | NotGiven = NOT_GIVEN, |
| 540 | + delay: float | Omit = omit, |
| 541 | + region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | Omit = omit, |
| 542 | + use_proxy: bool | Omit = omit, |
542 | 543 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
543 | 544 | # The extra values given here take precedence over values defined on the client or passed to this method. |
544 | 545 | extra_headers: Headers | None = None, |
545 | 546 | extra_query: Query | None = None, |
546 | 547 | extra_body: Body | None = None, |
547 | | - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 548 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
548 | 549 | ) -> PdfResponse: |
549 | 550 | """ |
550 | 551 | Generates a PDF from a specified webpage. |
@@ -587,18 +588,18 @@ async def scrape( |
587 | 588 | self, |
588 | 589 | *, |
589 | 590 | url: str, |
590 | | - delay: float | NotGiven = NOT_GIVEN, |
591 | | - format: List[Literal["html", "readability", "cleaned_html", "markdown"]] | NotGiven = NOT_GIVEN, |
592 | | - pdf: bool | NotGiven = NOT_GIVEN, |
593 | | - region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | NotGiven = NOT_GIVEN, |
594 | | - screenshot: bool | NotGiven = NOT_GIVEN, |
595 | | - use_proxy: bool | NotGiven = NOT_GIVEN, |
| 591 | + delay: float | Omit = omit, |
| 592 | + format: List[Literal["html", "readability", "cleaned_html", "markdown"]] | Omit = omit, |
| 593 | + pdf: bool | Omit = omit, |
| 594 | + region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | Omit = omit, |
| 595 | + screenshot: bool | Omit = omit, |
| 596 | + use_proxy: bool | Omit = omit, |
596 | 597 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
597 | 598 | # The extra values given here take precedence over values defined on the client or passed to this method. |
598 | 599 | extra_headers: Headers | None = None, |
599 | 600 | extra_query: Query | None = None, |
600 | 601 | extra_body: Body | None = None, |
601 | | - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 602 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
602 | 603 | ) -> ScrapeResponse: |
603 | 604 | """ |
604 | 605 | Extracts content from a specified URL. |
@@ -650,16 +651,16 @@ async def screenshot( |
650 | 651 | self, |
651 | 652 | *, |
652 | 653 | url: str, |
653 | | - delay: float | NotGiven = NOT_GIVEN, |
654 | | - full_page: bool | NotGiven = NOT_GIVEN, |
655 | | - region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | NotGiven = NOT_GIVEN, |
656 | | - use_proxy: bool | NotGiven = NOT_GIVEN, |
| 654 | + delay: float | Omit = omit, |
| 655 | + full_page: bool | Omit = omit, |
| 656 | + region: Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"] | Omit = omit, |
| 657 | + use_proxy: bool | Omit = omit, |
657 | 658 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
658 | 659 | # The extra values given here take precedence over values defined on the client or passed to this method. |
659 | 660 | extra_headers: Headers | None = None, |
660 | 661 | extra_query: Query | None = None, |
661 | 662 | extra_body: Body | None = None, |
662 | | - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 663 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
663 | 664 | ) -> ScreenshotResponse: |
664 | 665 | """ |
665 | 666 | Captures a screenshot of a specified webpage. |
|
0 commit comments