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
15 changes: 15 additions & 0 deletions hyperbrowser/client/managers/async_manager/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
SessionEventLogListResponse,
SessionEventLog,
UpdateSessionProfileParams,
UpdateSessionProxyParams,
SessionGetParams,
)

Expand Down Expand Up @@ -183,6 +184,20 @@ async def update_profile_params(
)
return BasicResponse(**response.data)

async def update_proxy_params(
self,
id: str,
params: UpdateSessionProxyParams,
) -> BasicResponse:
response = await self._client.transport.put(
self._client._build_url(f"/session/{id}/update"),
data={
"type": "proxy",
"params": params.model_dump(exclude_none=True, by_alias=True),
},
)
return BasicResponse(**response.data)

def _warn_update_profile_params_boolean_deprecated(self) -> None:
if SessionManager._has_warned_update_profile_params_boolean_deprecated:
return
Expand Down
16 changes: 15 additions & 1 deletion hyperbrowser/client/managers/sync_manager/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
UploadFileResponse,
SessionEventLogListParams,
SessionEventLogListResponse,
SessionEventLog,
UpdateSessionProfileParams,
UpdateSessionProxyParams,
SessionGetParams,
)

Expand Down Expand Up @@ -179,6 +179,20 @@ def update_profile_params(
)
return BasicResponse(**response.data)

def update_proxy_params(
self,
id: str,
params: UpdateSessionProxyParams,
) -> BasicResponse:
response = self._client.transport.put(
self._client._build_url(f"/session/{id}/update"),
data={
"type": "proxy",
"params": params.model_dump(exclude_none=True, by_alias=True),
},
)
return BasicResponse(**response.data)

def _warn_update_profile_params_boolean_deprecated(self) -> None:
if SessionManager._has_warned_update_profile_params_boolean_deprecated:
return
Expand Down
4 changes: 4 additions & 0 deletions hyperbrowser/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@
UploadFileResponse,
ImageCaptchaParam,
UpdateSessionProfileParams,
UpdateSessionProxyLocationParams,
UpdateSessionProxyParams,
)
from .sandbox import (
SandboxStatus,
Expand Down Expand Up @@ -485,6 +487,8 @@
"UploadFileResponse",
"ImageCaptchaParam",
"UpdateSessionProfileParams",
"UpdateSessionProxyLocationParams",
"UpdateSessionProxyParams",
# sandbox
"SandboxStatus",
"SandboxRegion",
Expand Down
32 changes: 31 additions & 1 deletion hyperbrowser/models/session.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import datetime
from typing import Any, List, Literal, Optional, Union, Dict
from .computer_action import ComputerActionParams, ComputerActionResponse

from pydantic import BaseModel, ConfigDict, Field, field_validator

Expand Down Expand Up @@ -70,6 +69,37 @@ class UpdateSessionProfileParams(BaseModel):
)


class UpdateSessionProxyLocationParams(BaseModel):
"""
Managed proxy geolocation overrides for a running session.
"""

model_config = ConfigDict(
populate_by_alias=True,
)

country: Optional[Country] = Field(default=None, serialization_alias="country")
state: Optional[State] = Field(default=None, serialization_alias="state")
city: Optional[str] = Field(default=None, serialization_alias="city")


class UpdateSessionProxyParams(BaseModel):
"""
Parameters for enabling, disabling, or reconfiguring a session proxy.
"""

model_config = ConfigDict(
populate_by_alias=True,
)

enabled: bool = Field(serialization_alias="enabled")
static_ip_id: Optional[str] = Field(default=None, serialization_alias="staticIpId")
location: Optional[UpdateSessionProxyLocationParams] = Field(
default=None,
serialization_alias="location",
)


class SessionLaunchState(BaseModel):
model_config = ConfigDict(
populate_by_alias=True,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hyperbrowser"
version = "0.87.0"
version = "0.88.0"
description = "Python SDK for hyperbrowser"
authors = ["Nikhil Shahi <nshahi1998@gmail.com>"]
license = "MIT"
Expand Down