Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "scrapybara"

[tool.poetry]
name = "scrapybara"
version = "2.4.7"
version = "2.4.8"
description = ""
readme = "README.md"
authors = []
Expand Down
168 changes: 168 additions & 0 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,174 @@ client.instance.file(
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.instance.<a href="src/scrapybara/instance/client.py">download</a>(...)</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Download a file from the instance.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```python
from scrapybara import Scrapybara

client = Scrapybara(
api_key="YOUR_API_KEY",
)
client.instance.download(
instance_id="instance_id",
path="path",
)

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**instance_id:** `str`

</dd>
</dl>

<dl>
<dd>

**path:** `str`

</dd>
</dl>

<dl>
<dd>

**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.instance.<a href="src/scrapybara/instance/client.py">upload</a>(...)</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Upload a file to the instance.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```python
from scrapybara import Scrapybara

client = Scrapybara(
api_key="YOUR_API_KEY",
)
client.instance.upload(
instance_id="instance_id",
path="path",
)

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**instance_id:** `str`

</dd>
</dl>

<dl>
<dd>

**file:** `from __future__ import annotations

core.File` — See core.File for more documentation

</dd>
</dl>

<dl>
<dd>

**path:** `str`

</dd>
</dl>

<dl>
<dd>

**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>
Expand Down
2 changes: 2 additions & 0 deletions src/scrapybara/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
StopInstanceResponse,
TakeScreenshotAction,
TypeTextAction,
UploadResponse,
ValidationError,
ValidationErrorLocItem,
WaitAction,
Expand Down Expand Up @@ -114,6 +115,7 @@
"TakeScreenshotAction",
"TypeTextAction",
"UnprocessableEntityError",
"UploadResponse",
"ValidationError",
"ValidationErrorLocItem",
"WaitAction",
Expand Down
54 changes: 54 additions & 0 deletions src/scrapybara/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from scrapybara.environment import ScrapybaraEnvironment
from .core.request_options import RequestOptions
from .core.api_error import ApiError
from .core import File
from .types import (
Action,
AuthStateResponse,
Expand All @@ -49,6 +50,7 @@
StopBrowserResponse,
StopInstanceResponse,
ModifyBrowserAuthResponse,
UploadResponse,
)

from .types.act import (
Expand Down Expand Up @@ -963,6 +965,32 @@ def file(
line_numbers=line_numbers,
request_options=request_options
)

def upload(
self,
*,
file: File,
path: str,
request_options: Optional[RequestOptions] = None,
) -> UploadResponse:
return self._client.instance.upload(
self.id,
file=file,
path=path,
request_options=request_options,
)

def download(
self,
*,
path: str,
request_options: Optional[RequestOptions] = None,
) -> None:
return self._client.instance.download(
self.id,
path=path,
request_options=request_options,
)

class BrowserInstance(BaseInstance):
def __init__(
Expand Down Expand Up @@ -1471,6 +1499,32 @@ async def file(
line_numbers=line_numbers,
request_options=request_options
)

async def upload(
self,
*,
file: File,
path: str,
request_options: Optional[RequestOptions] = None,
) -> UploadResponse:
return await self._client.instance.upload(
self.id,
file=file,
path=path,
request_options=request_options,
)

async def download(
self,
*,
path: str,
request_options: Optional[RequestOptions] = None,
) -> None:
return await self._client.instance.download(
self.id,
path=path,
request_options=request_options,
)

class AsyncBrowserInstance(AsyncBaseInstance):
def __init__(
Expand Down
2 changes: 1 addition & 1 deletion src/scrapybara/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "2.4.7",
"X-Fern-SDK-Version": "2.4.8",
}
headers["x-api-key"] = self.api_key
return headers
Expand Down
Loading