A Go(Golang) package for handling rate limiting.
go get -v -u github.com/hueristiq/hqgolimit
package main
import (
"fmt"
"github.com/hueristiq/hqgolimit"
)
func main() {
options := &hqgolimit.Options{
RequestsPerMinute: 40,
MinimumDelayInSeconds: 2,
}
limiter := hqgolimit.New(options)
// Make 10 requests and ensure that they are rate limited.
for i := 1; i <= 10; i++ {
limiter.Wait()
fmt.Printf("Request %d made at %v\n", i, time.Now())
}
}
Issues and Pull Requests are welcome! Check out the contribution guidelines.
This package is distributed under the MIT license.