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
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
pal_api-0.1.1.tar.gz
(4.7 kB
view details)
Built Distribution
File details
Details for the file pal_api-0.1.1.tar.gz
.
File metadata
- Download URL: pal_api-0.1.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.14.0 CPython/3.10.12 Linux/6.5.0-1017-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 414967f5658e75f76c1cdfbbcab0b951ba37c3f04f9e7f958fbf60308ce4691c |
|
MD5 | 80b8fe63c3fab130388e0a80eb71d73c |
|
BLAKE2b-256 | 80d5f1f6964b4bd242a081186cba4899f5884b369f3d6d04c8f60d6d92f5f08d |
File details
Details for the file pal_api-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pal_api-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.14.0 CPython/3.10.12 Linux/6.5.0-1017-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72db75d02f7e7559228dc03748665f9868b4bf86af0898f39ce80465fb584900 |
|
MD5 | c9776dde4070df720ff9c7c357e7239b |
|
BLAKE2b-256 | a2c556a2156e5992b52dfbc2e6152eafbb7df32c647a52d49a8d29d5c0e0eaa2 |