Support rate limiting

Re: API-67
The C++ nerd in me objects because that reallocates the slice in each
iteration of the parent loop.  But I guess your thinking is that in our
current config of sphinx there would only be one bucket anyway, hence only
one iteration of the parent loop?


On Thu, Jun 26, 2014 at 9:35 AM, Alex Zylman <notifications@github.com>
wrote:

> In clever.go:
>
> > @@ -57,6 +57,25 @@ func (err *CleverError) Error() string {
> >  	return fmt.Sprintf("%s (%s)", err.Error, err.Code)
> >  }
> >
> > +type TooManyRequestsError struct {
> > +	Header http.Header
> > +}
> > +
> > +func (err *TooManyRequestsError) Error() string {
> > +	err_string := "Too Many Requests"
> > +	err_props := []string{"Remaining", "Limit", "Reset"}
> > +	for bucket_index, bucket_name := range err.Header[http.CanonicalHeaderKey("X-Ratelimit-Bucket")] {
> > +		err_string += fmt.Sprintf("\nBucket: %s", bucket_name)
> > +		for _, prop := range err_props {
>
> I might ditch the err_props var and just do for _, prop := range
> []string{"Remaining", "Limit", "Reset"}
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/Clever/clever-go/pull/5/files#r14251030>.
>



-- 
Dan Sparks
Software Developer Intern
m | 510-219-4687
w | https://clever.com