calagoapi 1.0.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- calagoapi/__init__.py +190 -0
- calagoapi/account/__init__.py +14 -0
- calagoapi/account/account.py +292 -0
- calagoapi/account/auth.py +72 -0
- calagoapi/account/models.py +221 -0
- calagoapi/admin/__init__.py +48 -0
- calagoapi/admin/admin.py +341 -0
- calagoapi/admin/managers.py +490 -0
- calagoapi/admin/resources.py +970 -0
- calagoapi/aio/__init__.py +9 -0
- calagoapi/aio/console.py +289 -0
- calagoapi/aio/panel.py +176 -0
- calagoapi/api/__init__.py +63 -0
- calagoapi/api/account.py +195 -0
- calagoapi/api/admin.py +402 -0
- calagoapi/api/attachments.py +27 -0
- calagoapi/api/auth.py +52 -0
- calagoapi/api/backups.py +99 -0
- calagoapi/api/client.py +198 -0
- calagoapi/api/databases.py +217 -0
- calagoapi/api/files.py +210 -0
- calagoapi/api/network.py +84 -0
- calagoapi/api/public.py +13 -0
- calagoapi/api/schedules.py +79 -0
- calagoapi/api/servers.py +114 -0
- calagoapi/api/users.py +27 -0
- calagoapi/api/versions.py +29 -0
- calagoapi/backups/__init__.py +8 -0
- calagoapi/backups/backup.py +292 -0
- calagoapi/backups/manager.py +177 -0
- calagoapi/console/__init__.py +6 -0
- calagoapi/console/console.py +392 -0
- calagoapi/databases/__init__.py +12 -0
- calagoapi/databases/database.py +445 -0
- calagoapi/databases/explorer.py +159 -0
- calagoapi/databases/manager.py +122 -0
- calagoapi/files/__init__.py +9 -0
- calagoapi/files/file.py +196 -0
- calagoapi/files/manager.py +437 -0
- calagoapi/network/__init__.py +8 -0
- calagoapi/network/allocation.py +99 -0
- calagoapi/network/manager.py +132 -0
- calagoapi/nodes/__init__.py +6 -0
- calagoapi/nodes/node.py +477 -0
- calagoapi/panel.py +162 -0
- calagoapi/schedules/__init__.py +14 -0
- calagoapi/schedules/builders.py +461 -0
- calagoapi/schedules/manager.py +107 -0
- calagoapi/schedules/schedule.py +214 -0
- calagoapi/servers/__init__.py +13 -0
- calagoapi/servers/admin.py +430 -0
- calagoapi/servers/generic.py +785 -0
- calagoapi/servers/manager.py +167 -0
- calagoapi/servers/minecraft.py +207 -0
- calagoapi/tunnels/__init__.py +5 -0
- calagoapi/tunnels/tunnel.py +112 -0
- calagoapi/users/__init__.py +11 -0
- calagoapi/users/activity.py +45 -0
- calagoapi/users/subuser.py +127 -0
- calagoapi/users/user.py +267 -0
- calagoapi/utils/__init__.py +43 -0
- calagoapi/utils/convert.py +113 -0
- calagoapi/utils/exceptions.py +72 -0
- calagoapi/utils/model.py +142 -0
- calagoapi/utils/resource.py +100 -0
- calagoapi/utils/time.py +68 -0
- calagoapi-1.0.dev1.dist-info/METADATA +266 -0
- calagoapi-1.0.dev1.dist-info/RECORD +71 -0
- calagoapi-1.0.dev1.dist-info/WHEEL +5 -0
- calagoapi-1.0.dev1.dist-info/licenses/LICENSE +674 -0
- calagoapi-1.0.dev1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
from calagoapi.utils.model import Model, idOf
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AdminResource(Model):
|
|
5
|
+
'''
|
|
6
|
+
Base class for objects managed through the admin API.
|
|
7
|
+
|
|
8
|
+
Every admin object supports `refresh()`, `update(**fields)` and `delete()`.
|
|
9
|
+
Objects Calagopus can copy also have `duplicate()`. The accepted fields
|
|
10
|
+
of `update()` are the fields Calagopus returns for the object.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
panel: The Panel.
|
|
14
|
+
data: Raw data from Calagopus.
|
|
15
|
+
resource: Internal API collection, only needed for nested objects (eggs, variables).
|
|
16
|
+
'''
|
|
17
|
+
collection = None
|
|
18
|
+
|
|
19
|
+
def __init__(self, panel, data: dict = None, resource=None):
|
|
20
|
+
super().__init__(panel, data)
|
|
21
|
+
self.resource = resource
|
|
22
|
+
|
|
23
|
+
def _api(self):
|
|
24
|
+
return self.resource or getattr(self.panel.api.admin, self.collection)
|
|
25
|
+
|
|
26
|
+
def getName(self) -> str:
|
|
27
|
+
'''Returns the name.'''
|
|
28
|
+
return self.data.get('name')
|
|
29
|
+
|
|
30
|
+
def getDescription(self) -> str:
|
|
31
|
+
'''Returns the description.'''
|
|
32
|
+
return self.data.get('description')
|
|
33
|
+
|
|
34
|
+
def refresh(self):
|
|
35
|
+
'''Re-fetches the object from the panel.'''
|
|
36
|
+
self.data = self._api().get(self.getUUID())
|
|
37
|
+
return self
|
|
38
|
+
|
|
39
|
+
def update(self, **fields):
|
|
40
|
+
'''
|
|
41
|
+
Updates the object. Only the given fields change.
|
|
42
|
+
|
|
43
|
+
Example:
|
|
44
|
+
location.update(name='Frankfurt', description='DE-1')
|
|
45
|
+
'''
|
|
46
|
+
self._api().update(self.getUUID(), **fields)
|
|
47
|
+
return self._update(fields)
|
|
48
|
+
|
|
49
|
+
def rename(self, name: str):
|
|
50
|
+
'''Renames the object.'''
|
|
51
|
+
return self.update(name=name)
|
|
52
|
+
|
|
53
|
+
def setName(self, name: str):
|
|
54
|
+
'''Alias of rename().'''
|
|
55
|
+
return self.update(name=name)
|
|
56
|
+
|
|
57
|
+
def setDescription(self, description: str):
|
|
58
|
+
'''Changes the description.'''
|
|
59
|
+
return self.update(description=description)
|
|
60
|
+
|
|
61
|
+
def _duplicate(self, **fields):
|
|
62
|
+
# only exposed as duplicate() by objects whose collection supports it
|
|
63
|
+
return self.__class__(self.panel, self._api().duplicate(self.getUUID(), **fields), self.resource)
|
|
64
|
+
|
|
65
|
+
def delete(self, **options) -> None:
|
|
66
|
+
'''Deletes the object.'''
|
|
67
|
+
return self._api().delete(self.getUUID(), **options)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class AdminManager:
|
|
71
|
+
'''Base class for admin managers like `panel.admin.locations`.'''
|
|
72
|
+
model = AdminResource
|
|
73
|
+
|
|
74
|
+
def __init__(self, panel, resource=None):
|
|
75
|
+
self.panel = panel
|
|
76
|
+
self.admin = panel.api.admin
|
|
77
|
+
# nested collections (eggs of a nest, ...) pass their own resource
|
|
78
|
+
self.resource = resource
|
|
79
|
+
self.api = resource or getattr(panel.api.admin, self.model.collection)
|
|
80
|
+
|
|
81
|
+
def _wrap(self, data):
|
|
82
|
+
return self.model(self.panel, data, self.resource)
|
|
83
|
+
|
|
84
|
+
def _list(self, search=None, page=None, per_page=None, **params):
|
|
85
|
+
return self.api.list(search, page, per_page, **params).map(self._wrap)
|
|
86
|
+
|
|
87
|
+
def _get(self, resource_id):
|
|
88
|
+
return self._wrap(self.api.get(idOf(resource_id)))
|
|
89
|
+
|
|
90
|
+
def _find(self, name):
|
|
91
|
+
for item in self._list(search=name):
|
|
92
|
+
if name in (item.getUUID(), item.getName()):
|
|
93
|
+
return item
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
def _create(self, **fields):
|
|
97
|
+
return self._wrap(self.api.create(**fields))
|
|
98
|
+
|
|
99
|
+
def _delete(self, resource_id, **options):
|
|
100
|
+
return self.api.delete(idOf(resource_id), **options)
|
calagoapi/utils/time.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import time
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def waitForState(server, state: str, timeout: int = 60, interval: int = 2) -> bool:
|
|
6
|
+
'''
|
|
7
|
+
Blocks until the server reaches a power state.
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
server: A server object.
|
|
11
|
+
state: One of 'running', 'offline', 'starting', 'stopping'.
|
|
12
|
+
timeout: Maximum seconds to wait.
|
|
13
|
+
interval: Seconds between checks.
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
True if the state was reached, False if the timeout expired.
|
|
17
|
+
|
|
18
|
+
Example:
|
|
19
|
+
server.start()
|
|
20
|
+
waitForState(server, 'running', timeout=120)
|
|
21
|
+
'''
|
|
22
|
+
deadline = time.monotonic() + timeout
|
|
23
|
+
while True:
|
|
24
|
+
if server.getPowerState() == state:
|
|
25
|
+
return True
|
|
26
|
+
if time.monotonic() >= deadline:
|
|
27
|
+
return False
|
|
28
|
+
time.sleep(interval)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def waitForOnline(server, timeout: int = 60, interval: int = 2) -> bool:
|
|
32
|
+
'''
|
|
33
|
+
Pauses the script until the server is online.
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
True once the server is running, False if the timeout expired.
|
|
37
|
+
|
|
38
|
+
Example:
|
|
39
|
+
server.restart()
|
|
40
|
+
if waitForOnline(server, timeout=180):
|
|
41
|
+
server.sendCommand('say Back online!')
|
|
42
|
+
'''
|
|
43
|
+
return waitForState(server, 'running', timeout, interval)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def waitForOffline(server, timeout: int = 60, interval: int = 2) -> bool:
|
|
47
|
+
'''
|
|
48
|
+
Pauses the script until the server is fully offline.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
True once the server is offline, False if the timeout expired.
|
|
52
|
+
|
|
53
|
+
Example:
|
|
54
|
+
server.stop()
|
|
55
|
+
waitForOffline(server)
|
|
56
|
+
server.files.deleteFiles('/', ['world'])
|
|
57
|
+
'''
|
|
58
|
+
return waitForState(server, 'offline', timeout, interval)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def secsUntil(target: datetime) -> int:
|
|
62
|
+
'''Returns the seconds until the target time.'''
|
|
63
|
+
return int((target - datetime.now()).total_seconds())
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def minsUntil(target: datetime) -> int:
|
|
67
|
+
'''Returns the minutes until the target time.'''
|
|
68
|
+
return secsUntil(target) // 60
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: calagoapi
|
|
3
|
+
Version: 1.0.dev1
|
|
4
|
+
Summary: The Python SDK for Calagopus: servers, live console, files, backups, databases, schedules, nodes and full panel administration, sync and async.
|
|
5
|
+
Author: iFamished
|
|
6
|
+
License: GPL-3.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/HungerNet/CalagoAPI
|
|
8
|
+
Project-URL: Documentation, https://github.com/HungerNet/CalagoAPI/tree/main/docs
|
|
9
|
+
Project-URL: Source, https://github.com/HungerNet/CalagoAPI
|
|
10
|
+
Project-URL: Issues, https://github.com/HungerNet/CalagoAPI/issues
|
|
11
|
+
Keywords: calagopus,minecraft,game-server,panel,sdk,api-client,automation,server-management,hungernet
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Development Status :: 4 - Beta
|
|
21
|
+
Classifier: Intended Audience :: Developers
|
|
22
|
+
Classifier: Intended Audience :: System Administrators
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
24
|
+
Classifier: Topic :: System :: Systems Administration
|
|
25
|
+
Classifier: Topic :: Games/Entertainment
|
|
26
|
+
Requires-Python: >=3.9
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: requests
|
|
30
|
+
Requires-Dist: websockets>=13
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# CalagoAPI
|
|
36
|
+
|
|
37
|
+
The Python SDK for [Calagopus](https://calagopus.com).
|
|
38
|
+
|
|
39
|
+
CalagoAPI wraps the whole Calagopus API (servers, files, backups, databases,
|
|
40
|
+
schedules, networking, your account, and full panel administration) in a
|
|
41
|
+
small, hand-written API that reads like plain Python.
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from calagoapi import Panel
|
|
45
|
+
|
|
46
|
+
panel = Panel(
|
|
47
|
+
url='https://panel.example.com',
|
|
48
|
+
api_key='c7sp_...'
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
server = panel.servers.getServer('abc123')
|
|
52
|
+
server.sendCommand('say Hello')
|
|
53
|
+
server.restart()
|
|
54
|
+
|
|
55
|
+
if server.isOnline():
|
|
56
|
+
print(server.getStatus(), server.getRAM(), server.getUptime(formatted=True))
|
|
57
|
+
|
|
58
|
+
backup = server.createBackup('before-update')
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
If you have used [HungerLib](https://github.com/iFamished/HungerLib), you
|
|
62
|
+
already know CalagoAPI. The same objects and method names
|
|
63
|
+
(`Panel`, `GenericServer`, `MinecraftServer`, `getStatus()`, `isOnline()`,
|
|
64
|
+
`createBackup()`, `listFiles()`, ...) work here, backed by Calagopus.
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install calagoapi
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
CalagoAPI needs Python 3.9+ and depends on `requests` and `websockets`.
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
|
|
76
|
+
| Area | What you can do |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| **Servers** | Power actions, console commands, logs, live resources, status checks, rename, reinstall, timezone, auto-start, auto-kill, startup variables, docker image, server groups |
|
|
79
|
+
| **Live console** | Stream console output over the daemon websocket, wait for a line, callbacks for output, status, stats and every daemon event, automatic token renewal and reconnects |
|
|
80
|
+
| **Files** | List, read, write, upload, download, rename, move, copy (also to other servers), compress, decompress, chmod, search, pull from URL, file revisions, SQLite queries, directory sizes |
|
|
81
|
+
| **Backups** | Create, restore, download, lock, rename, bulk delete, backup groups with retention policies, usage |
|
|
82
|
+
| **Databases** | Hosted databases, dedicated database instances (PostgreSQL, MariaDB, MongoDB, Redis), database users and grants, import/export, a full **database explorer** (tables, columns, rows, queries) |
|
|
83
|
+
| **Schedules** | Triggers (cron, crash, console line, resource usage, ...), conditions, 30+ step actions, import/export, live status, with builder helpers |
|
|
84
|
+
| **Network** | Allocations, subdomains, per-server firewall, tunnels between servers |
|
|
85
|
+
| **Subusers** | Invite, permissions, ignored files |
|
|
86
|
+
| **Minecraft** | Version changer (install any Paper/Purpur/Fabric/... build), `server.properties` editing, EULA, console helpers |
|
|
87
|
+
| **Account** | Profile, password, email, two-factor, API keys, SSH keys, passkeys, sessions, OAuth links, command snippets, activity |
|
|
88
|
+
| **Admin** | Users, servers (create, deploy, transfer, suspend, limits), nodes, allocations, locations, nests and eggs, egg repositories, mounts, devices, roles, announcements, OAuth providers, database hosts, backup configurations and policies, settings, email templates, extensions, system health and updates |
|
|
89
|
+
| **Async** | `AsyncPanel`: the whole API with `await`, plus a native asyncio live console |
|
|
90
|
+
| **Reliability** | Automatic retries on rate limits (and on transient errors for reads), typed exceptions, automatic pagination |
|
|
91
|
+
|
|
92
|
+
## Quick tour
|
|
93
|
+
|
|
94
|
+
### Status and resources
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
status = server.getStatus() # 'running', 'offline', 'starting' or 'stopping'
|
|
98
|
+
|
|
99
|
+
if server.isOnline():
|
|
100
|
+
print(server.getCPU(), '%')
|
|
101
|
+
print(server.getRAM(), '/', server.getRAMLimit(), 'MiB')
|
|
102
|
+
print(server.getUptime(formatted=True)) # '3h 12m'
|
|
103
|
+
|
|
104
|
+
server.isInstalled()
|
|
105
|
+
server.isSuspended()
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Every important value has a getter *and* convenience checks, so you can
|
|
109
|
+
inspect the exact state or just branch on it.
|
|
110
|
+
|
|
111
|
+
### Live console
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
for line in server.streamConsole():
|
|
115
|
+
if 'joined the game' in line:
|
|
116
|
+
print(line)
|
|
117
|
+
|
|
118
|
+
with server.console as console:
|
|
119
|
+
console.sendCommand('save-all')
|
|
120
|
+
console.waitFor('Saved the game')
|
|
121
|
+
|
|
122
|
+
server.onConsoleLine(print) # callbacks in a background thread
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Async
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from calagoapi import AsyncPanel
|
|
129
|
+
|
|
130
|
+
async with AsyncPanel(url='https://panel.example.com', api_key='c7sp_...') as panel:
|
|
131
|
+
servers = await panel.servers.getServers()
|
|
132
|
+
statuses = await asyncio.gather(*(server.getStatus() for server in servers))
|
|
133
|
+
|
|
134
|
+
async for line in servers[0].streamConsole():
|
|
135
|
+
print(line)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Files
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
for file in server.files.listFiles('/plugins'):
|
|
142
|
+
print(file.getName(), file.getSize(formatted=True))
|
|
143
|
+
|
|
144
|
+
properties = server.readFile('/server.properties')
|
|
145
|
+
server.writeFile('/eula.txt', 'eula=true')
|
|
146
|
+
server.files.uploadFile('/plugins', 'build/MyPlugin.jar')
|
|
147
|
+
server.files.downloadFile('/world.zip', 'world.zip')
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Backups
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
backup = server.createBackup('before-update')
|
|
154
|
+
backup.waitUntilComplete()
|
|
155
|
+
|
|
156
|
+
if backup.isSuccessful():
|
|
157
|
+
print(backup.getSize(formatted=True))
|
|
158
|
+
|
|
159
|
+
backup.lock()
|
|
160
|
+
backup.restore(truncate_directory=True)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Schedules
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
from calagoapi import triggers, conditions, actions
|
|
167
|
+
|
|
168
|
+
server.schedules.createSchedule(
|
|
169
|
+
'Nightly restart',
|
|
170
|
+
triggers=[triggers.cron('0 0 4 * * *')],
|
|
171
|
+
condition=conditions.serverState('running'),
|
|
172
|
+
steps=[
|
|
173
|
+
actions.sendCommand('say Restarting in 1 minute'),
|
|
174
|
+
actions.sleep(60_000),
|
|
175
|
+
actions.createBackup('nightly', foreground=True),
|
|
176
|
+
actions.sendPower('restart'),
|
|
177
|
+
],
|
|
178
|
+
)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Databases
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
db = server.createDatabase('stats')
|
|
185
|
+
print(db.getConnectionString())
|
|
186
|
+
|
|
187
|
+
db.explorer.createTable('players', [
|
|
188
|
+
{'name': 'id', 'type': 'INT', 'primary_key': True, 'auto_increment': True},
|
|
189
|
+
{'name': 'name', 'type': 'VARCHAR(32)'},
|
|
190
|
+
])
|
|
191
|
+
db.explorer.insertRow('players', {'name': 'Steve'})
|
|
192
|
+
print(db.explorer.query('SELECT COUNT(*) FROM players'))
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Minecraft
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
server = panel.servers.getMinecraftServer('abc123')
|
|
199
|
+
|
|
200
|
+
server.say('Server update in 5 minutes!')
|
|
201
|
+
server.setProperties({'max-players': 100, 'motd': 'Welcome!'})
|
|
202
|
+
|
|
203
|
+
latest = server.getBuilds('PAPER', '1.21.1', page=1, per_page=1)[0]
|
|
204
|
+
server.installVersion(latest)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Administration
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
user = panel.admin.users.createUser('steve', 'steve@example.com')
|
|
211
|
+
|
|
212
|
+
server = panel.admin.servers.deployServer(
|
|
213
|
+
'Steve SMP', owner=user, egg=panel.admin.nests.findEgg('Paper'),
|
|
214
|
+
locations=[panel.admin.locations.getLocationByName('Frankfurt')],
|
|
215
|
+
memory=4096, disk=20480,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
for node in panel.admin.nodes.getNodes():
|
|
219
|
+
print(node.getName(), node.getSystemOverview()['version'])
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Errors
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
from calagoapi import NotFoundError, PermissionDeniedError, CalagoAPIError
|
|
226
|
+
|
|
227
|
+
try:
|
|
228
|
+
panel.servers.getServer('missing')
|
|
229
|
+
except NotFoundError:
|
|
230
|
+
print('No such server')
|
|
231
|
+
except CalagoAPIError as e:
|
|
232
|
+
print(e.status_code, e.errors)
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Documentation
|
|
236
|
+
|
|
237
|
+
The [docs](docs/) folder has a guide for every area:
|
|
238
|
+
|
|
239
|
+
- [Getting started](docs/getting-started.md)
|
|
240
|
+
- [Servers](docs/servers.md), [Minecraft servers](docs/minecraft.md), [Live console](docs/console.md)
|
|
241
|
+
- [Files](docs/files.md), [Backups](docs/backups.md), [Databases](docs/databases.md)
|
|
242
|
+
- [Schedules](docs/schedules.md)
|
|
243
|
+
- [Network, subusers and tunnels](docs/network.md)
|
|
244
|
+
- [Account and authentication](docs/account.md)
|
|
245
|
+
- [Administration](docs/admin.md)
|
|
246
|
+
- [Async](docs/async.md)
|
|
247
|
+
- [Errors, pagination and utilities](docs/errors-and-utilities.md)
|
|
248
|
+
- [Migrating from HungerLib](docs/migrating-from-hungerlib.md)
|
|
249
|
+
- [Architecture](docs/architecture.md)
|
|
250
|
+
|
|
251
|
+
Every public class and method also has a docstring with parameters and an
|
|
252
|
+
example, so `help(server.files)` works from a Python shell.
|
|
253
|
+
|
|
254
|
+
## Development
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
pip install -e .[dev]
|
|
258
|
+
pytest
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The tests run offline against `openapi.json` and a fake daemon. See
|
|
262
|
+
[Architecture](docs/architecture.md#tests).
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
GPL-3.0, see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
calagoapi/__init__.py,sha256=JPWXuu34rQr1b9-Dd7sfF-OL6SGumgZa-nc4INMvD5w,3876
|
|
2
|
+
calagoapi/panel.py,sha256=E7wOLKrgQqtx8_VWv6ClUfak7UI_1083eAEQlGeHyig,5718
|
|
3
|
+
calagoapi/account/__init__.py,sha256=Go2TFASYQ4hDl61iJvnTz-dv5ipoXVIMVaSIXfiWTww,279
|
|
4
|
+
calagoapi/account/account.py,sha256=vdjfQOtt-bfQ2xgoQwWQ4RGHd9tihMao75D9QPPRyoo,11732
|
|
5
|
+
calagoapi/account/auth.py,sha256=wU9kvRvWJhAnV5ef-doHtj_jAbYY4UuB32o5ckjk6Rs,3225
|
|
6
|
+
calagoapi/account/models.py,sha256=Ugk4VjkY3FRW3M2SlDgi1QnBGEOZvDiUt_L7PUMYGbA,7527
|
|
7
|
+
calagoapi/admin/__init__.py,sha256=-WmD5QZ47FaC95RAz1TVL-yL4rDra4ENaE5LfHBy-GQ,952
|
|
8
|
+
calagoapi/admin/admin.py,sha256=QUQp5okR6pu4QQ3PizlOleP8bxRiENpGqVQkZJMWNao,13870
|
|
9
|
+
calagoapi/admin/managers.py,sha256=k-bqn4Sfcsi0e9QGlnc3I2eIK-xY7A21n5qvLZbXe8s,19849
|
|
10
|
+
calagoapi/admin/resources.py,sha256=4OOuw-I6wwP6DZd1fsg9SdgKjmAj4epNRjCoQkLyGns,38673
|
|
11
|
+
calagoapi/aio/__init__.py,sha256=teE05GdzUdSc3G27wW8grT4uHEjS4pUiTPBoZ2CWpAc,183
|
|
12
|
+
calagoapi/aio/console.py,sha256=J2M7x6vd4RQKlg8iDgiJkB-9HA9i4CmvTFR0PyaG6RI,10469
|
|
13
|
+
calagoapi/aio/panel.py,sha256=QBjSVtkXudEuN0DwhxnqLmH0eyFV8nDkn5CA9f559iw,5930
|
|
14
|
+
calagoapi/api/__init__.py,sha256=FD9dwB6wOHYLU8tLYLAVapY6gOXeSX7N7l1cGz3N34U,1740
|
|
15
|
+
calagoapi/api/account.py,sha256=L4joHFoniPpQD_VrvDP9roET8XZz4ej5TsApDKXzB28,8373
|
|
16
|
+
calagoapi/api/admin.py,sha256=IIN2FR8Cxe_OumMleBUpjRr03fxyt36S2vXVcbLdpT8,21123
|
|
17
|
+
calagoapi/api/attachments.py,sha256=c82JXi14hHrJUrQ4ieK7TuGD3BPBonuZFTLsdCJq0jQ,1224
|
|
18
|
+
calagoapi/api/auth.py,sha256=NH1p0FTBdd-TwyyGwrhvi7ppZhwW2XQu3M3JXnrHRtk,2403
|
|
19
|
+
calagoapi/api/backups.py,sha256=I_UJl_6bMZK2RhsIQC6JCEeIoq4ijwiCa9tgrFfG4_s,4589
|
|
20
|
+
calagoapi/api/client.py,sha256=ynU6KEguAyY2omtN-hZ2_fvJJL067jcxk8HnFliEvJg,7046
|
|
21
|
+
calagoapi/api/databases.py,sha256=-7ZNM4BUcWjgj5-_yH5ceMd6KaU5On-XYlodWAZdJqg,10394
|
|
22
|
+
calagoapi/api/files.py,sha256=Cbz9-diIWnDhxQsCXQHmgzNPvmDxHM_8OLEOckKEYeI,8743
|
|
23
|
+
calagoapi/api/network.py,sha256=XBVdKkj829IST_3snOxYkDin8LvXkeNi1jvjV0XktA4,3640
|
|
24
|
+
calagoapi/api/public.py,sha256=N9CjXGykj6U7Smrc8c8WF4362WXXh92fQBi-mIzW0qA,406
|
|
25
|
+
calagoapi/api/schedules.py,sha256=H9BKQQxyYDgusPaPt8xFTNfYg4v5HvSU2MknGrl5f1c,3374
|
|
26
|
+
calagoapi/api/servers.py,sha256=hY8JerdbHDycM4jLe2xUo_d1QD1FY9JPKIutXOtw-6Q,5176
|
|
27
|
+
calagoapi/api/users.py,sha256=v8DrRwNO6yytDkP63u-UnTlD0qkJasej9nTjYRLDZXw,1113
|
|
28
|
+
calagoapi/api/versions.py,sha256=-9_ymAGoXjfS0b7JYC436OR3NKiosVUrZXeNdM8HGNo,1289
|
|
29
|
+
calagoapi/backups/__init__.py,sha256=zILFKsp8B2m1lz5j57A31bmVYFC-2CrwrBJAVq_R2-Q,144
|
|
30
|
+
calagoapi/backups/backup.py,sha256=DfEEDH8EupLhhnWuOOAKd1Aczi4tCv6HZ4cvpOFm0sQ,10661
|
|
31
|
+
calagoapi/backups/manager.py,sha256=7LCCWa5rc12NzkEvk3uS-W1XlCfNljjVf2bllggMkLU,7028
|
|
32
|
+
calagoapi/console/__init__.py,sha256=qF1MDKbFf5WNDURNl3cE1lErKaHli3HyvrQ3NVah08s,93
|
|
33
|
+
calagoapi/console/console.py,sha256=26UarqjErvU4XHG8Ah1nzHLB7zMSixjR2hd9k1tMgt0,13535
|
|
34
|
+
calagoapi/databases/__init__.py,sha256=3tTonKjRNQNAJUsVt96bc5-7-D3Sy4yT4W58M9lWh94,303
|
|
35
|
+
calagoapi/databases/database.py,sha256=s9isDCFjQ9878PTlEhnXnAeoniDKuDFVJYbqlEUQo4Y,16178
|
|
36
|
+
calagoapi/databases/explorer.py,sha256=TkkRY1B-lGN-pP16v_yf8R9UuAK8GmAnOK8qTXqfOYE,6212
|
|
37
|
+
calagoapi/databases/manager.py,sha256=JG6tSUi9mx3tTlIKZ-Lru621F-1Udwhrvb8wxEgRgKA,4884
|
|
38
|
+
calagoapi/files/__init__.py,sha256=TPmfARP8dkQBSur-Cr3_zITLZemPcdcYDZvUbxlaxxE,156
|
|
39
|
+
calagoapi/files/file.py,sha256=P-DUWoaR1EP3KUJhouM5yJm-ATg_tIvOIX059yq14IM,6823
|
|
40
|
+
calagoapi/files/manager.py,sha256=SegHKBqGopqedbVR43fnmPdHLfOqwZEFHPHv-uhdEI4,17145
|
|
41
|
+
calagoapi/network/__init__.py,sha256=JOKGLpyhW6bYDb0EcqbxCKuZJJLcpcMB-tIGukAb6eY,154
|
|
42
|
+
calagoapi/network/allocation.py,sha256=5gORNeXRU9OOqEVwAaBIZ0WAYrhGEKAku8Krmy7nzJM,3548
|
|
43
|
+
calagoapi/network/manager.py,sha256=UJMUhLf-WnZ-FJhIxEWl47eXfSS2CGsAxmTSbVaVEvc,5278
|
|
44
|
+
calagoapi/nodes/__init__.py,sha256=cRhuHWoR26ZZG-J-u0rF9UIGmV19ZtsmW6VeP4B6qHs,82
|
|
45
|
+
calagoapi/nodes/node.py,sha256=JGXTzCeQW9BnYDMUR_rA1CjZMYiLcep6pDeSguzBojc,20925
|
|
46
|
+
calagoapi/schedules/__init__.py,sha256=8K3bh9Kk0zYonwBgQYw61heMRgjK0vzm7a6dNaRcAic,307
|
|
47
|
+
calagoapi/schedules/builders.py,sha256=04oPVwvpHP9YTv28HJqnCwfuvGCWb1BoUNa6_PGTf1I,18407
|
|
48
|
+
calagoapi/schedules/manager.py,sha256=FS-c_Xe1Y3GEeSQX6NUggPWnA9KbEKg9cwsZTabqEQA,4223
|
|
49
|
+
calagoapi/schedules/schedule.py,sha256=4ZieJl85zc0z30J6DIaEd8wFXkAgJnmTh-sGq8J1xG4,7419
|
|
50
|
+
calagoapi/servers/__init__.py,sha256=OR_dvVOaRzqNHj2_oWu8vPF-bG5mxaRPmRANqFTKK6U,317
|
|
51
|
+
calagoapi/servers/admin.py,sha256=kcfdwl2D3kXoxZncL5nHj7Y19gWAkdpBMgdISXh64r8,18446
|
|
52
|
+
calagoapi/servers/generic.py,sha256=OYRizQ_9wwrWhjEVWEWpH80rTAOX4MK4-joqRZ5-vjQ,29222
|
|
53
|
+
calagoapi/servers/manager.py,sha256=_ffLrjqHu7jPV_JnpWgU86a8vdCrw4uM7RDuNrD2PS0,6175
|
|
54
|
+
calagoapi/servers/minecraft.py,sha256=_WEvWwXcoAgKj8juFjRLeex9Wzr5oVdlwZ6hZVwYDxo,7714
|
|
55
|
+
calagoapi/tunnels/__init__.py,sha256=YqCTKqoKsJiKkK2WkU3asKRxewdqDspcUq1D91JOU2g,70
|
|
56
|
+
calagoapi/tunnels/tunnel.py,sha256=ILrfinp7u_s_s3_0HwXps5jmuQxX-SDPqOnZ0Lkx2_w,4057
|
|
57
|
+
calagoapi/users/__init__.py,sha256=kjmVsCxm4beC3CWXCIxSfpmaeXFPlWqoif6wayGFUIs,211
|
|
58
|
+
calagoapi/users/activity.py,sha256=_wOU8qd7EmxXp9nrpdzJ09CKxWo6oPtRDbKFE-Qgxo8,1534
|
|
59
|
+
calagoapi/users/subuser.py,sha256=q5-xNjd_IXCv1KTxrVimm2CEnS6Ya_FFghc2kDQFow0,5152
|
|
60
|
+
calagoapi/users/user.py,sha256=7IMLNuAzqE0SV5IiQp2dxx_GNLW1gKJWelPa4ZinGHU,9645
|
|
61
|
+
calagoapi/utils/__init__.py,sha256=rDjIdHwvZwqOGMbUNdmIaCfiTprWH0UI1wfUO1XUcD4,952
|
|
62
|
+
calagoapi/utils/convert.py,sha256=UAAsic_Sw08AzYK7avgSh60vfwxuazv3QtFXXnJnwGM,2690
|
|
63
|
+
calagoapi/utils/exceptions.py,sha256=wKPLBofRl9223KcF86lhYy58x806LjXaT8jH9OcL8CY,2597
|
|
64
|
+
calagoapi/utils/model.py,sha256=Y8cPwG_750HlyQTQJUlFJTCVs795cjaAccWVnHBPu4Q,4512
|
|
65
|
+
calagoapi/utils/resource.py,sha256=c6dZT-yjTgnNQx1WsjmnGMD6wl5mJFgn1Xjeo6jJI4g,3289
|
|
66
|
+
calagoapi/utils/time.py,sha256=3BWSSJQrNeZ2AuqZSlKZXfOHkjmY6UwidHuw2KmrNUs,1905
|
|
67
|
+
calagoapi-1.0.dev1.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
|
68
|
+
calagoapi-1.0.dev1.dist-info/METADATA,sha256=0ee1-Wo5H262NvJp7SHsZ3kuvJ3sePWpEd4KJw9JWN0,9129
|
|
69
|
+
calagoapi-1.0.dev1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
70
|
+
calagoapi-1.0.dev1.dist-info/top_level.txt,sha256=X43vYX0uEB-VlPQfsDWdNAOTqK44_xAtjzjIisDzILo,10
|
|
71
|
+
calagoapi-1.0.dev1.dist-info/RECORD,,
|