Skip to content

kbiernat/Nitrado-SDK

 
 

Repository files navigation

Python Nitrado SDK

Testing

A Python based SDK for the Nitrado RESTful API published at PyPI.

Overview

To have access to this application you must have an account created at Nitrado and create an API key.

Table of contents

Shows how to get access to your API key.

Shows how to log in to the client and use the basic code interface

Data provided outside of the game server. Like server status, user id, and auto extension plan.

Data directly related to the game server. This includes the player list, game settings, etc.


Installation

In your terminal install the nitrado package with pip.

pip install nitrado

Examples

Connect to Client

To begin using the API the Client must first be connected to your Nitrado account. Once connected to the client, you should have access to any of the API calls.

from nitrado import NitradoAPI

NitradoAPI.initialize_client("your-api-key")
api = NitradoAPI()

or

from nitrado import NitradoAPI

api = NitradoAPI("your-api-key")

Services

This example highlights how to get the service.

from nitrado import NitradoAPI

api = NitradoAPI("your-api-key")

services = api.services
print(services)
[
    <Service(id=1011111, username='ni11111_1', details={'address': '111.111.111.111:9996', 'name': '[API] My-Server-1', 'game': 'ARK: Survival Evolved (Xbox One)', 'portlist_short': 'arkxb', 'folder_short': 'arkxb', 'slots': 70})>,
    <Service(id=1011112, username='ni11111_1', details={'address': '111.111.111.112:9996', 'name': '[API] My-Server-2', 'game': 'ARK: Survival Evolved (Xbox One)', 'portlist_short': 'arkxb', 'folder_short': 'arkxb', 'slots': 70})>,
    <Service(id=1011113, username='ni11111_1', details={'address': '111.111.111.113:9996', 'name': '[API] My-Server-3', 'game': 'ARK: Survival Evolved (Xbox One)', 'portlist_short': 'arkxb', 'folder_short': 'arkxb', 'slots': 70})>
]

GameServer

This example highlights how to get the gameserver.

from nitrado import NitradoAPI

api = NitradoAPI("your-api-key")

gameserver = api.game_servers
print(gameserver)
[
    <GameServer(service_id=11111111, status='started', query={'server_name': '[API] My-Server-1', 'connect_ip': '111.111.111.111:9996', 'map': 'LostIsland', 'version': '943.10', 'player_current': 0, 'player_max': 70, 'players': []})>,
    <GameServer(service_id=11111112, status='started', query={'server_name': '[API] My-Server-2', 'connect_ip': '111.111.111.112:9996', 'map': 'Ragnarok', 'version': '943.10', 'player_current': 0, 'player_max': 70, 'players': []})>,
    <GameServer(service_id=11111113, status='started', query={'server_name': '[API] My-Server-3', 'connect_ip': '111.111.111.113:9996', 'map': 'TheIsland', 'version': '943.10', 'player_current': 0, 'player_max': 70, 'players': []})>
]

About

A client to access the Nitrado API with Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 76.4%
  • Shell 23.6%