File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -102,16 +102,33 @@ with Hyperbrowser(api_key="your_api_key") as client:
102102## Error handling
103103
104104SDK errors are raised as ` HyperbrowserError ` .
105+ Polling timeouts and repeated polling failures are surfaced as:
106+
107+ - ` HyperbrowserTimeoutError `
108+ - ` HyperbrowserPollingError `
105109
106110``` python
107111from hyperbrowser import Hyperbrowser
108- from hyperbrowser.exceptions import HyperbrowserError
112+ from hyperbrowser.exceptions import (
113+ HyperbrowserError,
114+ HyperbrowserTimeoutError,
115+ )
116+ from hyperbrowser.models import StartScrapeJobParams
109117
110118try :
111119 with Hyperbrowser(api_key = " invalid" ) as client:
112120 client.team.get_credit_info()
113121except HyperbrowserError as exc:
114122 print (exc)
123+
124+ try :
125+ with Hyperbrowser(api_key = " your_api_key" ) as client:
126+ client.scrape.start_and_wait(
127+ StartScrapeJobParams(url = " https://example.com" ),
128+ max_wait_seconds = 5 ,
129+ )
130+ except HyperbrowserTimeoutError:
131+ print (" Scrape job timed out" )
115132```
116133
117134## Development
You can’t perform that action at this time.
0 commit comments