A minimal asynchronous API wrapper for trace.moe
Project description
tracemoe-py
A minimal asynchronous API wrapper for trace.moe.
Installation
Python 3.6 or higher is required.
pip install tracemoe-py
Usage
import asyncio
from tracemoe import TraceMoe
async def main():
async with TraceMoe() as tracemoe:
# Search by image URL
results: list = await tracemoe.search('https://XXX/XXX.jpg')
print(results)
# Search by image upload
results: list = await tracemoe.search(open('/home/ichbinleoon/XXX.jpg', 'rb'))
print(results)
# Get account info
info: dict = await tracemoe.me()
print(info)
asyncio.run(main())
Advanced Usage
import asyncio
import aiohttp
from tracemoe import TraceMoe
async def main():
# Use an API key
tracemoe = TraceMoe(api_key='Your API key')
# Cut black borders
results: list = await tracemoe.search('https://XXX/XXX.jpg', cut_borders=True)
print(results)
# Filter by AniList ID
results: list = await tracemoe.search('https://XXX/XXX.jpg', anilist_id=11617)
print(results)
# Include AniList info
results: list = await tracemoe.search('https://XXX/XXX.jpg', anilist_info=True)
print(results)
await tracemoe.close()
# Use your own aiohttp session
session = aiohttp.ClientSession()
tracemoe = TraceMoe(session=session)
# ...
await tracemoe.close()
asyncio.run(main())
Contribute
Contributions are welcome! Feel free to open issues or submit pull requests!
License
MIT © IchBinLeoon
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
tracemoe-py-1.0.2.tar.gz
(4.5 kB
view details)
Built Distribution
File details
Details for the file tracemoe-py-1.0.2.tar.gz
.
File metadata
- Download URL: tracemoe-py-1.0.2.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9501db8369a812c1c661e5a99a8a2e47b98dc82df680e9b63668e14073640e13 |
|
MD5 | 8f014af53ebcb10e333da1b04e20065c |
|
BLAKE2b-256 | eb4eca6f0dcd9b2cc4d136555ebf9a4662535ed833b9b647fe6a6f9f436d8267 |
File details
Details for the file tracemoe_py-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: tracemoe_py-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 361e43cf2bcccc6ce0b2f2b17f85b239c40edaf68804f601fe30c3606d185e0d |
|
MD5 | 5f344649f0ab58fb19bc8d7a38e8aee6 |
|
BLAKE2b-256 | b0aebc09f398227cf155533a8acd4bfbccdcfaf2b2b86fc55ebddbed2cda513e |