Skip to content
Deviant edited this page Dec 23, 2023 · 1 revision

Description:

The Tools class has auxiliary functions for developing bots and working with the module


How to use:

The Tools class takes no arguments

Update enkanetwork.py assets
from enkacard import enkatools
import asyncio

async def card():
    tools = enkatools.Tools()
    result = await tools.update_assets(path = None)
    
    return result

result = asyncio.run(card()) 

print(result)

path - By default None so it looks for the folder with installed enkanetwork.py.

It is advisable to install it manually, example path: C:\Users\USER_NAME\AppData\Local\Programs\Python\Python311\Lib\site-packages\enkanetwork\assets

Checking the Image
from enkacard import enkatools
import asyncio

async def card():
    tools = enkatools.Tools()
    result = await tools.is_valid_image(url = "https://i.pximg.net/img-master/img/2023/09/05/17/24/51/111467565_p0_master1200.jpg")
    
    return result

result = asyncio.run(card()) 

print(result)

You can also pass your parameters to the request using the headers type

Checking the Image Pixv
from enkacard import enkatools
import asyncio

async def card():
    tools = enkatools.Tools()
    headers = await tools.get_pixv_headers()
    result = await tools.is_valid_image(url = "https://i.pximg.net/img-master/img/2023/09/05/17/24/51/111467565_p0_master1200.jpg", headers = headers)
    
    return result

result = asyncio.run(card()) 

print(result)
Save custom image
from enkacard import enkatools
import asyncio

async def card():
    tools = enkatools.Tools()
    result = await tools.is_valid_image(img = "https://i.pximg.net/img-master/img/2023/09/05/17/24/51/111467565_p0_master1200.jpg", api_key = 'YOU_API_KEY')
    
    return result

result = asyncio.run(card()) 

print(result)

YOU_API_KEY - replace with the api_key obtained on this page: Get Api Key

banner

Clone this wiki locally