Skip to main content

API Wrapper for Palworld Dedicated Server

Project description

pal_api

API Wrapper for Palworld Dedicated Server

Usage

Install

pip install pal_api
### Option ###
pip install ujson

Sync

from pal_api import PalApiClient
client = PalApiClient(password="password")
print(client.get_server_info())

# with Context Manager
with PalApiClient(password="password") as client:
    print(client.get_server_info())

Async

import asyncio
from pal_api import AsyncPalApiClient

async def main():
    client = AsyncPalApiClient(password="password")
    print(await client.get_server_info())
    await client.close()

asyncio.run(main())

# with Context Manager
async def main():
    async with AsyncPalApiClient(password="password") as client:
        print(await client.get_server_info())

asyncio.run(main())

Options and Default Values for the Class

name class default
host str "localhost"
port int 8212
username str "admin"
password str
timeout int 5
session(async only) aiohttp.ClientSession None

method

get_server_info() -> ServerInfo
get_player_list() -> PlayerList
get_server_settings() -> dict
get_server_metrics() -> ServerMetrics
announce_message(message: str) -> None
kick_player(userid: str, message: str = "") -> None
ban_player(userid: str, message: str = "") -> None
unban_player(userid: str) -> None
save_world() -> None
shutdown_server(waittime: int = 10, message: str | None = None, force: bool = False) -> None

やってること・その他

  • playerIdが負の数が返ってくることがある -> とりあえず正の数に直してます
  • ログイン中にSteamの名前が返ってくる -> playerIdがNoneのものは除外しています
  • BanするとbanlistにはIDが乗るが、効いてなさそう(コミュニティサーバー未確認)
  • また、間違ったIDを送ってもとりあえずリストには乗る
  • Banするときにメッセージを送れるが、どこに表示されているのか不明

License MIT ©Charahiro-tan

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

pal_api-0.1.1.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

pal_api-0.1.1-py3-none-any.whl (6.5 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