Skip to main content

Motivation behind creation of this library is taking its start from the genuinely simple idea: "I don't want to use pytesseract or some other non-amazon-specific OCR services, nor do I want to install some executables to just solve a captcha. My desire is to get a solution within 1-2 lines of code without any heavy add-ons. Using a pure Python."


Pure Python, lightweight, Pillow-based solver for the Amazon's text captcha.

Accuracy Timing Size Version Python version Downloads

Installation

pip install amazoncaptcha

Quick Snippet

from amazoncaptcha import AmazonCaptcha

captcha = AmazonCaptcha('captcha.jpg')
solution = captcha.solve()

# Or: solution = AmazonCaptcha('captcha.jpg').solve()

Status

Status Build Status codecov Requirements Status CodeFactor Grade Implementation

Usage

For data extraction or web scraping specialists, who is crawling Amazon by using selenium, the classmethod below will do all the "dirty" work of extracting an image from webpage for you. Practically, it takes a screenshot from your webdriver, crops the captcha and stores it into bytes array, which is then used to create an AmazonCaptcha instance. This also means avoiding any local savings.

from amazoncaptcha import AmazonCaptcha
from selenium import webdriver

driver = webdriver.Chrome() # This is a simplified example
driver.get('https://www.amazon.com/errors/validateCaptcha')

captcha = AmazonCaptcha.from_webdriver(driver)
solution = captcha.solve()

On the other hand, if you are machine learning or neural networks developer and are looking for some training data, firstly check the captchas folder. It currently contains 13000 solved captchas with unique patterns. For more solved images, consider using AmazonCaptchaCollector instance with a really simple API sampled below. An image will be stored, only if there is a 100% answer. However, if you've noticed a wrong solution, please, create an issue using corresponding template.

from amazoncaptcha import AmazonCaptchaCollector

output_folder = '/path/to/output/folder' # where you want to store captchas
target = 100000 # final number of solved captchas you want to get
processes = 10 # number of simultaneous processes

if __name__ == '__main__':
    collector = AmazonCaptchaCollector(output_folder = output_folder)
    collector.start(target = target, processes = processes)

If you have any suggestions or ideas of additional instances and methods, which you would like to see in this library, please, feel free to contact the owner via email or fork'n'pull to repository. Any contribution is highly appreciated!

Additional

  • Just FYI, pip will install only module itself. However, if you are using git clone, be aware that you will also clone 50 MB of captchas, currently located in the repository.
  • If you want to see the History of Changes, Code of Conduct, Contributing Policy or License, use these inline links to navigate based on your need.
  • If you are facing any errors, please, report your situation via an issue.

Metadata

Release files for amazoncaptcha 0.3.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amazoncaptcha 0.3.10
File Size Uploaded Provenance Actions
amazoncaptcha-0.3.10.tar.gz 871.4 kB Without provenance Details for amazoncaptcha-0.3.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for amazoncaptcha 0.3.10
File Interpreter ABI Platform Actions
amazoncaptcha-0.3.10-py3-none-any.whl Python 3 none any Details for amazoncaptcha-0.3.10-py3-none-any.whl

Total release size: 1.8 MB

Release files / amazoncaptcha-0.3.10.tar.gz

Download URL amazoncaptcha-0.3.10.tar.gz
Size 871.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4e8b887f0407f8f601df8f72b0fb022e0d112aa24748924758ed7fdba923888f
BLAKE2b-256 checksum
How to use checksums
4df5661f9a1b89957b6e4b7deeff674c1b17f8558a5d8d5263f099582e98847d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.44.0 CPython/3.7.4

Release files / amazoncaptcha-0.3.10-py3-none-any.whl

Download URL amazoncaptcha-0.3.10-py3-none-any.whl
Size 931.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8568775d5a679b4fdc4ea2e0bf0c0c0550f112f79f627cd66afb5a4ee401be01
BLAKE2b-256 checksum
How to use checksums
b68a0e21d8a2ed677a81dc4e09066908f138fc3f7df2d59702cbdaa456e837be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.44.0 CPython/3.7.4

Security for amazoncaptcha 0.3.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page