Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
Type string `json:"type"`
Title string `json:"title"`
Status int `json:"status"`
Detail string `json:"detail"`
}
Error is an error from the Zyte API.
type LimitFunc ¶
LimitFunc is called to add n to the number of requests made (may be zero), and returns an error if the limit has been reached or exceeded.
func FixedLimit ¶
FixedLimit allows a fixed number of requests.
type RetryFunc ¶
RetryFunc is called with the number of retries attempted and the last response status for ban responses. It should delay and return true. It should return false to prevent a retry. It should also return false if ctx is canceled.
func RetryLimit ¶
RetryLimit returns a RetryFunc with a fixed retry limit, using the recommended retry interval.
type Transport ¶
type Transport struct {
// APIKey is used to authenticate with Zyte. To use x402, handle it in Next.
APIKey string
// Retry controls retry behaviour for unsuccessful requests. If nil,
// unsuccessful requests are not retried. It is not called for rate-limiting
// responses, which are retried infinitely until the context is canceled.
Retry RetryFunc
// Limit is called for cost-incurring responses and before making requests,
// If nil, requests are unlimited.
Limit LimitFunc
// FollowRedirect controls whether to follow redirects internally. This is
// not how a [http.RoundTripper] is expected to behave, but costs less. If
// false, beware of redirect loops.
FollowRedirect bool
// Next is used for making Zyte API requests. If nil,
// [http.DefaultTransport] is used.
Next http.RoundTripper
}
Transport implements a http.RoundTripper using the Zyte API.
Click to show internal directories.
Click to hide internal directories.