Skip to main content

antigate.com/anti-captcha.com 的简易包装器

项目描述

实时验证码到文本解码
=====================================

.. image:: https ://api.travis-ci.org/gotlium/antigate.png?branch=master
:alt: 构建状态
:target: https://travis-ci.org/gotlium/antigate
.. 图片:: https:// coveralls.io/repos/gotlium/antigate/badge.png?branch=master
:target: https://coveralls.io/r/gotlium/antigate?branch=master
.. 图片:: https://img.shields。 io/badge/python-2.6,2.7,3.3,3.4,3.5-blue.svg
:alt:Python 2.6、2.7、3.3、3.4、3.5
:目标:https: //pypi.python.org/pypi/antigate/
。 . image:: https://img.shields.io/pypi/v/antigate.svg
:alt: PyPi 上的当前版本
:target:https://pypi.python.org/pypi/antigate/
.. image:: https://img.shields.io/pypi/dm/antigate.svg
:alt: 从 PyPi 下载
:target:https://pypi.python.org/pypi/antigate/
.. image:: https://img.shields.io/badge/license-GPLv2-green.svg
:target: https://pypi.python.org/pypi/antigate/
:alt: 提供许可证



文档`这里 <https://pythonhosted .org/antigate/>`_.


安装
------------

来自源代码:

.. code-block:: bash

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

$ cd antigate && python setup.py install

From PyPi:

.. code-block:: bash

$ pip install antigate


**要求:**

你可以使用 grab/requests/urllib 作为 http 后端。

`Grab` 安装:

.. code-block:: bash

pip install grab pycurl


`Requests` 安装:

.. code-block:: bash

pip install requests


`UrlLib` 默认使用。


用法
-----

.. code-block:: python

>>> 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' )
>>> 打印门。




.. code-block:: python

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

所有操作后,你可以得到你的账户余额:

.. code-block:: python

>>> print gate.balance()


或者得到你的统计数据:

.. code-block:: python

>> > print gate.stats()


系统加载信息:

.. code-block:: python

>>> print gate.load()


自定义对 API 的请求
------------------ ---------

自定义grab-lib首选项:

.. code-block:: python

>>>从反门进口 AntiGate
>>> config = {'connect_timeout': 5, 'timeout': 60}
>>> gate = AntiGate('API-KEY', 'captcha.jpg', grab_config=config)
>>> print gate

发送的附加选项验证码:

.. 代码块:: python

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

手动使用所有方法:

.. code-block:: python

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

获取多个 id 的结果:

.. code-block:: python

>>> 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 to use bytes or base64:

.. code-block:: python

# Per line二进制示例
>>> print AntiGate('API-KEY', fp.read())

# 每行 base64 示例
>>> print AntiGate('API-KEY', b64encode(fp.read()))

# 自定义请求
> >> 门 = AntiGate('API-KEY')

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

# 或流
>>> captcha_id = gate.send(fp.read())

>>> print gate.get(captcha_id)


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


兼容性
-------------
* Python: 2.6、2.7、3.3、3.4、3.5


.. 图像: : https://d2weczhvl823v0.cloudfront.net/gotlium/antigate/trend.png
:alt: Bitdeli 徽章
:target: https://bitdeli.com/free

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

antigate-1.4.0.tar.gz (5.6 kB 查看哈希)

已上传 source

内置分布

antigate-1.4.0-py2-none-any.whl (8.8 kB 查看哈希)

已上传 2 7