Skip to content

Commit 3ad44b4

Browse files
committed
SDK regeneration
1 parent cd62938 commit 3ad44b4

28 files changed

Lines changed: 601 additions & 370 deletions

poetry.lock

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

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
[project]
2+
name = "scrapybara"
3+
14
[tool.poetry]
25
name = "scrapybara"
3-
version = "2.2.9"
6+
version = "2.3.0"
47
description = ""
58
readme = "README.md"
69
authors = []
@@ -32,9 +35,7 @@ Repository = 'https://github.com/scrapybara/scrapybara-python'
3235

3336
[tool.poetry.dependencies]
3437
python = "^3.8"
35-
anthropic = "^0.47.2"
3638
httpx = ">=0.21.2"
37-
playwright = "^1.48.0"
3839
pydantic = ">= 1.9.2"
3940
pydantic-core = "^2.18.2"
4041
typing_extensions = ">= 4.0.0"

reference.md

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,16 @@ client.instance.get_stream_url(
336336

337337
```python
338338
from scrapybara import Scrapybara
339+
from scrapybara.instance import Request_MoveMouse
339340

340341
client = Scrapybara(
341342
api_key="YOUR_API_KEY",
342343
)
343344
client.instance.computer(
344345
instance_id="instance_id",
345-
action="key",
346+
request=Request_MoveMouse(
347+
coordinates=[1],
348+
),
346349
)
347350

348351
```
@@ -367,23 +370,7 @@ client.instance.computer(
367370
<dl>
368371
<dd>
369372

370-
**action:** `Action`
371-
372-
</dd>
373-
</dl>
374-
375-
<dl>
376-
<dd>
377-
378-
**coordinate:** `typing.Optional[typing.Sequence[int]]`
379-
380-
</dd>
381-
</dl>
382-
383-
<dl>
384-
<dd>
385-
386-
**text:** `typing.Optional[str]`
373+
**request:** `Request`
387374

388375
</dd>
389376
</dl>

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
httpx>=0.21.2
2+
pydantic>= 1.9.2
3+
pydantic-core==^2.18.2
4+
typing_extensions>= 4.0.0

src/scrapybara/__init__.py

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,121 @@
22

33
from .types import (
44
AuthStateResponse,
5+
BashResponse,
56
BrowserAuthenticateResponse,
67
BrowserGetCdpUrlResponse,
8+
Button,
79
CellType,
10+
ClickMouseAction,
11+
ClickMouseActionClickType,
12+
ComputerResponse,
813
DeploymentConfigInstanceType,
14+
DragMouseAction,
15+
EditResponse,
916
EnvGetResponse,
1017
EnvResponse,
1118
ExecuteCellRequest,
1219
FileDownloadResponse,
1320
FileReadResponse,
21+
GetCursorPositionAction,
1422
GetInstanceResponse,
1523
GetInstanceResponseInstanceType,
1624
HttpValidationError,
1725
InstanceGetStreamUrlResponse,
1826
InstanceScreenshotResponse,
1927
KernelInfo,
2028
ModifyBrowserAuthResponse,
29+
MoveMouseAction,
2130
Notebook,
2231
NotebookCell,
32+
PressKeyAction,
2333
SaveBrowserAuthResponse,
34+
ScrollAction,
2435
StartBrowserResponse,
2536
Status,
2637
StopBrowserResponse,
2738
StopInstanceResponse,
39+
TakeScreenshotAction,
40+
TypeTextAction,
2841
ValidationError,
2942
ValidationErrorLocItem,
43+
WaitAction,
3044
)
3145
from .errors import UnprocessableEntityError
3246
from . import browser, code, env, file, instance, notebook
3347
from .client import AsyncScrapybara, Scrapybara
3448
from .environment import ScrapybaraEnvironment
35-
from .instance import Action, Command
49+
from .instance import (
50+
Command,
51+
Request,
52+
Request_ClickMouse,
53+
Request_DragMouse,
54+
Request_GetCursorPosition,
55+
Request_MoveMouse,
56+
Request_PressKey,
57+
Request_Scroll,
58+
Request_TakeScreenshot,
59+
Request_TypeText,
60+
Request_Wait,
61+
)
3662
from .version import __version__
3763

3864
__all__ = [
39-
"Action",
4065
"AsyncScrapybara",
4166
"AuthStateResponse",
67+
"BashResponse",
4268
"BrowserAuthenticateResponse",
4369
"BrowserGetCdpUrlResponse",
70+
"Button",
4471
"CellType",
72+
"ClickMouseAction",
73+
"ClickMouseActionClickType",
4574
"Command",
75+
"ComputerResponse",
4676
"DeploymentConfigInstanceType",
77+
"DragMouseAction",
78+
"EditResponse",
4779
"EnvGetResponse",
4880
"EnvResponse",
4981
"ExecuteCellRequest",
5082
"FileDownloadResponse",
5183
"FileReadResponse",
84+
"GetCursorPositionAction",
5285
"GetInstanceResponse",
5386
"GetInstanceResponseInstanceType",
5487
"HttpValidationError",
5588
"InstanceGetStreamUrlResponse",
5689
"InstanceScreenshotResponse",
5790
"KernelInfo",
5891
"ModifyBrowserAuthResponse",
92+
"MoveMouseAction",
5993
"Notebook",
6094
"NotebookCell",
95+
"PressKeyAction",
96+
"Request",
97+
"Request_ClickMouse",
98+
"Request_DragMouse",
99+
"Request_GetCursorPosition",
100+
"Request_MoveMouse",
101+
"Request_PressKey",
102+
"Request_Scroll",
103+
"Request_TakeScreenshot",
104+
"Request_TypeText",
105+
"Request_Wait",
61106
"SaveBrowserAuthResponse",
62107
"Scrapybara",
63108
"ScrapybaraEnvironment",
109+
"ScrollAction",
64110
"StartBrowserResponse",
65111
"Status",
66112
"StopBrowserResponse",
67113
"StopInstanceResponse",
114+
"TakeScreenshotAction",
115+
"TypeTextAction",
68116
"UnprocessableEntityError",
69117
"ValidationError",
70118
"ValidationErrorLocItem",
119+
"WaitAction",
71120
"__version__",
72121
"browser",
73122
"code",

src/scrapybara/core/client_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def get_headers(self) -> typing.Dict[str, str]:
1616
headers: typing.Dict[str, str] = {
1717
"X-Fern-Language": "Python",
1818
"X-Fern-SDK-Name": "scrapybara",
19-
"X-Fern-SDK-Version": "2.2.9",
19+
"X-Fern-SDK-Version": "2.3.0",
2020
}
2121
headers["x-api-key"] = self.api_key
2222
return headers

src/scrapybara/core/http_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def _retry_timeout(response: httpx.Response, retries: int) -> float:
8585

8686

8787
def _should_retry(response: httpx.Response) -> bool:
88-
retriable_400s = [429, 408, 409]
89-
return response.status_code >= 500 or response.status_code in retriable_400s
88+
retryable_400s = [429, 408, 409]
89+
return response.status_code >= 500 or response.status_code in retryable_400s
9090

9191

9292
def remove_omit_from_dict(
@@ -183,7 +183,7 @@ def request(
183183
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
184184
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
185185
request_options: typing.Optional[RequestOptions] = None,
186-
retries: int = 0,
186+
retries: int = 2,
187187
omit: typing.Optional[typing.Any] = None,
188188
) -> httpx.Response:
189189
base_url = self.get_base_url(base_url)
@@ -269,7 +269,7 @@ def stream(
269269
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
270270
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
271271
request_options: typing.Optional[RequestOptions] = None,
272-
retries: int = 0,
272+
retries: int = 2,
273273
omit: typing.Optional[typing.Any] = None,
274274
) -> typing.Iterator[httpx.Response]:
275275
base_url = self.get_base_url(base_url)
@@ -359,7 +359,7 @@ async def request(
359359
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
360360
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
361361
request_options: typing.Optional[RequestOptions] = None,
362-
retries: int = 0,
362+
retries: int = 2,
363363
omit: typing.Optional[typing.Any] = None,
364364
) -> httpx.Response:
365365
base_url = self.get_base_url(base_url)
@@ -445,7 +445,7 @@ async def stream(
445445
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
446446
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
447447
request_options: typing.Optional[RequestOptions] = None,
448-
retries: int = 0,
448+
retries: int = 2,
449449
omit: typing.Optional[typing.Any] = None,
450450
) -> typing.AsyncIterator[httpx.Response]:
451451
base_url = self.get_base_url(base_url)

src/scrapybara/core/pydantic_utilities.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def to_jsonable_with_fallback(
7979
class UniversalBaseModel(pydantic.BaseModel):
8080
if IS_PYDANTIC_V2:
8181
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
82-
# Allow fields begining with `model_` to be used in the model
82+
# Allow fields beginning with `model_` to be used in the model
8383
protected_namespaces=(),
8484
) # type: ignore # Pydantic v2
8585

@@ -128,7 +128,7 @@ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
128128
Override the default dict method to `exclude_unset` by default. This function patches
129129
`exclude_unset` to work include fields within non-None default values.
130130
"""
131-
# Note: the logic here is multi-plexed given the levers exposed in Pydantic V1 vs V2
131+
# Note: the logic here is multiplexed given the levers exposed in Pydantic V1 vs V2
132132
# Pydantic V1's .dict can be extremely slow, so we do not want to call it twice.
133133
#
134134
# We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models
Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# This file was auto-generated by Fern from our API Definition.
22

3-
from .types import Action, Command
3+
from .types import (
4+
Command,
5+
Request,
6+
Request_ClickMouse,
7+
Request_DragMouse,
8+
Request_GetCursorPosition,
9+
Request_MoveMouse,
10+
Request_PressKey,
11+
Request_Scroll,
12+
Request_TakeScreenshot,
13+
Request_TypeText,
14+
Request_Wait,
15+
)
416

5-
__all__ = ["Action", "Command"]
17+
__all__ = [
18+
"Command",
19+
"Request",
20+
"Request_ClickMouse",
21+
"Request_DragMouse",
22+
"Request_GetCursorPosition",
23+
"Request_MoveMouse",
24+
"Request_PressKey",
25+
"Request_Scroll",
26+
"Request_TakeScreenshot",
27+
"Request_TypeText",
28+
"Request_Wait",
29+
]

0 commit comments

Comments
 (0)