Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,7 @@ shared: &shared
if [ $UPLOAD_COV ]; then
codecov
fi

jobs:
py37:
<<: *shared
docker:
- image: circleci/python:3.7

py38:
<<: *shared
docker:
- image: circleci/python:3.8

py39:
<<: *shared
docker:
Expand All @@ -45,14 +34,18 @@ jobs:
<<: *shared
docker:
- image: circleci/python:3.10

py313:
<<: *shared
docker:
- image: circleci/python:3.13
environment:
UPLOAD_COV: "true"

workflows:
version: 2.1
main:
jobs:
- py37
- py38
- py39
- py310
- py313
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ venv/
ENV/
env.bak/
venv.bak/
.idea

# Spyder project settings
.spyderproject
Expand Down
7 changes: 5 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ version: 2
sphinx:
configuration: docs/conf.py

# Optionally set the version of Python and requirements required to build your docs
build:
os: "ubuntu-22.04"
tools:
python: "3.13"

python:
version: 3.7
install:
- requirements: docs/requirements-docs.txt
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.PHONY: all install nopyc clean test docs local
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quality of life improvements for you and anyone else trying to develop on this. Simply run make test and your dev env will be provisioned and tests run. make local will install the built version of the library in to your local pip cache. make docs, well, docs :).


SHELL := /usr/bin/env bash
PYTHON_BIN ?= python
PROJECT_VENV ?= venv

all: local test

venv:
$(PYTHON_BIN) -m pip install virtualenv --user
$(PYTHON_BIN) -m virtualenv $(PROJECT_VENV)

install: venv
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install .; \
)

nopyc:
find . -name '*.pyc' | xargs rm -f || true
find . -name __pycache__ | xargs rm -rf || true

clean: nopyc
rm -rf build dist *.egg-info $(PROJECT_VENV)

test: install
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install -r ext/requirements-dev.txt -r docs/requirements-docs.txt; \
coverage run -m unittest discover -s tests && coverage report && coverage xml && coverage html; \
)

docs: install
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install -r ext/requirements-dev.txt; \
sphinx-build -M html docs build/docs -n; \
)

local:
@rm -rf *.egg-info dist
@( \
$(PYTHON_BIN) -m pip install --upgrade pip; \
$(PYTHON_BIN) -m pip install --upgrade build; \
$(PYTHON_BIN) -m build; \
$(PYTHON_BIN) -m pip install dist/*.tar.gz; \
)
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ Pure Python, lightweight, [Pillow](https://github.com/python-pillow/Pillow)-base
![Timing](https://img.shields.io/badge/response%20time-0.2s-success)
[![Size](https://img.shields.io/badge/wheel%20size-0.9%20MB-informational)](https://pypi.org/project/amazoncaptcha/)
[![Version](https://img.shields.io/pypi/v/amazoncaptcha?color=informational)](https://pypi.org/project/amazoncaptcha/)
[![Python version](https://img.shields.io/badge/python-3.7%2B-informational)](https://pypi.org/project/amazoncaptcha/)
[![Python version](https://img.shields.io/badge/python-3.9%2B-informational)](https://pypi.org/project/amazoncaptcha/)
[![Downloads](https://img.shields.io/pypi/dm/amazoncaptcha?color=success)](https://pypi.org/project/amazoncaptcha/)

## Recent News
+ *July 14, 2025*: dropped support for Python 3.7 and 3.8, added support through Python 3.13 and Pillow 11
+ *May 5, 2023*: tested and approved compatibility with Pillow 9.5.0
+ *January 25, 2022*: tested and approved compatibility with Python 3.10
+ *January 25, 2022*: dropped support for Python 3.6
Expand Down
2 changes: 1 addition & 1 deletion amazoncaptcha/__version__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__title__ = 'amazoncaptcha'
__description__ = "Pure Python, lightweight, Pillow-based solver for the Amazon text captcha."
__url__ = 'https://github.com/a-maliarov/amazoncaptcha'
__version__ = '0.5.11'
__version__ = '0.5.12'
__author__ = 'Anatolii Maliarov'
__author_email__ = 'tly.mov@gmail.com'
__license__ = 'MIT'
Expand Down
5 changes: 3 additions & 2 deletions amazoncaptcha/devtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

This module contains the set of amazoncaptcha's devtools.
"""
from bs4 import BeautifulSoup

from .solver import AmazonCaptcha
from .exceptions import NotFolderError
Expand Down Expand Up @@ -51,14 +52,14 @@ def _extract_captcha_link(self, captcha_page):
"""Extracts a captcha link from an html page.

Args:
captcha_page (str): A page's html in string format.
captcha_page (Response): A page's html in string format.

Returns:
str: Captcha link.

"""

return captcha_page.text.split('<img src="')[1].split('">')[0]
return BeautifulSoup(captcha_page.text).select("img")[0]["src"]

def _extract_captcha_id(self, captcha_link):
"""
Expand Down
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

8 changes: 0 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@
# The full version, including alpha/beta/rc tags.
release = 'v0.4.7'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed with latest version of Sphinx


# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
Expand All @@ -89,7 +82,6 @@
# a list of builtin themes.

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed anymore with latest version of Sphinx


# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
16 changes: 9 additions & 7 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ Python Support

AmazonCaptcha supports the versions of Python according to the table below.

+-------------------------+--------+-------+-------+-------+-------+-------+
| **Python** |**3.10**|**3.9**|**3.8**|**3.7**|**3.6**|**3.5**|
+-------------------------+--------+-------+-------+-------+-------+-------+
| AmazonCaptcha >= 0.5.3 | Yes | Yes | Yes | Yes | No | No |
+-------------------------+--------+-------+-------+-------+-------+-------+
| AmazonCaptcha <= 0.5.2 | Yes | Yes | Yes | Yes | Yes | No |
+-------------------------+--------+-------+-------+-------+-------+-------+
+-------------------------+--------+--------+--------+--------+-------+-------+-------+-------+-------+
| **Python** |**3.13**|**3.12**|**3.11**|**3.10**|**3.9**|**3.8**|**3.7**|**3.6**|**3.5**|
+-------------------------+--------+--------+--------+--------+-------+-------+-------+-------+-------+
| AmazonCaptcha >= 0.5.12 | Yes | Yes | Yes | Yes | Yes | No | No | No | No |
+-------------------------+--------+--------+--------+--------+-------+-------+-------+-------+-------+
| AmazonCaptcha >= 0.5.3 | No | No | No | Yes | Yes | Yes | Yes | No | No |
+-------------------------+--------+--------+--------+--------+-------+-------+-------+-------+-------+
| AmazonCaptcha <= 0.5.2 | No | No | No | Yes | Yes | Yes | Yes | Yes | No |
+-------------------------+--------+--------+--------+--------+-------+-------+-------+-------+-------+

Basic Installation
------------------
Expand Down
35 changes: 0 additions & 35 deletions docs/make.bat

This file was deleted.

3 changes: 2 additions & 1 deletion docs/requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
-e .
Sphinx
sphinx-rtd-theme
9 changes: 5 additions & 4 deletions ext/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pillow ~= 9.5.0
requests ~= 2.30.0
pillow ~= 11.3
requests ~= 2.30
coverage >= 6.3.1
codecov >= 2.1.12
webdriver_manager ~= 3.8.6
selenium ~= 4.9.1
webdriver_manager ~= 4.0
selenium >= 4.34
beautifulsoup4 >= 4.13
23 changes: 14 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import setuptools
import os

#--------------------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------

here = os.path.abspath(os.path.dirname(__file__))

with open(os.path.join(here, 'amazoncaptcha', '__version__.py'), 'r', encoding='utf-8') as f:
file_data = [i.replace('\n', '').replace('\'', '').split(' = ') for i in f.readlines()]
about = {k: v for k, v in file_data}


def readme(logo_end_line=14):
"""Extracts the logo from README file before pushing to PyPi."""

Expand All @@ -19,12 +20,14 @@ def readme(logo_end_line=14):

return long_description

license = "MIT"

classifiers = [
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
"Natural Language :: English",
Expand All @@ -33,12 +36,14 @@ def readme(logo_end_line=14):
"Intended Audience :: Information Technology",
]

python_requires = ">=3.9"

requires = [
"pillow >= 9.0.1,< 9.6.0",
"requests >= 2.27.1,< 2.31.0"
"pillow >= 9.0.1",
"requests >= 2.27.1"
]

#--------------------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------

setuptools.setup(
name=about['__title__'],
Expand All @@ -61,4 +66,4 @@ def readme(logo_end_line=14):
},
)

#--------------------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------
4 changes: 2 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
from selenium.webdriver.chrome.service import Service

from amazoncaptcha import AmazonCaptcha, AmazonCaptchaCollector, ContentTypeError, NotFolderError, __version__
from webdriver_manager.chrome import ChromeDriverManager
from selenium import webdriver
import unittest
import sys
import os

#--------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -67,7 +67,7 @@ def test_fromdriver(self):
options = webdriver.ChromeOptions()
options.add_argument('no-sandbox')
options.add_argument('headless')
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
driver = webdriver.Chrome(service=Service(executable_path=ChromeDriverManager().install()), options=options)

solutions = list()
for i in range(5):
Expand Down