Skip to main content

PyRule34 GitHub

Р СѓСЃСЃРєРёР№ | English

This is a lightweight asynchronous library for the rule34 API

Install Downloads

The library requires Python 3.5 or higher

  • Latest version on PyPI: 1.1.0
pip install -U pyrule34

Usage

Importing required libraries

import asyncio
from pyrule34 import AsyncRule34

AsyncRule34 can be used as a context manager:

#example
async def main():
    async with AsyncRule34() as r34:
        get_posts = await r34.get_posts(4931536)
        
        print(get_posts[0].tags)
        
loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Search

Search for posts using specified inclusion and exclusion tags.

Returns a list.

Parameters:

  • tags - The include tags
  • exclude_tags - The exclude tags (default: None)
  • limit - The (maximum) limit to get posts. Maximum 1000 per one request (default: 100)
  • page_id - The page number (default: 0)
search = await r34.search(tags=["neko"], exclude_tags=["rating:general"], page_id=2, limit=1)

Post

Retrieve post(s) by ID or MD5 hash.

Returns a list.

Parameters:

  • posts_id: The list of IDs posts or post ID
  • md5: The MD5 hash of the post (default: None)
get_posts = await r34.get_posts(4931536)

Comments on the post

Get comments by post ID.

Returns a list.

Parameters:

  • post_id: The ID of the post
get_post_comments = await r34.get_post_comments(4153825)

Random post

Get a random post.

Returns a dict.

get_random_post = await r34.get_random_post()

Pool

Get Pool by ID.

Returns a list.

Parameters:

  • cid: Pool ID
  • offset: offset (default: 0) | 1 page - 45
get_pool = await r34.get_pool(29619)

User Favorites

Get user's favorites by ID.

Returns a list.

Parameters:

  • user_id: user ID
  • offset: offset (default: 0) | 1 page - 50
favorite = await r34.users.favorites(2993217)

Top 100 characters and tags

Get the top 100 characters or tags.

Returns a list.

top_character = await r34.top_characters()
top_tags = await r34.top_tags()

Top users

Get the top 10 best users by tags, comments, etc.

Returns a list.

taggers = await r34.stats.taggers()
favorites = await r34.stats.favorites()
commenters = await r34.stats.commenters()
forum_posters = await r34.stats.forum_posters()
image_posters = await r34.stats.image_posters()
note_editors = await r34.stats.note_editors()

Download files

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

Source Distribution

pyrule34-1.1.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

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

pyrule34-1.1.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file pyrule34-1.1.0.tar.gz.

File metadata

  • Download URL: pyrule34-1.1.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pyrule34-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f39158d40b9d76a352958b2c337053ea01122f02ce7fac4a9cad0b091d6808a9
MD5 1bf58da83855fd79783fe8ce89935a21
BLAKE2b-256 2634c2d25c19c050d9645f674c16e268a9315198b50f93dacb2f761e708826f2

See more details on using hashes here.

File details

Details for the file pyrule34-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyrule34-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pyrule34-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06e1209930769e19c92dafe654c6433bf9c45a9c5915b9d917ea719e94102478
MD5 6cc2bdd1b6375c03f45215e062237fe9
BLAKE2b-256 942d5a58b768950072a142075810f385d6d450d166a9e806359640ebda91d94a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.0

2 files

Supported by

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