Catalog PyPI
Back to packageRELEASE DETAILS

0.0.0

PyPI

aio4chan

API wrapper for 4chan.

Published28 Nov 2018
Direct dependencies0
Transitive dependenciesNot calculated

README

Version 0.0.0 documentation

Contents

  • 4chan API reader.

Installing

python3 -m pip install aio4chan

Usage

import asyncio
import aiohttp
import aio4chan

loop = asyncio.get_event_loop()

session = aiohttp.ClientSession(loop = loop)

client = aio4chan.Client(session = session, loop = loop)

async def execute():

    """
    Traverse 4chan.
    """

    boards = await client.get_boards()

    # short names
    board_ids = (board.board for board in boards)

    for board_id in board_ids:

        pages = await client.get_threads(board_id)

        # list of pages, each containing threads
        thread_ids = (thread.no for page in pages for thread in page.threads)

        for thread_id in thread_ids:

            # need both board_id and thread_id
            thread = await client.get_thread(board_id, thread_id)

            for post in thread:

                try:

                    # might not exist
                    comment = post.com

                except AttributeError:

                    continue

                # print where we got it, and the comment
                print(board_id, '>', thread_id, '>', post.no, '\n', post.com)

try:

    loop.run_until_complete(execute())

except KeyboardInterrupt:

    pass

finally:

    loop.run_until_complete(session.close())

    loop.close()

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

2 collected
aio4chan-0.0.0-py3-none-any.whl

bdist_wheel · 4.14 KB · Python py3

Source file
aio4chan-0.0.0.tar.gz

sdist · 3.28 KB · Python source

Source file

Repository

PENDING
exahilosys/aio4chan

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:35 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:d3dff211e4c60c7c4a5fd38eb92a0fbf881ee7f69f536b771c118ca8ade58fd2

Other collected versions

View all collected versions →