Aiontai
Async wrapper for nhentai API
Installation
$ pip install aiontai
How to use
Create client
import asyncio
from aiohttp import ClientSession
from aiontai import (
NHentaiClient,
NHentaiAPI,
Conventer,
)
async def main() -> None:
client_object = NHentaiClient(
api=NHentaiAPI(
ClientSession(),
),
conventer=Conventer(),
)
asyncio.run(main())
Or can use injector that will create the object itself (Next examples will be using it)
import asyncio
from injector import Injector
from aiontai import (
NHentaiClient,
ClientModule,
)
async def main() -> None:
injector = Injector(ClientModule())
client_object = injector.get(NHentaiClient)
asyncio.run(main())
Example of using the client
async def main() -> None:
injector = Injector(ClientModule())
client_object = injector.get(NHentaiClient)
async with client_object as client: # Will close the session itself
doujin = await client.get_random_doujin()
for page in doujin.images:
print(page.url)
print(doujin.to_json())
asyncio.run(main())
Example of using the proxy
...
from injector import (
provider,
Injector,
Module,
)
from aiohttp_proxy import ProxyConnector # pip install aiohttp_proxy
...
class AiohttpProxyModule(Module):
def __init__(self, proxi_url: str) -> None:
self._proxi_url = proxi_url
@provider
def provide_client_session(self) -> ClientSession:
connector = ProxyConnector.from_url(self._proxi_url)
return ClientSession(connector=connector)
async def main() -> None:
injector = Injector(
modules=[
ClientModule(),
AiohttpProxyModule("http://user:password@127.0.0.1:1080"),
],
)
client_object = injector.get(NHentaiClient)
asyncio.run(main())
Example of using the Low level api
async def main() -> None:
injector = Injector(ClientModule())
client_object = injector.get(NHentaiAPI)
async with client_object as client:
doujin = await client.get_random_doujin() # Return: Dict[str, Any]
# from api without loss of information
print(doujin)
asyncio.run(main())
Metadata
Release files for aiontai 1.0.12
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 |
|---|---|---|---|---|
| aiontai-1.0.12.tar.gz | 8.0 kB | Without provenance | Details for aiontai-1.0.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiontai-1.0.12-py3-none-any.whl | Python 3 | none | any | Details for aiontai-1.0.12-py3-none-any.whl |
Total release size: 16.5 kB
Release files / aiontai-1.0.12.tar.gz
| Download URL | aiontai-1.0.12.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a250ea535f2ce33853c5fc7ca009dcf7474c4940ad2e7b91a499ec79e213c7e3
|
|
BLAKE2b-256 checksum How to use checksums |
9b2638a301ae6b8536302b794c0ed538848191bd6f16db57fd3b8a16246ef4e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.9.8 Linux/5.15.12-1-MANJARO
|
Release files / aiontai-1.0.12-py3-none-any.whl
| Download URL | aiontai-1.0.12-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44dd47c1d00d4ccf6633f9ec1d1f164d42c639c7f7aef0a0ce674e20fe97c519
|
|
BLAKE2b-256 checksum How to use checksums |
432621b25c88f85048d589607d0e162d62fdafbaeb2dac523fd300cd2266d66e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.9.8 Linux/5.15.12-1-MANJARO
|
Security for aiontai 1.0.12
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.