Skip to main content

An asynchronous wrapper for the Hypixel API.

Project description

PyPixel

Discord Server Invite PyPI version info PyPI supported Python versions

Discord Server Invite PyPI Version Info PyPI supported Python versions

An asynchronous wrapper for the Hypixel API.

Installation

Python 3.6 or higher is required

You can install the package with the following command.

# Linux/macOS
python3 -m pip install -U pypixel-api

# Windows
py -3 -m pip install -U pypixel-api

A few examples

Getting a player.

# Import the module
import PyPixel
# Importing asyncio so we can run our coroutine
import asyncio

# Initialize the Hypixel class
hypixel = PyPixel.Hypixel(api_key='YOUR_API_KEY')

async def getPlayer():
    # Gets a player by UUID. For this example, we'll use mine.
    player = await hypixel.get_player('c7b08e0c73c94750b7780841025f40d4')

    print(player.name)
    print(player.uuid)
    print(player.rank) 

# Run the above coroutine
loop = asyncio.get_event_loop()
loop.run_until_complete(getPlayer())

"""
Output:

awsomo28
c7b08e0c73c94750b7780841025f40d4
MVP+
"""

Getting a guild

# Import the module
import PyPixel
# Importing asyncio so we can run our coroutine
import asyncio


# Initialize the Hypixel class
hypixel = PyPixel.Hypixel(api_key='YOUR_API_KEY')

async def getGuild():
    # Gets a player by UUID. For this example, we'll use mine.
    guild = await hypixel.get_guild('SkyKings', 'name')

    print(guild.name)
    print(guild.members[0].rank)
    print(guild.level)


# Run the above coroutine
loop = asyncio.get_event_loop()
loop.run_until_complete(getGuild())


"""
Output:

SkyKings
GUILDMASTER
98
"""

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

pypixel-api-0.1.3.tar.gz (11.4 kB view hashes)

Uploaded Source

Built Distribution

pypixel_api-0.1.3-py3-none-any.whl (22.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page