hyperbrowser 0.10.0__py3-none-any.whl → 0.11.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hyperbrowser might be problematic. Click here for more details.
- hyperbrowser/client/async_client.py +5 -0
- hyperbrowser/client/managers/async_manager/profile.py +25 -0
- hyperbrowser/client/managers/async_manager/session.py +5 -1
- hyperbrowser/client/managers/sync_manager/profile.py +25 -0
- hyperbrowser/client/managers/sync_manager/session.py +5 -1
- hyperbrowser/client/sync.py +4 -0
- hyperbrowser/models/profile.py +17 -0
- hyperbrowser/models/session.py +12 -0
- hyperbrowser/transport/async_transport.py +9 -0
- hyperbrowser/transport/base.py +4 -0
- hyperbrowser/transport/sync.py +9 -0
- {hyperbrowser-0.10.0.dist-info → hyperbrowser-0.11.0.dist-info}/METADATA +1 -1
- hyperbrowser-0.11.0.dist-info/RECORD +27 -0
- hyperbrowser-0.10.0.dist-info/RECORD +0 -24
- {hyperbrowser-0.10.0.dist-info → hyperbrowser-0.11.0.dist-info}/LICENSE +0 -0
- {hyperbrowser-0.10.0.dist-info → hyperbrowser-0.11.0.dist-info}/WHEEL +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from .managers.async_manager.profile import ProfileManager
|
|
2
4
|
from .managers.async_manager.session import SessionManager
|
|
3
5
|
from .managers.async_manager.scrape import ScrapeManager
|
|
4
6
|
from .managers.async_manager.crawl import CrawlManager
|
|
@@ -15,11 +17,14 @@ class AsyncHyperbrowser(HyperbrowserBase):
|
|
|
15
17
|
config: Optional[ClientConfig] = None,
|
|
16
18
|
api_key: Optional[str] = None,
|
|
17
19
|
base_url: Optional[str] = None,
|
|
20
|
+
timeout: Optional[int] = 30,
|
|
18
21
|
):
|
|
19
22
|
super().__init__(AsyncTransport, config, api_key, base_url)
|
|
23
|
+
self.transport.client.timeout = timeout
|
|
20
24
|
self.sessions = SessionManager(self)
|
|
21
25
|
self.scrape = ScrapeManager(self)
|
|
22
26
|
self.crawl = CrawlManager(self)
|
|
27
|
+
self.profiles = ProfileManager(self)
|
|
23
28
|
|
|
24
29
|
async def close(self) -> None:
|
|
25
30
|
await self.transport.close()
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from hyperbrowser.models.profile import ProfileResponse, CreateProfileResponse
|
|
2
|
+
from hyperbrowser.models.session import BasicResponse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ProfileManager:
|
|
6
|
+
def __init__(self, client):
|
|
7
|
+
self._client = client
|
|
8
|
+
|
|
9
|
+
async def create(self) -> CreateProfileResponse:
|
|
10
|
+
response = await self._client.transport.post(
|
|
11
|
+
self._client._build_url("/profile"),
|
|
12
|
+
)
|
|
13
|
+
return CreateProfileResponse(**response.data)
|
|
14
|
+
|
|
15
|
+
async def get(self, id: str) -> ProfileResponse:
|
|
16
|
+
response = await self._client.transport.get(
|
|
17
|
+
self._client._build_url(f"/profile/{id}"),
|
|
18
|
+
)
|
|
19
|
+
return ProfileResponse(**response.data)
|
|
20
|
+
|
|
21
|
+
async def delete(self, id: str) -> BasicResponse:
|
|
22
|
+
response = await self._client.transport.delete(
|
|
23
|
+
self._client._build_url(f"/profile/{id}"),
|
|
24
|
+
)
|
|
25
|
+
return BasicResponse(**response.data)
|
|
@@ -16,7 +16,11 @@ class SessionManager:
|
|
|
16
16
|
async def create(self, params: CreateSessionParams = None) -> SessionDetail:
|
|
17
17
|
response = await self._client.transport.post(
|
|
18
18
|
self._client._build_url("/session"),
|
|
19
|
-
data=
|
|
19
|
+
data=(
|
|
20
|
+
{}
|
|
21
|
+
if params is None
|
|
22
|
+
else params.model_dump(exclude_none=True, by_alias=True)
|
|
23
|
+
),
|
|
20
24
|
)
|
|
21
25
|
return SessionDetail(**response.data)
|
|
22
26
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from hyperbrowser.models.profile import ProfileResponse, CreateProfileResponse
|
|
2
|
+
from hyperbrowser.models.session import BasicResponse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ProfileManager:
|
|
6
|
+
def __init__(self, client):
|
|
7
|
+
self._client = client
|
|
8
|
+
|
|
9
|
+
def create(self) -> CreateProfileResponse:
|
|
10
|
+
response = self._client.transport.post(
|
|
11
|
+
self._client._build_url("/profile"),
|
|
12
|
+
)
|
|
13
|
+
return CreateProfileResponse(**response.data)
|
|
14
|
+
|
|
15
|
+
def get(self, id: str) -> ProfileResponse:
|
|
16
|
+
response = self._client.transport.get(
|
|
17
|
+
self._client._build_url(f"/profile/{id}"),
|
|
18
|
+
)
|
|
19
|
+
return ProfileResponse(**response.data)
|
|
20
|
+
|
|
21
|
+
def delete(self, id: str) -> BasicResponse:
|
|
22
|
+
response = self._client.transport.delete(
|
|
23
|
+
self._client._build_url(f"/profile/{id}"),
|
|
24
|
+
)
|
|
25
|
+
return BasicResponse(**response.data)
|
|
@@ -16,7 +16,11 @@ class SessionManager:
|
|
|
16
16
|
def create(self, params: CreateSessionParams = None) -> SessionDetail:
|
|
17
17
|
response = self._client.transport.post(
|
|
18
18
|
self._client._build_url("/session"),
|
|
19
|
-
data=
|
|
19
|
+
data=(
|
|
20
|
+
{}
|
|
21
|
+
if params is None
|
|
22
|
+
else params.model_dump(exclude_none=True, by_alias=True)
|
|
23
|
+
),
|
|
20
24
|
)
|
|
21
25
|
return SessionDetail(**response.data)
|
|
22
26
|
|
hyperbrowser/client/sync.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
|
+
from .managers.sync_manager.profile import ProfileManager
|
|
2
3
|
from .managers.sync_manager.session import SessionManager
|
|
3
4
|
from .managers.sync_manager.scrape import ScrapeManager
|
|
4
5
|
from .managers.sync_manager.crawl import CrawlManager
|
|
@@ -15,11 +16,14 @@ class Hyperbrowser(HyperbrowserBase):
|
|
|
15
16
|
config: Optional[ClientConfig] = None,
|
|
16
17
|
api_key: Optional[str] = None,
|
|
17
18
|
base_url: Optional[str] = None,
|
|
19
|
+
timeout: Optional[int] = 30,
|
|
18
20
|
):
|
|
19
21
|
super().__init__(SyncTransport, config, api_key, base_url)
|
|
22
|
+
self.transport.client.timeout = timeout
|
|
20
23
|
self.sessions = SessionManager(self)
|
|
21
24
|
self.scrape = ScrapeManager(self)
|
|
22
25
|
self.crawl = CrawlManager(self)
|
|
26
|
+
self.profiles = ProfileManager(self)
|
|
23
27
|
|
|
24
28
|
def close(self) -> None:
|
|
25
29
|
self.transport.close()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class CreateProfileResponse(BaseModel):
|
|
6
|
+
id: str
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ProfileResponse(BaseModel):
|
|
10
|
+
model_config = ConfigDict(
|
|
11
|
+
populate_by_alias=True,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
id: str
|
|
15
|
+
team_id: str = Field(alias="teamId")
|
|
16
|
+
created_at: datetime = Field(alias="createdAt")
|
|
17
|
+
updated_at: datetime = Field(alias="updatedAt")
|
hyperbrowser/models/session.py
CHANGED
|
@@ -101,6 +101,17 @@ class ScreenConfig(BaseModel):
|
|
|
101
101
|
height: int = Field(default=720, serialization_alias="height")
|
|
102
102
|
|
|
103
103
|
|
|
104
|
+
class CreateSessionProfile(BaseModel):
|
|
105
|
+
"""
|
|
106
|
+
Profile configuration parameters for browser session.
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
id: Optional[str] = Field(default=None, serialization_alias="id")
|
|
110
|
+
persist_changes: Optional[bool] = Field(
|
|
111
|
+
default=None, serialization_alias="persistChanges"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
104
115
|
class CreateSessionParams(BaseModel):
|
|
105
116
|
"""
|
|
106
117
|
Parameters for creating a new browser session.
|
|
@@ -136,6 +147,7 @@ class CreateSessionParams(BaseModel):
|
|
|
136
147
|
enable_web_recording: Optional[bool] = Field(
|
|
137
148
|
default=False, serialization_alias="enableWebRecording"
|
|
138
149
|
)
|
|
150
|
+
profile: Optional[CreateSessionProfile] = Field(default=None)
|
|
139
151
|
|
|
140
152
|
|
|
141
153
|
class SessionRecording(BaseModel):
|
|
@@ -94,3 +94,12 @@ class AsyncTransport(TransportStrategy):
|
|
|
94
94
|
raise
|
|
95
95
|
except Exception as e:
|
|
96
96
|
raise HyperbrowserError("Put request failed", original_error=e)
|
|
97
|
+
|
|
98
|
+
async def delete(self, url: str) -> APIResponse:
|
|
99
|
+
try:
|
|
100
|
+
response = await self.client.delete(url)
|
|
101
|
+
return await self._handle_response(response)
|
|
102
|
+
except HyperbrowserError:
|
|
103
|
+
raise
|
|
104
|
+
except Exception as e:
|
|
105
|
+
raise HyperbrowserError("Delete request failed", original_error=e)
|
hyperbrowser/transport/base.py
CHANGED
hyperbrowser/transport/sync.py
CHANGED
|
@@ -73,3 +73,12 @@ class SyncTransport(TransportStrategy):
|
|
|
73
73
|
raise
|
|
74
74
|
except Exception as e:
|
|
75
75
|
raise HyperbrowserError("Put request failed", original_error=e)
|
|
76
|
+
|
|
77
|
+
def delete(self, url: str) -> APIResponse:
|
|
78
|
+
try:
|
|
79
|
+
response = self.client.delete(url)
|
|
80
|
+
return self._handle_response(response)
|
|
81
|
+
except HyperbrowserError:
|
|
82
|
+
raise
|
|
83
|
+
except Exception as e:
|
|
84
|
+
raise HyperbrowserError("Delete request failed", original_error=e)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
LICENSE,sha256=6rUGKlyKb_1ZAH7h7YITYAAUNFN3MNGGKCyfrw49NLE,1071
|
|
2
|
+
hyperbrowser/__init__.py,sha256=zWGcLhqhvWy6BTwuNpzWK1-0LpIn311ks-4U9nrsb7Y,187
|
|
3
|
+
hyperbrowser/client/async_client.py,sha256=BOM_FPK_I7SGwQ6vz5-vB-PXvKOf9kJECkMDE_gwQtI,1174
|
|
4
|
+
hyperbrowser/client/base.py,sha256=9gFma7RdvJBUlDCqr8tZd315UPrjn4ldU4B0-Y-L4O4,1268
|
|
5
|
+
hyperbrowser/client/managers/async_manager/crawl.py,sha256=hBS2WwfE0-ZopCW9PjP30meU5iTDdRViFl1C1OF1hVU,2291
|
|
6
|
+
hyperbrowser/client/managers/async_manager/profile.py,sha256=l9S-5iw-zLP89xg9f5ZCT7OjimuCotFFQtyxfDZ8Ahg,882
|
|
7
|
+
hyperbrowser/client/managers/async_manager/scrape.py,sha256=7FdYS_NNEpvB9z3ShGZaZxNryKHm02MQR-g9diadGhA,1319
|
|
8
|
+
hyperbrowser/client/managers/async_manager/session.py,sha256=ObJhz1IkCCIQLwmztQ-M7lCKzKsVDr-eWCFnan2d9rQ,1692
|
|
9
|
+
hyperbrowser/client/managers/sync_manager/crawl.py,sha256=lnMtBmOPcamjtvzH4BAnWbBTGbKBmHGUQiMnnZlj2tg,2222
|
|
10
|
+
hyperbrowser/client/managers/sync_manager/profile.py,sha256=EvEtJ9INV8yhYKJoSJV1x2eBtsrS2QPeSifFEi7gxb4,846
|
|
11
|
+
hyperbrowser/client/managers/sync_manager/scrape.py,sha256=DxSvdHa-z2P_rvNUwmRfU4iQz19wiEi_M2YmBQZfLyk,1265
|
|
12
|
+
hyperbrowser/client/managers/sync_manager/session.py,sha256=74cekrDaGKW5WlP_0Qrqlk-xW2p1u4s63E-D08a4A2s,1610
|
|
13
|
+
hyperbrowser/client/sync.py,sha256=U_4DTan8wuFhEerKAg4M_V4P6X-zUGtlUjmEotwAqbE,999
|
|
14
|
+
hyperbrowser/config.py,sha256=2J6GYNR_83vzJZ6jEV-LXO1U-q6DHIrfyAU0WrUPhw8,625
|
|
15
|
+
hyperbrowser/exceptions.py,sha256=SUUkptK2OL36xDORYmSicaTYR7pMbxeWAjAgz35xnM8,1171
|
|
16
|
+
hyperbrowser/models/consts.py,sha256=xsMBPivE4M6wGJ5Q0x3oRTgt0Koi1occtAeHthes9ZY,4970
|
|
17
|
+
hyperbrowser/models/crawl.py,sha256=DWeJRwuZ0EXOEpEx0OyUZp_HOdGfpptg_mNo5J0u6po,2566
|
|
18
|
+
hyperbrowser/models/profile.py,sha256=SYu4SR6OSwvg0C3bMW3j9z3zhPi-IzXuJE5aVJ3t-Nc,397
|
|
19
|
+
hyperbrowser/models/scrape.py,sha256=e3Z5HgCkLD1FxOjXtPmI6SAJ9wsrAKXj7WElXFXy8yE,2103
|
|
20
|
+
hyperbrowser/models/session.py,sha256=fSxXSKrvjrAJhqFr4dmgwLKplBV07ui22NHMtaFvoWg,4903
|
|
21
|
+
hyperbrowser/transport/async_transport.py,sha256=MrX0--xjPcri1zuXziQxSKJe0OyC-9b3UBpwLABIqDc,3850
|
|
22
|
+
hyperbrowser/transport/base.py,sha256=ildpMrDiM8nvrSGrH2LTOafmB17T7PQB_NQ1ODA378U,1703
|
|
23
|
+
hyperbrowser/transport/sync.py,sha256=qU_ScFRjmxBvkKIzv5k77Vt9BmKZaCDF3rIve1is9mY,3150
|
|
24
|
+
hyperbrowser-0.11.0.dist-info/LICENSE,sha256=6rUGKlyKb_1ZAH7h7YITYAAUNFN3MNGGKCyfrw49NLE,1071
|
|
25
|
+
hyperbrowser-0.11.0.dist-info/METADATA,sha256=ADGY2GMRxLIOjLzavVlKAIPsROLR1PevAVT0aFmcP9g,3290
|
|
26
|
+
hyperbrowser-0.11.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
27
|
+
hyperbrowser-0.11.0.dist-info/RECORD,,
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
LICENSE,sha256=6rUGKlyKb_1ZAH7h7YITYAAUNFN3MNGGKCyfrw49NLE,1071
|
|
2
|
-
hyperbrowser/__init__.py,sha256=zWGcLhqhvWy6BTwuNpzWK1-0LpIn311ks-4U9nrsb7Y,187
|
|
3
|
-
hyperbrowser/client/async_client.py,sha256=ppJI8O7SQi89mwMhIHVgTgFeRu2aZbLl2zbFaI3sXNU,984
|
|
4
|
-
hyperbrowser/client/base.py,sha256=9gFma7RdvJBUlDCqr8tZd315UPrjn4ldU4B0-Y-L4O4,1268
|
|
5
|
-
hyperbrowser/client/managers/async_manager/crawl.py,sha256=hBS2WwfE0-ZopCW9PjP30meU5iTDdRViFl1C1OF1hVU,2291
|
|
6
|
-
hyperbrowser/client/managers/async_manager/scrape.py,sha256=7FdYS_NNEpvB9z3ShGZaZxNryKHm02MQR-g9diadGhA,1319
|
|
7
|
-
hyperbrowser/client/managers/async_manager/session.py,sha256=cJCYzJYHUXx19U5vQNi6_80BPxd1QTDq6XvXHM-PNVg,1628
|
|
8
|
-
hyperbrowser/client/managers/sync_manager/crawl.py,sha256=lnMtBmOPcamjtvzH4BAnWbBTGbKBmHGUQiMnnZlj2tg,2222
|
|
9
|
-
hyperbrowser/client/managers/sync_manager/scrape.py,sha256=DxSvdHa-z2P_rvNUwmRfU4iQz19wiEi_M2YmBQZfLyk,1265
|
|
10
|
-
hyperbrowser/client/managers/sync_manager/session.py,sha256=n81y5af8bmFlyk9QoPCmKrhRwvYlsVv136jDHfpbOBI,1546
|
|
11
|
-
hyperbrowser/client/sync.py,sha256=CzXlPksK4D7eazQDzbra-pM64Sy0bLrg0zjv5xBKZdk,811
|
|
12
|
-
hyperbrowser/config.py,sha256=2J6GYNR_83vzJZ6jEV-LXO1U-q6DHIrfyAU0WrUPhw8,625
|
|
13
|
-
hyperbrowser/exceptions.py,sha256=SUUkptK2OL36xDORYmSicaTYR7pMbxeWAjAgz35xnM8,1171
|
|
14
|
-
hyperbrowser/models/consts.py,sha256=xsMBPivE4M6wGJ5Q0x3oRTgt0Koi1occtAeHthes9ZY,4970
|
|
15
|
-
hyperbrowser/models/crawl.py,sha256=DWeJRwuZ0EXOEpEx0OyUZp_HOdGfpptg_mNo5J0u6po,2566
|
|
16
|
-
hyperbrowser/models/scrape.py,sha256=e3Z5HgCkLD1FxOjXtPmI6SAJ9wsrAKXj7WElXFXy8yE,2103
|
|
17
|
-
hyperbrowser/models/session.py,sha256=QVcPc4rkXqTfSE9roEImRgsJ4xxHruTaKubQSHy__xI,4541
|
|
18
|
-
hyperbrowser/transport/async_transport.py,sha256=P-nX9iczGVYJyvqtqlGAOFQ3PghRC2_bE6Lruiiecn0,3511
|
|
19
|
-
hyperbrowser/transport/base.py,sha256=9l7k-qTX4Q2KaZIR_fwsNlxDgOzsmc8zgucZ9tfHgkw,1622
|
|
20
|
-
hyperbrowser/transport/sync.py,sha256=DFDPYqF-_WQSZkRbWDRFTPowQMzz-B3N869r2vvocPc,2829
|
|
21
|
-
hyperbrowser-0.10.0.dist-info/LICENSE,sha256=6rUGKlyKb_1ZAH7h7YITYAAUNFN3MNGGKCyfrw49NLE,1071
|
|
22
|
-
hyperbrowser-0.10.0.dist-info/METADATA,sha256=x-k7Iin7O1lTl6mLSRjwPRJ8JRRNQItbc-N3Tq4vqFY,3290
|
|
23
|
-
hyperbrowser-0.10.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
24
|
-
hyperbrowser-0.10.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|