A minimal asynchronous API wrapper for trace.moe.
Python 3.6 or higher is required.
pip install tracemoe-py
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())
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())
Contributions are welcome! Feel free to open issues or submit pull requests!
MIT ยฉ IchBinLeoon