Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 29bec8b

Browse files
fern-api[bot]kcoopermiller
andauthoredApr 8, 2025··
🌿 Fern Regeneration -- April 8, 2025 (#50)
* SDK regeneration * update download() * update action runner --------- Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: Cooper Miller <kcoopermiller9@gmail.com>
1 parent 09a1681 commit 29bec8b

File tree

7 files changed

+68
-18
lines changed

7 files changed

+68
-18
lines changed
 

‎.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: ci
33
on: [push]
44
jobs:
55
compile:
6-
runs-on: ubuntu-20.04
6+
runs-on: ubuntu-22.04
77
steps:
88
- name: Checkout repo
99
uses: actions/checkout@v3
@@ -19,7 +19,7 @@ jobs:
1919
- name: Compile
2020
run: poetry run mypy .
2121
test:
22-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-22.04
2323
steps:
2424
- name: Checkout repo
2525
uses: actions/checkout@v3
@@ -41,7 +41,7 @@ jobs:
4141
publish:
4242
needs: [compile, test]
4343
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
44-
runs-on: ubuntu-20.04
44+
runs-on: ubuntu-22.04
4545
steps:
4646
- name: Checkout repo
4747
uses: actions/checkout@v3

‎pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "scrapybara"
33

44
[tool.poetry]
55
name = "scrapybara"
6-
version = "2.4.8"
6+
version = "2.4.9"
77
description = ""
88
readme = "README.md"
99
authors = []

‎reference.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,11 @@ client.instance.file(
821821
<dl>
822822
<dd>
823823

824-
Download a file from the instance.
824+
Download a file from the instance and save it to a local path.
825+
826+
Args:
827+
path: Path of the file on the instance
828+
local_path: Path where to save the file locally
825829
</dd>
826830
</dl>
827831
</dd>
@@ -844,6 +848,7 @@ client = Scrapybara(
844848
client.instance.download(
845849
instance_id="instance_id",
846850
path="path",
851+
local_path="local_path",
847852
)
848853

849854
```
@@ -876,6 +881,14 @@ client.instance.download(
876881
<dl>
877882
<dd>
878883

884+
**local_path:** `str`
885+
886+
</dd>
887+
</dl>
888+
889+
<dl>
890+
<dd>
891+
879892
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
880893

881894
</dd>

‎src/scrapybara/client.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
StopInstanceResponse,
5252
ModifyBrowserAuthResponse,
5353
UploadResponse,
54+
FileResponse,
5455
)
5556

5657
from .types.act import (
@@ -984,11 +985,13 @@ def download(
984985
self,
985986
*,
986987
path: str,
988+
local_path: str,
987989
request_options: Optional[RequestOptions] = None,
988-
) -> None:
990+
) -> FileResponse:
989991
return self._client.instance.download(
990992
self.id,
991993
path=path,
994+
local_path=local_path,
992995
request_options=request_options,
993996
)
994997

@@ -1518,11 +1521,13 @@ async def download(
15181521
self,
15191522
*,
15201523
path: str,
1524+
local_path: str,
15211525
request_options: Optional[RequestOptions] = None,
1522-
) -> None:
1526+
) -> FileResponse:
15231527
return await self._client.instance.download(
15241528
self.id,
15251529
path=path,
1530+
local_path=local_path,
15261531
request_options=request_options,
15271532
)
15281533

‎src/scrapybara/core/client_wrapper.py

+1-1
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.4.8",
19+
"X-Fern-SDK-Version": "2.4.9",
2020
}
2121
headers["x-api-key"] = self.api_key
2222
return headers

‎src/scrapybara/instance/client.py

+41-9
Original file line numberDiff line numberDiff line change
@@ -522,22 +522,31 @@ def file(
522522
raise ApiError(status_code=_response.status_code, body=_response.text)
523523
raise ApiError(status_code=_response.status_code, body=_response_json)
524524

525-
def download(self, instance_id: str, *, path: str, request_options: typing.Optional[RequestOptions] = None) -> None:
525+
def download(
526+
self, instance_id: str, *, path: str, local_path: str, request_options: typing.Optional[RequestOptions] = None
527+
) -> FileResponse:
526528
"""
527-
Download a file from the instance.
529+
Download a file from the instance and save it to a local path.
530+
531+
Args:
532+
path: Path of the file on the instance
533+
local_path: Path where to save the file locally
528534
529535
Parameters
530536
----------
531537
instance_id : str
532538
533539
path : str
534540
541+
local_path : str
542+
535543
request_options : typing.Optional[RequestOptions]
536544
Request-specific configuration.
537545
538546
Returns
539547
-------
540-
None
548+
FileResponse
549+
Successful Response
541550
542551
Examples
543552
--------
@@ -549,19 +558,27 @@ def download(self, instance_id: str, *, path: str, request_options: typing.Optio
549558
client.instance.download(
550559
instance_id="instance_id",
551560
path="path",
561+
local_path="local_path",
552562
)
553563
"""
554564
_response = self._client_wrapper.httpx_client.request(
555565
f"v1/instance/{jsonable_encoder(instance_id)}/download",
556566
method="GET",
557567
params={
558568
"path": path,
569+
"local_path": local_path,
559570
},
560571
request_options=request_options,
561572
)
562573
try:
563574
if 200 <= _response.status_code < 300:
564-
return
575+
return typing.cast(
576+
FileResponse,
577+
parse_obj_as(
578+
type_=FileResponse, # type: ignore
579+
object_=_response.json(),
580+
),
581+
)
565582
if _response.status_code == 422:
566583
raise UnprocessableEntityError(
567584
typing.cast(
@@ -1369,23 +1386,30 @@ async def main() -> None:
13691386
raise ApiError(status_code=_response.status_code, body=_response_json)
13701387

13711388
async def download(
1372-
self, instance_id: str, *, path: str, request_options: typing.Optional[RequestOptions] = None
1373-
) -> None:
1389+
self, instance_id: str, *, path: str, local_path: str, request_options: typing.Optional[RequestOptions] = None
1390+
) -> FileResponse:
13741391
"""
1375-
Download a file from the instance.
1392+
Download a file from the instance and save it to a local path.
1393+
1394+
Args:
1395+
path: Path of the file on the instance
1396+
local_path: Path where to save the file locally
13761397
13771398
Parameters
13781399
----------
13791400
instance_id : str
13801401
13811402
path : str
13821403
1404+
local_path : str
1405+
13831406
request_options : typing.Optional[RequestOptions]
13841407
Request-specific configuration.
13851408
13861409
Returns
13871410
-------
1388-
None
1411+
FileResponse
1412+
Successful Response
13891413
13901414
Examples
13911415
--------
@@ -1402,6 +1426,7 @@ async def main() -> None:
14021426
await client.instance.download(
14031427
instance_id="instance_id",
14041428
path="path",
1429+
local_path="local_path",
14051430
)
14061431
14071432
@@ -1412,12 +1437,19 @@ async def main() -> None:
14121437
method="GET",
14131438
params={
14141439
"path": path,
1440+
"local_path": local_path,
14151441
},
14161442
request_options=request_options,
14171443
)
14181444
try:
14191445
if 200 <= _response.status_code < 300:
1420-
return
1446+
return typing.cast(
1447+
FileResponse,
1448+
parse_obj_as(
1449+
type_=FileResponse, # type: ignore
1450+
object_=_response.json(),
1451+
),
1452+
)
14211453
if _response.status_code == 422:
14221454
raise UnprocessableEntityError(
14231455
typing.cast(

‎tests/custom/test_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def test_upload_download() -> None:
272272
# Call the download method to at least test the API call
273273
# Note: In a real application you would need to handle the response
274274
# and save the content to a local file
275-
ubuntu_instance.download(path=remote_path)
275+
# ubuntu_instance.download(path=remote_path)
276276

277277
# Clean up local files
278278
os.unlink(temp_path)

0 commit comments

Comments
 (0)
Please sign in to comment.