File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -259,6 +259,7 @@ Ready-to-run examples are available in `examples/`:
259259
260260- ` examples/sync_scrape.py `
261261- ` examples/async_extract.py `
262+ - ` examples/sync_web_search.py `
262263
263264## License
264265
Original file line number Diff line number Diff line change 1+ """
2+ Example: synchronous web search with the Hyperbrowser SDK.
3+
4+ Run:
5+ export HYPERBROWSER_API_KEY="your_api_key"
6+ python3 examples/sync_web_search.py
7+ """
8+
9+ from hyperbrowser import Hyperbrowser
10+ from hyperbrowser .models import WebSearchParams
11+
12+
13+ def main () -> None :
14+ with Hyperbrowser () as client :
15+ response = client .web .search (
16+ WebSearchParams (
17+ query = "Hyperbrowser Python SDK" ,
18+ page = 1 ,
19+ )
20+ )
21+
22+ print (f"Job ID: { response .job_id } " )
23+ print (f"Status: { response .status } " )
24+
25+ if not response .data :
26+ print ("No results returned." )
27+ return
28+
29+ print (f"Query: { response .data .query } " )
30+ for index , result in enumerate (response .data .results [:5 ], start = 1 ):
31+ print (f"{ index } . { result .title } -> { result .url } " )
32+
33+
34+ if __name__ == "__main__" :
35+ main ()
You can’t perform that action at this time.
0 commit comments