mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 13:47:05 +02:00
More resilient HTTP requests
Fixed rate limit check for ListenBrainz and Funkwhale. Also retry always on server side errors.
This commit is contained in:
parent
240351dc3e
commit
4e9f50b6b6
3 changed files with 28 additions and 12 deletions
|
@ -34,15 +34,14 @@ type Client struct {
|
|||
}
|
||||
|
||||
func NewClient(serverUrl string, token string) Client {
|
||||
resty := resty.New()
|
||||
resty.SetBaseURL(serverUrl)
|
||||
resty.SetHeader("Accept", "application/json")
|
||||
client := Client{
|
||||
HttpClient: resty,
|
||||
client := resty.New()
|
||||
client.SetBaseURL(serverUrl)
|
||||
client.SetHeader("Accept", "application/json")
|
||||
client.SetRetryCount(5)
|
||||
return Client{
|
||||
HttpClient: client,
|
||||
token: token,
|
||||
}
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
func (c Client) GetScrobbles(page int, perPage int) (result GetScrobblesResult, err error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue