Skip to main content

Synchronous API wrapper module for safebooru.orgimplemented in Python3.

Project description

Safebooru2

A module containing classes and methods for interacting with the safebooru.org public API. This is my second API wrapper module for safebooru.org, here's the link to that: https://github.com/boddz/safebooru it is one of my older projects, some things are poorly done, and I am bored so that's why this module is a thing.

For some more information about the safebooru.org API, you can find some official documentation: https://safebooru.org/index.php?page=help&topic=dapi

As safebooru.org is running a variant of Gelbooru, you can find a bit more documentation at: https://gelbooru.com/index.php?page=wiki&s=view&id=18780 Other parts of gelbooru.com are NSFW, so heads up.

To be released under the GNU GPLv3 licence, which can be found in the source directory, or with this link: https://www.gnu.org/licenses/gpl-3.0.en.html

Note

This is currently in early development, there will be a lot of changes.

This should in theory work perfectly fine with other similar booru sites that are using Gelbooru, however my main focus for this project is to target safebooru.org.

Setup

(Optional) I would first recommend setting up a virtual environment:

cd safebooru2
python3 -m venv venv  # Should work with most systems, might require install.
source venv/bin/activate  # Activate the venv.

Install from PyPI

pip install safebooru2

Install Manually

Ensure pip setuptools/ build are installed and up-to-date:

pip install --upgrade setuptools
pip install --upgrade build

Once done, build the package:

python -m build

Finally, install the generated .whl file with pip:

# Of course this file name may vary depending on versioning and such.
pip install --force-reinstall dist/safebooru2-1.0.0-py3-none-any.whl

No Install

If you don't want to have the package directly installed to site packages then just install the requirements and have fun:

pip install -r requirements.txt

Usage

At the moment, there aren't really any user friendly docs I have created for this, I have left some basic usage examples in the main.py file in the CWD. You can of course read through the src/safebooru2/safebooru.py file to get a feel for the module as well, I tried documenting everything in it to the best of my ability.

(I do plan on sitting down and creating some proper docs soon C:)

Testing

Once setup, you can run all tests directly by doing:

make test  # Provided GNU make is installed.

Or individual tests by doing:

python3 -m unittest tests/test_foo_bar.py

Contribution

Please checkout and target the devel branch if contributing anything.

Thanks.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

safebooru2-1.0.1.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

safebooru2-1.0.1-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file safebooru2-1.0.1.tar.gz.

File metadata

  • Download URL: safebooru2-1.0.1.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for safebooru2-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4e8ffb09ef919f8a6da6748e675f494c5fe65858a7fc4ffb1a536f3fa2166ccb
MD5 2220fbb78a5cf605d1cc2a60aedc7081
BLAKE2b-256 b49602f04430299c547b4252ff90a96314c8b537de7a153563875a2d5a488cc4

See more details on using hashes here.

File details

Details for the file safebooru2-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: safebooru2-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for safebooru2-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c06bf63c1090f64b0a46f13c189c9c1e86a6f039e831dfafef2610acc3680b1b
MD5 2ad07257a8cd22358c00460068450b08
BLAKE2b-256 a9dbc05c074e5d4b504c524c3500b7063896508ed68aab409821e48c70992d90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page