Skip to content

Commit afcefe4

Browse files
authored
RC v40.0.2 Merge pull request #43 from b3yc0d3/develop
## Fixed - Issue #42, credentials checking ## Added - Testing for credentials checking
2 parents a57365c + c8ed5b4 commit afcefe4

File tree

10 files changed

+81
-7
lines changed

10 files changed

+81
-7
lines changed

.github/actions/build-project/action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ runs:
1414
with:
1515
python-version: ${{ inputs.python-version }}
1616

17+
- name: Install lxml system deps (Linux only)
18+
shell: bash
19+
if: runner.os == 'Linux'
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install -y \
23+
libxml2-dev \
24+
libxslt1-dev \
25+
python3-dev \
26+
build-essential
27+
1728
- name: Install host python dependencies
1829
shell: bash
1930
run: |

.github/workflows/cd-master.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Build the project
2525
uses: ./.github/actions/build-project
2626
with:
27-
python-version: '3.x'
27+
python-version: '3.9'
2828

2929
gh-pages:
3030
needs: build
@@ -35,7 +35,7 @@ jobs:
3535
uses: actions/download-artifact@v4
3636
with:
3737
path: ./build
38-
pattern: build.*.Linux-py3.x
38+
pattern: build.*.Linux-py3.9
3939
merge-multiple: true
4040

4141
- name: Deploy to Github Pages

.github/workflows/ci-develop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python-version: ['3.x', '3.9']
19+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
2020
os: [ubuntu-latest, windows-latest]
2121

2222
name: Build ${{ matrix.os }}-py${{ matrix.python-version }}

.github/workflows/pr-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Set up python
3737
uses: actions/setup-python@v5
3838
with:
39-
python-version: '3.x'
39+
python-version: '3.9'
4040

4141
- name: Lint sources
4242
shell: bash

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [4.0.2] - 2025-12-22
9+
10+
### Fixed
11+
- API credentials checking from [Issue #42](https://github.com/b3yc0d3/rule34Py/issues/42)
12+
813
## [4.0.1] - 2025-08-31
914

1015
### Changed

CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Contributing
2+
3+
Thanks for taking an interest in contributing to the rule34Py project!
4+
5+
* This project's **canonical upstream** is at https://github.com/b3yc0d3/rule34Py.
6+
* File **bugs**, **enhancement requests**, and other **issues** to the GH issue tracker at https://github.com/b3yc0d3/rule34Py/issues.
7+
* See the [Developer Guide](https://b3yc0d3.github.io/rule34Py/dev/developer-guide.html) for information about how to **build** this project from source and run tests.
8+
9+
10+
## Submitting Changes
11+
12+
#. Base your development branch off of the [upstream](https://github.com/b3yc0d3/rule34Py/tree/develop) ``develop`` reference.
13+
14+
#. Before committing your changes, run the **project linter** using ``make``. It will use the ``ruff`` to lint all the project sources.
15+
16+
.. code-block:: bash
17+
18+
poetry install # Optional, if you have not done it previously.
19+
make lint
20+
21+
Fix or respond to any findings in the linter.
22+
23+
#. Run the project's test suite against your changes. Ensure that all tests pass.
24+
25+
.. code-block:: bash
26+
27+
poetry install # Optional, if you have not done it previously.
28+
make check
29+
30+
#. 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.
31+
32+
#. Fork the canonical upstream repository on github. \[[GitHub Docs](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo)\]
33+
34+
#. Push your development branch to your own fork. [Open a new Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) against the upstream `develop` ref.
35+
36+
#. Submit your PR. Respond to any PR build failures or feedback from the maintainers.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ maintainers = [
3030
]
3131
readme = "README.md"
3232
requires-python = ">=3.9, <4.0"
33-
version = "4.0.1"
33+
version = "4.0.2"
3434

3535

3636
[project.urls]

rule34Py/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# rule34Py - Python api wrapper for rule34.xxx
22
#
3-
# Copyright (C) 2022-2024 b3yc0d3 <b3yc0d3@gmail.com>
3+
# Copyright (C) 2022-2025 b3yc0d3 <b3yc0d3@gmail.com>
44
#
55
# This program is free software: you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License as published by

rule34Py/rule34.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def _get(self, *args, **kwargs) -> requests.Response:
138138
is_api_request = args[0].startswith(__api_url__) == True
139139

140140
# check if api credentials are set
141-
if is_api_request and self.user_id == None and self.api_key == None:
141+
if is_api_request and self.user_id == None or self.api_key == None or (self.user_id == None and self.api_key == None):
142142
raise ValueError(
143143
"API credentials must be supplied, api_key and user_id can not be None!\nSee https://api.rule34.xxx/ for more information."
144144
)

tests/unit/test_rule34Py.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,25 @@ def test_rule34Py_top_tags(rule34):
250250
assert isinstance(top_tags, list)
251251
assert len(top_tags) == 100
252252
assert isinstance(top_tags[0], TopTag)
253+
254+
def test_rule34Py_api_key(rule34):
255+
rule34.api_key = None
256+
with pytest.raises(ValueError) as execinfo:
257+
rule34.top_tags()
258+
259+
assert str(execinfo.value) == "API credentials must be supplied, api_key and user_id can not be None!\nSee https://api.rule34.xxx/ for more information."
260+
261+
def test_rule34Py_user_id(rule34):
262+
rule34.user_id = None
263+
with pytest.raises(ValueError) as execinfo:
264+
rule34.top_tags()
265+
266+
assert str(execinfo.value) == "API credentials must be supplied, api_key and user_id can not be None!\nSee https://api.rule34.xxx/ for more information."
267+
268+
def test_rule34Py_credentials(rule34):
269+
rule34.api_key = None
270+
rule34.user_id = None
271+
with pytest.raises(ValueError) as execinfo:
272+
rule34.top_tags()
273+
274+
assert str(execinfo.value) == "API credentials must be supplied, api_key and user_id can not be None!\nSee https://api.rule34.xxx/ for more information."

0 commit comments

Comments
 (0)