Skip to main content

Danbooru

PyPI License

Danbooru is a Python library that provides an easy-to-use interface for interacting with the Danbooru API. It allows you to search for posts, retrieve post details, and download media files from the Danbooru image board.

Features

  • Simple and intuitive API for interacting with the Danbooru API

  • Retrieve posts based on tags and limit

  • Download media files (images, videos) associated with the posts

  • Supports asynchronous requests using aiohttp

Installation

You can install Danbooru using pip:

pip install aiodanbooru

Usage

Here’s a simple example that demonstrates how to use the Danbooru library:

from aiodanbooru.api import DanbooruAPI


async def main():
    api = DanbooruAPI(base_url="https://danbooru.donmai.us")

    posts = await api.get_posts(tags=["cat_girl", "solo"], limit=10)
    if posts:
        post = posts[0]
        media_data = await post.get_media()
        with open(post.filename, "wb") as file:
            file.write(media_data)
        print("Media file saved!")


if __name__ == "__main__":
    import asyncio

    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

For more details and advanced usage examples, please refer to the documentation.

Contributing

Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue on the GitHub repository. Feel free to submit pull requests with improvements or fixes.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Release files for aiodanbooru 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiodanbooru 1.1.1
File Size Uploaded
aiodanbooru-1.1.1.tar.gz 7.9 kB Details

Built distribution (wheel)

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

Total release size: 15.6 kB

Release files / aiodanbooru-1.1.1.tar.gz

Download URL aiodanbooru-1.1.1.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
311d128b2082cfebd9f49fd071d2abc8c1665cad5baceb2ba5093af5f75e5a82
BLAKE2b-256 checksum
How to use checksums
59dade74d7f060ef317fbd1addd47c3f798a0aaf2d66bdcbd192a336040cfe76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / aiodanbooru-1.1.1-py3-none-any.whl

Download URL aiodanbooru-1.1.1-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd6b4b3ae3757299dea126a20aad0c254c58b58ac35318d74e2ce7f94379d566
BLAKE2b-256 checksum
How to use checksums
de4d55c0f5ab2f193f660a2cd0d300f4a22580642af58d15b7567c55875fc9c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.1

2 release files

1.0.0

2 release files

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