Reset guest token if rate limit is reached
This commit is contained in:
parent
56f5a2edc2
commit
142387af97
1 changed files with 4 additions and 0 deletions
4
api.go
4
api.go
|
|
@ -44,6 +44,10 @@ func (s *Scraper) RequestAPI(req *http.Request, target interface{}) error {
|
|||
return fmt.Errorf("response status %s", resp.Status)
|
||||
}
|
||||
|
||||
if resp.Header.Get("X-Rate-Limit-Remaining") == "0" {
|
||||
s.guestToken = ""
|
||||
}
|
||||
|
||||
return json.NewDecoder(resp.Body).Decode(target)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue