func (c *TwitterApi) EnableThrottling(rate time.Duration, bufferSize int64) {
	c.bucket = tokenbucket.NewBucket(rate, bufferSize)
}
Enable query throttling using the tokenbucket algorithm
package anaconda
import (
	"compress/zlib"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"strings"
	"time"
	"github.com/ChimeraCoder/tokenbucket"
	"github.com/garyburd/go-oauth/oauth"
)
const (
	_GET          = iota
	_POST         = iota
	_DELETE       = iota
	_PUT          = iota
	BaseUrlV1     = "https://api.twitter.com/1"
	BaseUrl       = "https://api.twitter.com/1.1"
	UploadBaseUrl = "https://upload.twitter.com/1.1"
)
var (
	oauthCredentials oauth.Credentials
)
type TwitterApi struct {
	oauthClient          oauth.Client
	Credentials          *oauth.Credentials
	queryQueue           chan query
	bucket               *tokenbucket.Bucket
	returnRateLimitError bool
	HttpClient           *http.Client
	Log Logger
	baseUrl string
}
type query struct {
	url         string
	form        url.Values
	data        interface{}
	method      int
	response_ch chan response
}
type response struct {
	data interface{}
	err  error
}
const DEFAULT_DELAY = 0 * time.Second
const DEFAULT_CAPACITY = 5
func NewTwitterApi(access_token string, access_token_secret string) *TwitterApi {
	queue := make(chan query)
	c := &TwitterApi{
		oauthClient: oauth.Client{
			TemporaryCredentialRequestURI: "https://api.twitter.com/oauth/request_token",
			ResourceOwnerAuthorizationURI: "https://api.twitter.com/oauth/authenticate",
			TokenRequestURI:               "https://api.twitter.com/oauth/access_token",
			Credentials:                   oauthCredentials,
		},
		Credentials: &oauth.Credentials{
			Token:  access_token,
			Secret: access_token_secret,
		},
		queryQueue:           queue,
		bucket:               nil,
		returnRateLimitError: false,
		HttpClient:           http.DefaultClient,
		Log:                  silentLogger{},
		baseUrl:              BaseUrl,
	}
	go c.throttledQuery()
	return c
}
func NewTwitterApiWithCredentials(access_token string, access_token_secret string, consumer_key string, consumer_secret string) *TwitterApi {
	api := NewTwitterApi(access_token, access_token_secret)
	api.oauthClient.Credentials.Token = consumer_key
	api.oauthClient.Credentials.Secret = consumer_secret
	return api
}
func SetConsumerKey(consumer_key string) {
	oauthCredentials.Token = consumer_key
}
func SetConsumerSecret(consumer_secret string) {
	oauthCredentials.Secret = consumer_secret
}
func (c *TwitterApi) ReturnRateLimitError(b bool) {
	c.returnRateLimitError = b
}