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.3.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for tracemoe_py-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41491eb7a62449ac374b8daa4b939cf75cb1ff33a47f498543617c6548feeee7 |
|
MD5 | 2b57b3d9b631c8dec82a8aac3b457865 |
|
BLAKE2b-256 | a7f14c5500eabe34f592bb48197e791bd540821247ba28af067c8f7b03810e99 |