Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2fa6d9f
Move __vars__ content into other modules
ripariancommit Jun 14, 2025
c9601dd
__init__: make author and email simple strings
ripariancommit Jun 14, 2025
1b6d44b
Use poetry as the centralized env and build tool
ripariancommit Jun 15, 2025
72fc4d8
Use sphinx linkcheck to validate docs links
ripariancommit Jun 15, 2025
28d8050
tests/unit: add test_package
ripariancommit Jun 15, 2025
7137722
Remove module metadata and rule34Py.version()
ripariancommit Jun 15, 2025
51deab7
.gitignore: remove unused ignores
ripariancommit Jun 15, 2025
a5da5c5
Merge pull request #31 from ripariancommit/dev/poetry
b3yc0d3 Jul 19, 2025
b767540
Merge pull request #32 from ripariancommit/dev/gitignore
b3yc0d3 Jul 19, 2025
18b1856
feat: complete and refactor autocomplete functionality
reclacc Jul 24, 2025
ed3b353
Fixes linting issues (D100, D205, D410, D411) and adds proper module …
reclacc Jul 31, 2025
10696b7
Merge pull request #33 from reclacc/feature/autocomplete
b3yc0d3 Aug 6, 2025
81a5ec7
added dist/ folder to black list
b3yc0d3 Aug 24, 2025
b6dd88f
implements a way to set api_key and user_id
b3yc0d3 Aug 30, 2025
2ac5412
added guide to receiving and setting api credentials
b3yc0d3 Aug 30, 2025
073ac6f
updated unit tests and added check for url api parameters
b3yc0d3 Aug 30, 2025
04a2b68
fixed example in README.md and fixed download.py tutorial
b3yc0d3 Aug 30, 2025
bfb38b7
fixed code example in rst docstring of rule34Py class and exclude pri…
b3yc0d3 Aug 30, 2025
11dbbcf
fixed blank line after docstring
b3yc0d3 Aug 30, 2025
8443311
Merge pull request #36 from b3yc0d3/fix/api-change-credentials which …
b3yc0d3 Aug 30, 2025
9522998
updated CHANGELOG
b3yc0d3 Aug 30, 2025
6ca9430
added parameter to search method for excluding ai generated content
b3yc0d3 Aug 30, 2025
8a532ee
added parameter to search method for excluding ai generated content
b3yc0d3 Aug 30, 2025
efef38d
fixed typo in search function docstring
b3yc0d3 Aug 30, 2025
d10c6ee
Merge pull request #37 from b3yc0d3/feature/ai-filter
b3yc0d3 Aug 30, 2025
e823471
added build status badge to README.md
b3yc0d3 Aug 30, 2025
e2b9784
updated version number in pyproject.toml
b3yc0d3 Aug 30, 2025
36441eb
updated CHANGELOG
b3yc0d3 Aug 30, 2025
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
8 changes: 3 additions & 5 deletions .github/actions/build-project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ runs:
- name: Install host python dependencies
shell: bash
run: |
python -m pip install --upgrade setuptools build
python -m pip install . .[dev] .[docs] .[test]
pip freeze \
--exclude rule34Py \
>build/requirements.txt
pipx install poetry
poetry self update
poetry install

- name: Build wheel and dist
shell: bash
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ jobs:
- name: Run unit tests
shell: bash
run: |
python -m pip install .[test]
make check
4 changes: 3 additions & 1 deletion .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ jobs:
- name: Lint sources
shell: bash
run: |
python -m pip install .[dev]
pipx install poetry
poetry self update
poetry install
make lint
158 changes: 6 additions & 152 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,163 +1,17 @@
publish.sh
debug*
__pycache__
setup.py
LICENSE.txt
stats.py
rule34Py_old.py

# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
**/__pycache__
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
/build
**/*.egg-info

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
pytestdebug.log

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
doc/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
#poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
# .env
.env/
.venv/
env/
venv/
ENV/
env.bak/
venv.bak/
pythonenv*

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# operating system-related files
# file properties cache/storage on macOS
*.DS_Store
# thumbnail cache on Windows
Thumbs.db

# profiling data
.prof


# End of https://www.toptal.com/developers/gitignore/api/python
**/.pytest_cache

# Ruff
**/.ruff_cache
dist/
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [4.0.0] - 2025-08-31

### Added
- Added a `rule34Py.autocomplete` method.
- Added `AutocompleteTag` class.
- Added parameter to `rule34Py.search` method for excluding ai generated content.
- Added unit test

### Changed
- Updated API wrapper to support website’s new authentication system.
- The underlying website API now **requires authentication** (`api_key` and `user_id`) for all requests.
- Updated unit tests.

## [3.0.0] - 2025-06-09

### Added
Expand Down
35 changes: 21 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ PROJECT = $(shell $(PYTHON3) scripts/read_pyproject.py project/name | tr 'A-Z' '
VERSION = $(shell $(PYTHON3) scripts/read_pyproject.py project/version)

# Binaries
PYTHON3 ?= python3
PYTEST = $(PYTHON3) -m pytest
PYTHON_BUILD = $(PYTHON3) -m build
RUFF = $(PYTHON3) -m ruff
SPHINX = $(PYTHON3) -m sphinx
TWINE = $(PYTHON3) -m twine
POETRY ?= poetry $(POETRY_ARGS)
POETRY_ARGS ?=
PYTHON3 ?= $(POETRY) run python3

PYTEST = $(POETRY) run pytest $(PYTEST_ARGS)
PYTEST_ARGS ?=
RUFF = $(POETRY) run ruff
SPHINX_BUILD = $(POETRY) run sphinx-build

# Source files
builddir ?= build
Expand Down Expand Up @@ -38,25 +40,25 @@ htmldir ?= $(docdir)/html
################

$(wheels) &: $(dist_files)
$(PYTHON_BUILD) --outdir $(builddir) --wheel
$(POETRY) build --output $(builddir) --format=wheel


$(sdist) : $(dist_files)
$(PYTHON_BUILD) --outdir $(builddir) --sdist
$(POETRY) build --output $(builddir) --format=sdist


# PHONY TARGETS #
#################

# Build all binary targets necessary for installation.
# Does not build documentation or source distributions.
all : $(wheels)
all : $(wheels) $(sdist)
.PHONY : all


# Run pre-installation tests on the built artifacts.
check : all
PYTHONPATH=$(builddir)/lib $(PYTEST) tests/unit/
PYTHONPATH=. $(PYTEST) tests/unit/
.PHONY : check


Expand All @@ -75,19 +77,24 @@ dist : $(sdist)

# Check and publish the python package index artifacts.
publish : $(sdist) $(wheels)
$(TWINE) check $(^)
$(TWINE) upload $(^)
$(POETRY) publish --dist-dir=$(builddir)
.PHONY : publish


# Build the project's HTML documentation.
html :
$(SPHINX) --builder html docs $(builddir)/html
$(SPHINX_BUILD) --builder html docs $(builddir)/html
.PHONY : html


linkcheck :
$(SPHINX_BUILD) --builder linkcheck docs $(builddir)/linkcheck
.PHONY : linkcheck


# Lint the project source for quality.
lint :
lint : linkcheck
$(POETRY) check --strict
$(RUFF) check $(srcdir)
.PHONY : lint

Expand Down
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# rule34py

![GPL-3.0](https://img.shields.io/github/license/b3yc0d3/rule34Py) [![](https://img.shields.io/pypi/v/rule34Py)](https://pypi.org/project/rule34Py/) [![](https://img.shields.io/pypi/dm/rule34py?color=blue)](https://pypi.org/project/rule34Py/)
![Build Status](https://img.shields.io/github/actions/workflow/status/b3yc0d3/rule34Py/cd-master.yml) ![GPL-3.0](https://img.shields.io/github/license/b3yc0d3/rule34Py) [![](https://img.shields.io/pypi/v/rule34Py)](https://pypi.org/project/rule34Py/) [![](https://img.shields.io/pypi/dm/rule34py?color=blue)](https://pypi.org/project/rule34Py/)

Python API wrapper for [rule34.xxx](https://rule34.xxx/).
</div>
Expand All @@ -24,28 +24,30 @@ See the [Developer Guide](https://b3yc0d3.github.io/rule34Py/dev/developer-guide

```python
from rule34Py import rule34Py
r34Py = rule34Py()
client = rule34Py()
client.api_key = "YOUR_API_KEY"
client.user_id = "YOUR_USER_ID"

# Get comments of an post.
r34Py.get_comments(4153825)
client.get_comments(4153825)

# Get post by its id.
r34Py.get_post(4153825)
client.get_post(4153825)

# Get top 100 icame.
r34Py.icame()
client.icame()

# Search for posts by tag(s).
r34Py.search(["neko"], page_id=2, limit=50)
client.search(["neko"], page_id=2, limit=50)

# Get pool by id.
r34Py.get_pool(28)
client.get_pool(28)

# Get a random post.
random = r34Py.random_post()
random = client.random_post()

# Get just a random post ID.
random_id = r34Py.random_post_id()
random_id = client.random_post_id()
```


Expand Down
Binary file added docs/_static/api-credentials.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

# sphinx.ext.autodoc configuration #
autodoc_default_options = {
"private-members": False
}
autodoc_typehints = "both" # Show typehints in the signature and as content of the function or method

Expand All @@ -53,6 +54,13 @@
"requests": ("https://requests.readthedocs.io/en/latest/", None),
}

## Sphinx linkcheck options
linkcheck_ignore = [
r"https?://.*gnu.org(:\d+)?[/$]?.*", # GNU.org is heavily rate limited
r"https?://localhost(:\d+)?[/$]?.*", # Broken unless the dev is hosting a server.
r"https?://rule34.xxx(:\d+)?[/$]?.*", # Interactive site will always 403
]



# -- Options for HTML output -------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions docs/dev/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Thanks for taking an interest in contributing to the rule34Py project!

* This project's **canonical upstream** is at https://github.com/b3yc0d3/rule34Py.
* File **bugs**, **enhancement requests**, and other **issues** to the GH issue tracker at https://github.com/b3yc0d3/rule34Py/issues.
* See the `Developer Guide <./developer-guide.html>`_ for information about how to **build** this project from source and run tests.
* See the :doc:`Developer Guide <./developer-guide>` for information about how to **build** this project from source and run tests.


Submitting Changes
Expand All @@ -18,7 +18,7 @@ Submitting Changes

.. code-block:: bash

pip install .[dev]
poetry install # Optional, if you have not done it previously.
make lint

Fix or respond to any findings in the linter.
Expand All @@ -27,7 +27,7 @@ Submitting Changes

.. code-block:: bash

pip install .[test]
poetry install # Optional, if you have not done it previously.
make check

#. Write a good commit message. If you are unsure of how, `this cbeams article <https://cbea.ms/git-commit/>`_ gives reasonable suggestions. Commit your changes.
Expand Down
Loading
Loading