Skip to main content

A Python library for interacting with the Danbooru API

Project description

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.

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

aiodanbooru-1.1.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiodanbooru-1.1.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file aiodanbooru-1.1.1.tar.gz.

File metadata

  • Download URL: aiodanbooru-1.1.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for aiodanbooru-1.1.1.tar.gz
Algorithm Hash digest
SHA256 311d128b2082cfebd9f49fd071d2abc8c1665cad5baceb2ba5093af5f75e5a82
MD5 21016d6087ac0eec01e7f511a42cace9
BLAKE2b-256 59dade74d7f060ef317fbd1addd47c3f798a0aaf2d66bdcbd192a336040cfe76

See more details on using hashes here.

File details

Details for the file aiodanbooru-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: aiodanbooru-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for aiodanbooru-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd6b4b3ae3757299dea126a20aad0c254c58b58ac35318d74e2ce7f94379d566
MD5 eff8e46308312ebff0951c2ee7714ca2
BLAKE2b-256 de4d55c0f5ab2f193f660a2cd0d300f4a22580642af58d15b7567c55875fc9c0

See more details on using hashes here.

Supported by

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