An asynchronous MInecraft server votifier client in Python
Project description
Aio-Votifier
An asynchronous MInecraft server votifier client in Python
Example Usage:
from aiovotifier import VotifierClient
import asyncio
async def main():
client = VotifierClient("127.0.0.1", 8192, "testservicename", "token/rsa key")
# VotifierClient.vote(...) automatically determines the protocol and key format
await client.vote("username", "user address")
await client.vote("user2")
await client.v1_vote("username", "user address") # only supports v1 protocol
await client.nu_vote("username", "user address") # only supports NuVotifier/v2 protocol
asyncio.run(main())
Documentation
class aiovotifier.VotifierClient(host: str, port: int, service_name: str, secret: str)
- Arguments:
host: str
- The hostname or IP of the votifier serverport: int
- The port of the votifier server, commonly 8192service_name: str
- The name of the service that sends the votesecret: str
- The public RSA key or the token found inconfig.yml
- Methods:
vote(username: str, user_address: str = "127.0.0.1")
- sends a vote to the votifier server, automatically detects and handles the protocol and type of secretv1_vote(username: str, user_address: str = "127.0.0.1")
- sends a Votifier v1 vote to a votifier v1 servernu_vote(username: str, user_address: str = "127.0.0.1") -> dict
- sends a NuVotifier / v2 vote to a NuVotifier server, returns the response from the server
class aiovotifier.VotifierHeader(header: bytes, version: str, token: str = None)
- Arguments:
header: bytes
- The header received from the votifier serverversion: str
- The version of the votifier serverchallenge: str = None
- The challenge, included only if the votifier server is v2/NuVotifier
- Methods:
@classmethod parse(header: bytes)
- Returns a newVotifierHeader
, parsed from the input bytes
function aiovotifier.votifier_v1_vote(r: asyncio.StreamReader, w: asyncio.StreamWriter, service_name: str, username: str, user_address: str, key: cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey)
- Sends a Votifier v1 vote to a Votifier v1 server
function aiovotifier.nuvotifier_vote(r: asyncio.StreamReader, w: asyncio.StreamWriter, service_name: str, username: str, user_address: str, token: str, challenge: str) -> dict
- Sends a NuVotifier / v2 vote to a NuVotifier server
exception aiovotifier.VotifierError
- Base class that all votifier exceptions derive from
exception aiovotifier.VotifierHeaderError
- Raised when the header from the votifier server is invalid
exception aiovotifier.UnsupportedVersionError
- Raised when the votifier version is unsupported
exception aiovotifier.NuVotifierResponseError
- Raised when the response from the votifier server contains a status that is not OK
Credits
aiovotifier was based off the code and documentation below
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiovotifier-1.0.6.tar.gz
(5.2 kB
view details)
Built Distribution
File details
Details for the file aiovotifier-1.0.6.tar.gz
.
File metadata
- Download URL: aiovotifier-1.0.6.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.8 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 738a8b992ebe9abfa494a92531a9c59f9fb793dc19dd6be68e0e60b62ad41e40 |
|
MD5 | a12477a7f3d205849807081bd34933b5 |
|
BLAKE2b-256 | 9a75545981055ab4cdf0f4adf056678ac5b395f9fcfe1f138a4e74a10957ca15 |
File details
Details for the file aiovotifier-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: aiovotifier-1.0.6-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.8 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d393463baac46e9730bdf43d0c2f7f16828fef126d374c2bf6d2829e101925e |
|
MD5 | cf60785e5d8c0f4ad603b39e087f4765 |
|
BLAKE2b-256 | a77d9f54e0b4843f7d9ff367bff4320181143c5e3971f5109bdce529aa021d0b |