Skip to content

Commit acbcb4f

Browse files
Add sync and async team credit info examples
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 77c45a9 commit acbcb4f

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ Ready-to-run examples are available in `examples/`:
263263
- `examples/async_profile_list.py`
264264
- `examples/async_scrape.py`
265265
- `examples/async_session_list.py`
266+
- `examples/async_team_credit_info.py`
266267
- `examples/async_web_crawl.py`
267268
- `examples/async_web_fetch.py`
268269
- `examples/async_web_search.py`
@@ -272,6 +273,7 @@ Ready-to-run examples are available in `examples/`:
272273
- `examples/sync_profile_list.py`
273274
- `examples/sync_scrape.py`
274275
- `examples/sync_session_list.py`
276+
- `examples/sync_team_credit_info.py`
275277
- `examples/sync_web_crawl.py`
276278
- `examples/sync_web_fetch.py`
277279
- `examples/sync_web_search.py`

examples/async_team_credit_info.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Asynchronous team credit info example.
3+
4+
Run:
5+
export HYPERBROWSER_API_KEY="your_api_key"
6+
python3 examples/async_team_credit_info.py
7+
"""
8+
9+
import asyncio
10+
11+
from hyperbrowser import AsyncHyperbrowser
12+
13+
14+
async def main() -> None:
15+
async with AsyncHyperbrowser() as client:
16+
credit_info = await client.team.get_credit_info()
17+
print(f"Usage: {credit_info.usage}")
18+
print(f"Limit: {credit_info.limit}")
19+
print(f"Remaining: {credit_info.remaining}")
20+
21+
22+
if __name__ == "__main__":
23+
asyncio.run(main())

examples/sync_team_credit_info.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
Synchronous team credit info example.
3+
4+
Run:
5+
export HYPERBROWSER_API_KEY="your_api_key"
6+
python3 examples/sync_team_credit_info.py
7+
"""
8+
9+
from hyperbrowser import Hyperbrowser
10+
11+
12+
def main() -> None:
13+
with Hyperbrowser() as client:
14+
credit_info = client.team.get_credit_info()
15+
print(f"Usage: {credit_info.usage}")
16+
print(f"Limit: {credit_info.limit}")
17+
print(f"Remaining: {credit_info.remaining}")
18+
19+
20+
if __name__ == "__main__":
21+
main()

0 commit comments

Comments
 (0)