Skip to main content

The motivation behind the 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. I desire 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 Amazon's text captcha (compatible with Python 3.9)

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

Browsing Amazon using selenium and stuck on captcha? The class method below will do all the "dirty" work of extracting an image from the 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.fromdriver(driver)
solution = captcha.solve()

If you are not using selenium or the previous method is not just the case for you, it is possible to use a captcha link directly. This class method will request the url, check the content type and store the response content into bytes array to create an instance of AmazonCaptcha.

from amazoncaptcha import AmazonCaptcha

link = 'https://images-na.ssl-images-amazon.com/captcha/usvmgloq/Captcha_kwrrnqwkph.jpg'

captcha = AmazonCaptcha.fromlink(link)
solution = captcha.solve()

In addition, if you are a machine learning or neural network developer and are looking for some training data, check this repository, which was created to store images and other non-script data for the solver.

Help the Development

If you are willing to help the development, consider setting keep_logs argument of the solve method to True. Here is the example, if you are using fromdriver class method. If set to True, all the links of the unsolved captcha will be stored, so later you can open the issue and send the logs.

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.fromdriver(driver)
solution = captcha.solve(keep_logs=True)

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

  • 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 needs.
  • If you are facing any errors, please, report your situation via an issue.
  • This project is for educational and research purposes only. Any actions and/or activities related to the material contained on this GitHub Repository is solely your responsibility. The author will not be held responsible in the event any criminal charges be brought against any individuals misusing the information in this GitHub Repository to break the law.

Metadata

Release files for amazoncaptcha 0.4.5

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.4.5
File Size Uploaded Provenance Actions
amazoncaptcha-0.4.5.tar.gz 873.5 kB Without provenance Details for amazoncaptcha-0.4.5.tar.gz

Built distribution (wheel)

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

Total release size: 1.8 MB

Release files / amazoncaptcha-0.4.5.tar.gz

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

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

Download URL amazoncaptcha-0.4.5-py3-none-any.whl
Size 934.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f7b9d8fc189dba9d2b69239a82aa7b892a65633eabfa68a2724683d7315e3e5
BLAKE2b-256 checksum
How to use checksums
1448d0fd111c35059feffb586228fc0ebbd8b3a5bda5ab976185e8373de0d03f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.44.0 CPython/3.7.4

Security for amazoncaptcha 0.4.5

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.4.5 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