A Python wrapper for the Pika Network API
Project description
pikanetwork.py
A unique API wrapper for PikaNetwork API.
It provides ready-to-use objects from the api to python for optimization and durability of data.
It also makes accessing data an easy thing to do.
Basic Examples:
Fetching a player's information.
from pikanetwork import PikaAPI
import asyncio
app = PikaAPI()
async def print_player_data(name: str):
player = await app.get_player(name)
print(player)
async def print_player_clan(name: str):
player = await app.get_player(name)
# Sometimes the Player has a Nullified clan Attribute. you can use an if statement on the clan object
# for easier handling.
try:
print(player.clan)
except AttributeError:
print("This player does not have a clan!")
# or
if player.clan is None:
print("This player does not have a clan.")
return
print(player.clan.owner)
async def print_player_clan_owner(name: str):
player = await app.get_player(name)
try:
print(player.clan.owner)
except AttributeError:
print("This player does not have a clan!")
# or
if player.clan is None:
print("This player does not have a clan.")
return
print(player.clan.owner)
asyncio.run(print_player_data("LetsChill"))
# Player(...)
asyncio.run(print_player_clan("MrEpiko"))
# Clan(...)
# or
# This player does not have a clan.
asyncio.run(print_player_clan_owner("Arrly"))
# ClanOwner(...)
# or
# This player does not have a clan.
Fetching a player's leaderboard statistics.
from pikanetwork import PikaAPI
import asyncio
app = PikaAPI()
async def get_player_bedwars_leaderboard(name: str):
leaderboard = await app.get_player_leaderboard(name, "bedwars", "total", "solo")
print(leaderboard)
asyncio.run(get_player_bedwars_leaderboard("Wondermine"))
# PlayerLeaderboard(...)
Installation
to install pikanetwork.py, you can use:
$ pip install pikanetwork.py
Contribution
You can open an issue to state your concerns or feature you want to implement.
We can make a deal and arrange how tasks should be assigned.
ALWAYS OPEN AN ISSUE BEFORE MAKING A PULL REQUEST.
License
Copyright (c) 2023 LetsChill.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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
Built Distribution
File details
Details for the file pikanetwork.py-1.0.2.tar.gz
.
File metadata
- Download URL: pikanetwork.py-1.0.2.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 279c5b16c711f9b3ece3db7e2e7c06bf94d545f74e3db6f8fc61c9dc7949d9d5 |
|
MD5 | b9929a9081f2e013e9cb7d00dd7f8c8f |
|
BLAKE2b-256 | ef80f2a1b5c8899224abc2cbabed53d98bb29d510e5dfd02e9b250ea75888f36 |
File details
Details for the file pikanetwork.py-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: pikanetwork.py-1.0.2-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c09322cd0a7ac0017cf3349509e1b4149bc185bde3fb8e7801b335cd5ecd9271 |
|
MD5 | cc7864eec6c89152144322a40a40aae4 |
|
BLAKE2b-256 | 08e79a1843fe0ffda79d80ecc986752e57ba6863d390e4556a2b77bbed9a88b0 |