Skip to content

Commit 255dba1

Browse files
committed
SDK regeneration
1 parent 5fd0a7a commit 255dba1

File tree

9 files changed

+254
-40
lines changed

9 files changed

+254
-40
lines changed

poetry.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "scrapybara"
3-
version = "2.2.7"
3+
version = "2.2.8"
44
description = ""
55
readme = "README.md"
66
authors = []

reference.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,79 @@ client.browser.save_auth(
938938
</dl>
939939

940940

941+
</dd>
942+
</dl>
943+
</details>
944+
945+
<details><summary><code>client.browser.<a href="src/scrapybara/browser/client.py">modify_auth</a>(...)</code></summary>
946+
<dl>
947+
<dd>
948+
949+
#### 🔌 Usage
950+
951+
<dl>
952+
<dd>
953+
954+
<dl>
955+
<dd>
956+
957+
```python
958+
from scrapybara import Scrapybara
959+
960+
client = Scrapybara(
961+
api_key="YOUR_API_KEY",
962+
)
963+
client.browser.modify_auth(
964+
instance_id="instance_id",
965+
auth_state_id="auth_state_id",
966+
)
967+
968+
```
969+
</dd>
970+
</dl>
971+
</dd>
972+
</dl>
973+
974+
#### ⚙️ Parameters
975+
976+
<dl>
977+
<dd>
978+
979+
<dl>
980+
<dd>
981+
982+
**instance_id:** `str`
983+
984+
</dd>
985+
</dl>
986+
987+
<dl>
988+
<dd>
989+
990+
**auth_state_id:** `str`
991+
992+
</dd>
993+
</dl>
994+
995+
<dl>
996+
<dd>
997+
998+
**name:** `typing.Optional[str]`
999+
1000+
</dd>
1001+
</dl>
1002+
1003+
<dl>
1004+
<dd>
1005+
1006+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
1007+
1008+
</dd>
1009+
</dl>
1010+
</dd>
1011+
</dl>
1012+
1013+
9411014
</dd>
9421015
</dl>
9431016
</details>

src/scrapybara/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
InstanceGetStreamUrlResponse,
1818
InstanceScreenshotResponse,
1919
KernelInfo,
20+
ModifyBrowserAuthResponse,
2021
Notebook,
2122
NotebookCell,
2223
SaveBrowserAuthResponse,
@@ -54,6 +55,7 @@
5455
"InstanceGetStreamUrlResponse",
5556
"InstanceScreenshotResponse",
5657
"KernelInfo",
58+
"ModifyBrowserAuthResponse",
5759
"Notebook",
5860
"NotebookCell",
5961
"SaveBrowserAuthResponse",

src/scrapybara/browser/client.py

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from ..core.api_error import ApiError
1313
from ..types.browser_get_cdp_url_response import BrowserGetCdpUrlResponse
1414
from ..types.save_browser_auth_response import SaveBrowserAuthResponse
15+
from ..types.modify_browser_auth_response import ModifyBrowserAuthResponse
1516
from ..types.browser_authenticate_response import BrowserAuthenticateResponse
1617
from ..types.stop_browser_response import StopBrowserResponse
1718
from ..core.client_wrapper import AsyncClientWrapper
@@ -198,6 +199,76 @@ def save_auth(
198199
raise ApiError(status_code=_response.status_code, body=_response.text)
199200
raise ApiError(status_code=_response.status_code, body=_response_json)
200201

202+
def modify_auth(
203+
self,
204+
instance_id: str,
205+
*,
206+
auth_state_id: str,
207+
name: typing.Optional[str] = None,
208+
request_options: typing.Optional[RequestOptions] = None,
209+
) -> ModifyBrowserAuthResponse:
210+
"""
211+
Parameters
212+
----------
213+
instance_id : str
214+
215+
auth_state_id : str
216+
217+
name : typing.Optional[str]
218+
219+
request_options : typing.Optional[RequestOptions]
220+
Request-specific configuration.
221+
222+
Returns
223+
-------
224+
ModifyBrowserAuthResponse
225+
Successful Response
226+
227+
Examples
228+
--------
229+
from scrapybara import Scrapybara
230+
231+
client = Scrapybara(
232+
api_key="YOUR_API_KEY",
233+
)
234+
client.browser.modify_auth(
235+
instance_id="instance_id",
236+
auth_state_id="auth_state_id",
237+
)
238+
"""
239+
_response = self._client_wrapper.httpx_client.request(
240+
f"v1/instance/{jsonable_encoder(instance_id)}/browser/modify_auth",
241+
method="POST",
242+
params={
243+
"auth_state_id": auth_state_id,
244+
"name": name,
245+
},
246+
request_options=request_options,
247+
)
248+
try:
249+
if 200 <= _response.status_code < 300:
250+
return typing.cast(
251+
ModifyBrowserAuthResponse,
252+
parse_obj_as(
253+
type_=ModifyBrowserAuthResponse, # type: ignore
254+
object_=_response.json(),
255+
),
256+
)
257+
if _response.status_code == 422:
258+
raise UnprocessableEntityError(
259+
typing.cast(
260+
HttpValidationError,
261+
parse_obj_as(
262+
type_=HttpValidationError, # type: ignore
263+
object_=_response.json(),
264+
),
265+
)
266+
)
267+
_response_json = _response.json()
268+
except JSONDecodeError:
269+
raise ApiError(status_code=_response.status_code, body=_response.text)
270+
raise ApiError(status_code=_response.status_code, body=_response_json)
271+
201272
def authenticate(
202273
self, instance_id: str, *, auth_state_id: str, request_options: typing.Optional[RequestOptions] = None
203274
) -> BrowserAuthenticateResponse:
@@ -520,6 +591,84 @@ async def main() -> None:
520591
raise ApiError(status_code=_response.status_code, body=_response.text)
521592
raise ApiError(status_code=_response.status_code, body=_response_json)
522593

594+
async def modify_auth(
595+
self,
596+
instance_id: str,
597+
*,
598+
auth_state_id: str,
599+
name: typing.Optional[str] = None,
600+
request_options: typing.Optional[RequestOptions] = None,
601+
) -> ModifyBrowserAuthResponse:
602+
"""
603+
Parameters
604+
----------
605+
instance_id : str
606+
607+
auth_state_id : str
608+
609+
name : typing.Optional[str]
610+
611+
request_options : typing.Optional[RequestOptions]
612+
Request-specific configuration.
613+
614+
Returns
615+
-------
616+
ModifyBrowserAuthResponse
617+
Successful Response
618+
619+
Examples
620+
--------
621+
import asyncio
622+
623+
from scrapybara import AsyncScrapybara
624+
625+
client = AsyncScrapybara(
626+
api_key="YOUR_API_KEY",
627+
)
628+
629+
630+
async def main() -> None:
631+
await client.browser.modify_auth(
632+
instance_id="instance_id",
633+
auth_state_id="auth_state_id",
634+
)
635+
636+
637+
asyncio.run(main())
638+
"""
639+
_response = await self._client_wrapper.httpx_client.request(
640+
f"v1/instance/{jsonable_encoder(instance_id)}/browser/modify_auth",
641+
method="POST",
642+
params={
643+
"auth_state_id": auth_state_id,
644+
"name": name,
645+
},
646+
request_options=request_options,
647+
)
648+
try:
649+
if 200 <= _response.status_code < 300:
650+
return typing.cast(
651+
ModifyBrowserAuthResponse,
652+
parse_obj_as(
653+
type_=ModifyBrowserAuthResponse, # type: ignore
654+
object_=_response.json(),
655+
),
656+
)
657+
if _response.status_code == 422:
658+
raise UnprocessableEntityError(
659+
typing.cast(
660+
HttpValidationError,
661+
parse_obj_as(
662+
type_=HttpValidationError, # type: ignore
663+
object_=_response.json(),
664+
),
665+
)
666+
)
667+
_response_json = _response.json()
668+
except JSONDecodeError:
669+
raise ApiError(status_code=_response.status_code, body=_response.text)
670+
raise ApiError(status_code=_response.status_code, body=_response_json)
671+
523672
async def authenticate(
524673
self, instance_id: str, *, auth_state_id: str, request_options: typing.Optional[RequestOptions] = None
525674
) -> BrowserAuthenticateResponse:

src/scrapybara/core/client_wrapper.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88

99
class BaseClientWrapper:
10-
def __init__(
11-
self, *, api_key: str, base_url: str, timeout: typing.Optional[float] = None
12-
):
10+
def __init__(self, *, api_key: str, base_url: str, timeout: typing.Optional[float] = None):
1311
self.api_key = api_key
1412
self._base_url = base_url
1513
self._timeout = timeout
@@ -18,7 +16,7 @@ def get_headers(self) -> typing.Dict[str, str]:
1816
headers: typing.Dict[str, str] = {
1917
"X-Fern-Language": "Python",
2018
"X-Fern-SDK-Name": "scrapybara",
21-
"X-Fern-SDK-Version": "2.2.7",
19+
"X-Fern-SDK-Version": "2.2.8",
2220
}
2321
headers["x-api-key"] = self.api_key
2422
return headers
@@ -32,12 +30,7 @@ def get_timeout(self) -> typing.Optional[float]:
3230

3331
class SyncClientWrapper(BaseClientWrapper):
3432
def __init__(
35-
self,
36-
*,
37-
api_key: str,
38-
base_url: str,
39-
timeout: typing.Optional[float] = None,
40-
httpx_client: httpx.Client
33+
self, *, api_key: str, base_url: str, timeout: typing.Optional[float] = None, httpx_client: httpx.Client
4134
):
4235
super().__init__(api_key=api_key, base_url=base_url, timeout=timeout)
4336
self.httpx_client = HttpClient(
@@ -50,12 +43,7 @@ def __init__(
5043

5144
class AsyncClientWrapper(BaseClientWrapper):
5245
def __init__(
53-
self,
54-
*,
55-
api_key: str,
56-
base_url: str,
57-
timeout: typing.Optional[float] = None,
58-
httpx_client: httpx.AsyncClient
46+
self, *, api_key: str, base_url: str, timeout: typing.Optional[float] = None, httpx_client: httpx.AsyncClient
5947
):
6048
super().__init__(api_key=api_key, base_url=base_url, timeout=timeout)
6149
self.httpx_client = AsyncHttpClient(

src/scrapybara/herd/__init__.py

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from ..core.pydantic_utilities import UniversalBaseModel
4+
import typing
5+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
6+
import pydantic
7+
8+
9+
class ModifyBrowserAuthResponse(UniversalBaseModel):
10+
status: str
11+
auth_state_id: str
12+
name: typing.Optional[str] = None
13+
14+
if IS_PYDANTIC_V2:
15+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
16+
else:
17+
18+
class Config:
19+
frozen = True
20+
smart_union = True
21+
extra = pydantic.Extra.allow

src/scrapybara/types/status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
import typing
44

5-
Status = typing.Union[typing.Literal["deploying", "running", "terminated", "error"], typing.Any]
5+
Status = typing.Union[typing.Literal["deploying", "running", "paused", "terminated", "error"], typing.Any]

0 commit comments

Comments
 (0)