Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

xMistt/snailapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

snailapi

Fully Asynchronous Python wrapper for Snail API.

This repository is archived due to the fact that SnailAPI shut down mid 2020 & hasn't came back since. Thanks to anyone who used the package!


Downloads Requires: Python 3.x BenBot Version: 1.0.1

Installing:

Windows: py -3 -m pip install snailapi
Linux/macOS: python3 -m pip install snailapi

After installing, you can check out the documentation for snailapi here.

Example:

import snailapi
import asyncio

snail = snailapi.APIClient()


async def main() -> None:
    shop = await snail.get_shop()

    print('=== FEATURED ===')
    for item in shop.featured:
        print(f'{item.name}: {item.price} V-Bucks')
        
    print('=== DAILY ===')
    for item in shop.featured:
        print(f'{item.name}: {item.price} V-Bucks')


loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

fortnitepy example:

import fortnitepy
import BenBotAsync
import snailapi

snail = snailapi.APIClient()

client = fortnitepy.Client(
    auth=fortnitepy.EmailAndPasswordAuth(
        email='example@email.com',
        password='password123'
    )
)


@client.event
async def event_friend_message(message: fortnitepy.FriendMessage) -> None:
    args = message.content.split()
    split = args[1:]
    content = " ".join(split)

    if args[0] == '!skin':
        try:
            skin = await snail.cosmetics.search_cosmetics(
                name=content
            )
            
            await client.user.party.me.set_outfit(asset=skin[0].id)
            await message.reply('Skin set to: {skin[0].name}.')
        except snailapi.exceptions.NotFound:
            await message.reply('Failed to find skin with the name: {content}.')


client.run()