antigate

package module
v0.0.0-...-5b7bca7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2015 License: GPL-2.0 Imports: 10 Imported by: 0

README

antigate

Antigate (anti-captcha.com) API for Go

Documentation

Index

Constants

View Source
const (
	// BaseURL - AntiGate base url.
	BaseURL = "http://anti-captcha.com"
)

Variables

View Source
var (
	// ErrNoSlots - Error returned when API has no available workers.
	ErrNoSlots = errors.New("No slots available")

	// ErrCaptchaNotReady - Error returned when captcha is work in progress.
	ErrCaptchaNotReady = errors.New("Captcha is not yet solved")

	// ErrorNames - Errors by name returned from API.
	ErrorNames = map[string]error{
		"ERROR_NO_SLOT_AVAILABLE": ErrNoSlots,
		"CAPCHA_NOT_READY":        ErrCaptchaNotReady,
	}
)

Functions

func GetError

func GetError(text string) error

GetError - Gets Antigate error by name.

func GetErrorBytes

func GetErrorBytes(text []byte) error

GetErrorBytes - Gets Antigate error by name.

Types

type Client

type Client struct {
	URL string
	Key string

	CheckInterval time.Duration // solve check interval
	RetryInterval time.Duration // retry interval when too much traffic
	MaxRetries    int
}

Client - AntiGate Client.

func New

func New(key string) *Client

New - Creates new AntiGate client. Default values:

CheckInterval - 2.5 seconds
RetryInterval - 2.5 seconds
MaxRetries    - 35

func (*Client) GetBalance

func (client *Client) GetBalance() (balance float64, err error)

GetBalance - Gets account balance.

func (*Client) GetStatus

func (client *Client) GetStatus(captcha int) (ok bool, result string, err error)

GetStatus -

func (*Client) GetURL

func (client *Client) GetURL(path string, v ...interface{}) string

GetURL - Gets full api url.

func (*Client) Solve

func (client *Client) Solve(image []byte) (result string, err error)

Solve - Solves captcha.

func (*Client) UploadImage

func (client *Client) UploadImage(image []byte) (captcha int, err error)

UploadImage - Uploads image to AntiGate API.

type LoadStat

type LoadStat struct {
	Waiting                  int     `xml:"waiting"`
	WaitingRU                int     `xml:"waitingRU"`
	Load                     float32 `xml:"load"`
	Minbid                   float64 `xml:"minbid"`
	MinbidRU                 float64 `xml:"minbidRU"`
	AverageRecognitionTime   float64 `xml:"averageRecognitionTime"`
	AverageRecognitionTimeRU float64 `xml:"averageRecognitionTimeRU"`
}

LoadStat - AntiGate load statistics.

func GetSystemStat

func GetSystemStat() (stats *LoadStat, err error)

GetSystemStat - Gets AntiGate load statistics.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL