Skip to content

Wrapper for online service which provides real-time captcha-to-text decodings. http://anti-captcha.com/

License

Notifications You must be signed in to change notification settings

gotlium/antigate

Repository files navigation

Real-time captcha-to-text decodings

Build Status https://coveralls.io/repos/gotlium/antigate/badge.png?branch=master Python 2.6, 2.7, 3.3, 3.4, 3.5 License

Documentation available here.

Installation

From source:

$ git clone https://github.com/gotlium/antigate.git

$ cd antigate && python setup.py install

From PyPi:

$  pip install antigate

Requirements:

You can use grab/requests/urllib as http backends.

Grab installation:

pip install grab pycurl

Requests installation:

pip install requests

UrlLib used by default.

Usage

>>> from antigate import AntiGate            # AntiCaptcha

# per line example
>>> print AntiGate('API-KEY', 'captcha.jpg') # AntiCaptcha('API-KEY', filename or base64 or bytes)

# or like this
>>> gate = AntiGate('API-KEY')               # AntiCaptcha('API-KEY')
>>> captcha_id = gate.send('captcha.jpg')
>>> print gate.get(captcha_id)

If you wish to complain about a mismatch results, use abuse method:

>>> from antigate import AntiGate
>>> gate = AntiGate('API-KEY', 'captcha.jpg')
>>> if str(gate) != 'qwerty':
>>>     gate.abuse()

After all manipulations, you can get your account balance:

>>> print gate.balance()

Or get your statistics data:

>>> print gate.stats()

System load info:

>>> print gate.load()

Customizing requests to API

Customize grab-lib preferences:

>>> from antigate import AntiGate
>>> config = {'connect_timeout': 5, 'timeout': 60}
>>> gate = AntiGate('API-KEY', 'captcha.jpg', grab_config=config)
>>> print gate

Additional options for sending Captcha:

>>> from antigate import AntiGate
>>> config = {'min_len': '3', 'max_len': '5', 'phrase': '2'}
>>> gate = AntiGate('API-KEY', 'captcha.jpg', send_config=config)
>>> print gate

Use all methods manually:

>>> from antigate import AntiGate
>>> gate = AntiGate('API-KEY')
>>> captcha_id1 = gate.send('captcha1.jpg')
>>> captcha_id2 = gate.send('captcha2.jpg')
>>> print gate.get(captcha_id1)
>>> print gate.get(captcha_id2)

Get results for multiple ids:

>>> gate = AntiGate('API-KEY')
>>> captcha_id1 = gate.send('captcha1.jpg')
>>> captcha_id2 = gate.send('captcha2.jpg')
>>> print gate.get_multi([captcha_id1, captcha_id2])

If you want use bytes or base64:

# Per line binary example
>>> print AntiGate('API-KEY', fp.read())

# Per line base64 example
>>> print AntiGate('API-KEY', b64encode(fp.read()))

# Custom requests
>>> gate = AntiGate('API-KEY')

# base64
>>> captcha_id = gate.send(b64encode(fp.read()))

# or stream
>>> captcha_id = gate.send(fp.read())

>>> print gate.get(captcha_id)

Api documentation

https://anti-captcha.com/apidoc / http://antigate.com/?action=api#algo

Compatibility

  • Python: 2.6, 2.7, 3.3, 3.4, 3.5
Bitdeli badge

About

Wrapper for online service which provides real-time captcha-to-text decodings. http://anti-captcha.com/

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •