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()
Metadata
Release files for aio4chan 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aio4chan-0.0.0.tar.gz | 3.4 kB | Without provenance | Details for aio4chan-0.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aio4chan-0.0.0-py3-none-any.whl | Python 3 | none | any | Details for aio4chan-0.0.0-py3-none-any.whl |
Total release size: 7.6 kB
Release files / aio4chan-0.0.0.tar.gz
| Download URL | aio4chan-0.0.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cec2f933a27753b0f06e77fe2a12df337bfc61e75c4380ac13ecb5ac3f2e5697
|
|
BLAKE2b-256 checksum How to use checksums |
e0b1f71e42148d495fc114ac82afcd1e7b55dc0c5a844a176100e704e2e2c632
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Release files / aio4chan-0.0.0-py3-none-any.whl
| Download URL | aio4chan-0.0.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a9c6c01c41537782db44d0abf8ead9fc423207f6364712365b48ed56b320866
|
|
BLAKE2b-256 checksum How to use checksums |
f3c5bd14b7ad300dc0da6bf75f24b97ea589496d3adde786b85c47e57226eff5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Security for aio4chan 0.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.