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
Metadata
Release files for pal_api 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pal_api-0.1.1.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pal_api-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / pal_api-0.1.1.tar.gz
| Download URL | pal_api-0.1.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
414967f5658e75f76c1cdfbbcab0b951ba37c3f04f9e7f958fbf60308ce4691c
|
|
BLAKE2b-256 checksum How to use checksums |
80d5f1f6964b4bd242a081186cba4899f5884b369f3d6d04c8f60d6d92f5f08d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.14.0 CPython/3.10.12 Linux/6.5.0-1017-azure
|
Release files / pal_api-0.1.1-py3-none-any.whl
| Download URL | pal_api-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72db75d02f7e7559228dc03748665f9868b4bf86af0898f39ce80465fb584900
|
|
BLAKE2b-256 checksum How to use checksums |
a2c556a2156e5992b52dfbc2e6152eafbb7df32c647a52d49a8d29d5c0e0eaa2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.14.0 CPython/3.10.12 Linux/6.5.0-1017-azure
|