File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -262,6 +262,7 @@ Ready-to-run examples are available in `examples/`:
262262- ` examples/sync_web_search.py `
263263- ` examples/async_web_search.py `
264264- ` examples/sync_session_list.py `
265+ - ` examples/async_session_list.py `
265266
266267## License
267268
Original file line number Diff line number Diff line change 1+ """
2+ Example: list sessions asynchronously with the Hyperbrowser SDK.
3+
4+ Run:
5+ export HYPERBROWSER_API_KEY="your_api_key"
6+ python3 examples/async_session_list.py
7+ """
8+
9+ import asyncio
10+
11+ from hyperbrowser import AsyncHyperbrowser
12+ from hyperbrowser .models import SessionListParams
13+
14+
15+ async def main () -> None :
16+ async with AsyncHyperbrowser () as client :
17+ response = await client .sessions .list (
18+ SessionListParams (
19+ page = 1 ,
20+ limit = 5 ,
21+ )
22+ )
23+
24+ print (f"Success: { response .success } " )
25+ print (f"Returned sessions: { len (response .data )} " )
26+ for session in response .data :
27+ print (f"- { session .id } ({ session .status } )" )
28+
29+
30+ if __name__ == "__main__" :
31+ asyncio .run (main ())
You can’t perform that action at this time.
0 commit comments