iamkubi / pydactyl Goto Github PK
View Code? Open in Web Editor NEWPython wrapper for the Pterodactyl Panel API
License: MIT License
Python wrapper for the Pterodactyl Panel API
License: MIT License
The prints in this code have the same result:
response = api.nodes.list_nodes()
for page in response:
print ('page: {}'.format(page))
for node in page:
print('node: {}'.format(node))
Must be a bug in PaginatedResponse.
Using admin.user
have some sort of filter function that can filter out:
Thank you :)
Hiya!
I'm trying to make a tkinter application, using this I can control my servers from said app.
The only problem I'm currently facing is getting only all the names from a list, so I can pick which server I would like to edit.
If you know of anyway of doing this please tell me :)
Thank you!
How would you access the next page of node allocations through pydactyl? Is this implemented? Pterodactyl only displays fifty allocations at a time.
Describe the bug
When calling update_server_build on the latest version of pterodactyl it throws the error: API Request resulted in errors: [{'code': 'ValidationException', 'status': '422', 'detail': 'The Backup Limit field must be present.', 'meta': {'source_field': 'feature_limits.backups', 'rule': 'present'}}]
To Reproduce
Steps to reproduce the behavior. Please make sure to include sample code that will reproduce your issue. If applicable include the full traceback, not just a single line error message.
Expected behavior
Update the server build
Environment
Additional context
Add any other context about the problem here.
Latest Panel and Wings versions
The environment variables when creating/modifying servers through pydactyl either throws the exception:
env_with_defaults[var_name] = var['attributes'].get(
TypeError: 'int' object does not support item assignment
where 'int' is replaced by which type of data you give the variable (if i wrote "latest" it would be "str" etc).
or for some eggs, such as vanilla Minecraft - the exception:
raise PterodactylApiError('API Request resulted in errors: %s' %
dispydactyl.exceptions.PterodactylApiError: API Request resulted in errors: [{'code': 'ValidationException', 'status': '422', 'detail': 'The environment must be an array.', 'source': {'line': 130, 'file': '/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php'}, 'meta': {'trace': ['#0 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php(26): Illuminate\Foundation\Http\FormRequest->failedValidation()', '#1 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php(30): Illuminate\Foundation\Http\FormRequest->validateResolved()', '#2 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/Container.php(1137): Illuminate\Foundation\Providers\FormRequestServiceProvider->Illuminate\Foundation\Providers\{closure}()', '#3 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/Container.php(1101): Illuminate\Container\Container->fireCallbackArray()', '#4 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/Container.php(1086): Illuminate\Container\Container->fireAfterResolvingCallbacks()', '#5 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/Container.php(707): Illuminate\Container\Container->fireResolvingCallbacks()', '#6 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\Container\Container->resolve()', '#7 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Foundation\Application->resolve()', '#8 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\Container\Container->make()', '#9 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(79): Illuminate\Foundation\Application->make()', '#10 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(48): Illuminate\Routing\ControllerDispatcher->transformDependency()', '#11 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(28): Illuminate\Routing\ControllerDhp(196): Illuminate\Routing\Route->runController()', '#15 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Routing/Router.php(685): Illuminate\Routing\Route->run()', '#16 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing\{closure}()', '#17 /var/www/pterodactyl/app/Http/Middleware/Api/AuthenticateIPAccess.php(28): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#18 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Pterodactyl\Http\Middleware\Api\AuthenticateIPAccess->handle()', '#19 /var/www/pterodactyl/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php(25): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#20 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Pterodactyl\Http\Middleware\Api\Application\AuthenticateApplicationUser->handle()', '#21 /var/www/pterodactyl/app/Http/Middleware/Api/AuthenticateKey.php(82): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#22 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Pterodactyl\Http\Middleware\Api\AuthenticateKey->handle()', '#23 /var/www/pterodactyl/app/Http/Middleware/Api/SetSessionDriver.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#24 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Pterodactyl\Http\Middleware\Api\SetSessionDriver->handle()', '#25 /var/www/pterodactyl/app/Http/Middleware/Api/ApiSubstituteBindings.php(75): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#26 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Pterodactyl\Http\Middleware\Api\ApiSubstituteBindings->handle()', '#27 /var/www/pterodactyl/app/Http/Middleware/Api/IsValidJson.php(36): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#28 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Pterodactyl\Http\Middleware\Api\IsValidJson->handle()', '#29 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#30 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Routing\Middleware\ThrottleRequests->handle()', '#31 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#32 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Routing/Router.php(687): Illuminate\Pipeline\Pipeline->then()', '#33 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Routing/Router.php(662): Illuminate\Routing\Router->runRouteWithinStack()', '#34 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Routing/Router.php(628): Illuminate\Routing\Router->runRoute()', '#35 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Routing/Router.php(617): Illuminate\Routing\Router->dispatchToRoute()', '#36 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(165): Illuminate\Routing\Router->dispatch()', '#37 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()', '#38 /var/www/pterodactyl/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#39 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle()', '#40 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#41 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()', '#42 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#43 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()', '#44 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#45 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()', '#46 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#47 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\EncryptCookies->handle()', '#48 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#49 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle()', '#50 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()', '#51 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(140): Illuminate\Pipeline\Pipeline->then()', '#52 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(109): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()', '#53 /var/www/pterodactyl/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle()', '#54 {main}'], 'source_field': 'environment', 'rule': 'array'}}]
Hello. I can't find how to delete server ?
Many of the features the API of Pterodactyl offers are not available.
For example. You can post/get files, list directories, and yet the feature is not available.
Hi, when i make an new user, everything works fine without issues.
Code:
from pydactyl import PterodactylClient
# Create a client to connect to the panel and authenticate with your API key.
api = PterodactylClient('http://10.10.10.5/', 'API key here!')
result = api.user.create_user('test', '[email protected]', 'Test21', 'Name')
user_id = result['attributes']['id']
api.user.get_user_info(user_id)
{'object': 'user', 'attributes': {'id': 14, 'external_id': None}}
But when i use:
from pydactyl import PterodactylClient
# Create a client to connect to the panel and authenticate with your API key.
api = PterodactylClient('http://10.10.10.5/', 'API key here!')
# Get a list of all servers the user has access to
my_servers = api.client.servers.list_servers()
# Get the unique identifier for the first server.
srv_id = my_servers[0]['attributes']['identifier']
# Check the utilization of the server
srv_utilization = api.client.servers.get_server_utilization(srv_id)
print(srv_utilization)
# Turn the server on.
api.client.servers.send_power_action(srv_id, 'start')
I get:
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http://10.10.10.5/api/client
I have everything on read/write. Can you help me?
I would like to use api to create a client api key
"Application API keys can only be generated my administrators."
be should be my
At the official Pterodacyl API documentation, under Client (/api/client
) and under Server (/servers/{server}
), there are two one GET
endpoint that is not exposed in pydactyl
.
These endpoints are:
https://pterodactyl.file.properties/api/client/servers/{server_id}/websocket
It will grant two additional new features:
Please add the function to check the response of the server, i.e. when you enter the command into the server console to write the response of the server.
Client docs are empty after the refactor:
https://pydactyl.readthedocs.io/en/latest/#module-pydactyl.api.client
PaginatedResponse needs a method to gather all of the results from all pages into a list. Something like:
response = api.nodes.list_nodes()
nodes = response.collect()
This is useful when you want all of the results for all pages up front and don't need to iterate over multiple pages.
This error occurs when updating a server build (not when creating a new server) and adding an allocation id, despite the allocation id not being already taken.
Let's say I have a server with the allocation id 58, and want to increase the allocation limit to 2, and add an allocation that is one port above the other (59) and know the allocation id of 59 isn't taken:
application.servers.update_server_build(125, 58, memory_limit=0, swap_limit=0, disk_limit=0, cpu_limit=0, io_limit=500, database_limit=1, allocation_limit=2, add_allocations=[59], remove_allocations=None, oom_disabled=True)
I get
'ValidationException', 'status': '422', 'detail': 'The allocation has already been taken.'
also, the backup_limit thing isn't fixed for update_server_build, and only works while creating a server ('ValidationException', 'status': '422', 'detail': 'The Backup Limit field must be present.').
Per my own docstring on success the response body will be empty. Seems like it's failing to decode the response.
client.client.send_power_action(id, 'start')
Traceback (most recent call last):
File "", line 1, in
File "D:\code\pydactyl\pydactyl\api\client.py", line 82, in send_power_action
data=data)
File "D:\code\pydactyl\pydactyl\api\base.py", line 94, in api_request
return response.json()
File "D:\code\pydactyl\venv\lib\site-packages\requests\models.py", line 895, in json
return complexjson.loads(self.text, **kwargs)
File "D:\Program Files\Python36\lib\json_init.py", line 354, in loads
return _default_decoder.decode(s)
File "D:\Program Files\Python36\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\Program Files\Python36\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Hi there,
Pydactyl has been lovely so far, but, I hit 1 roadblock when using it, and that is that I cannot change the resources of the server. I really need this since my users want to change their RAM, CPU or Storage, but they can't. It would be greatly appreciated if you could add it to the package.
Thanks,
Robert S.
Specifically, the headers retry-after, x-ratelimit-limit, and x-ratelimit-remaining
Hey guys,
When trying to turn on my bot on heroku it keeps getting this error message:
2020-11-23T15:15:17.772865+00:00 app[blazecraft.1]: discord.ext.commands.errors.ExtensionFailed: Extension 'comandos.minecraft.whitelist' raised an error: ModuleNotFoundError: No module named 'pydactyl.client'
I tried using the pydactyl module but then theres an error calling the 'PterodactylClient'
Can anyone help me please???
Thank you.
Hello, I'm fairly new to Python and I think my question in really stupid but I hope you can help me. In README.md it is advised to install pydactyl package using pip install py-dactyl
but in examples package referenced as 'pydactyl'. More to that, after installing py-dactyl
, VSCode do not recognize pydactyl
module in from ... import ...
line. I guess this is just my lack of Python knowledge but it is still confuses me.
Hello. I just had a question on the create_user function. How can I make it to where if on the panel there is already someone who uses the email/username they provide, it gives them an error? Or like, what is the error if there is already someone who is already using the email/username a user gives. Hope I'm not too confusing. Thank you!
I have a question, can the panel owner disable the file system?
Currently the only way Server.create_server()
works is by using the deployment service. This doesn't allow servers to be created with more than one allocation and doesn't allow for overallocation. Expose parameters for specifying allocation(s) by ID instead of using the deployment service.
hey there,
client.client.list_servers()
seems to be broken/not working.
Hi, I saw that you are working on 1.0 support. When do you think this will be ready?
Trying to use the example on the github page throws the following error:
hasattr(): attribute name must be string
I think the response data from pterodactyl is in a list form (because of this, the index of the object is an integer)
Using the older approach encapsulated in a try/catch block worked for me.
Hi, how to have user id from the username please??? Thanks.
This would only be feasible if it leaves the existing behavior intact as synchronous calls. There are ways to write the code as async and have a wrapper that generates a synchronous version. This could potentially be refactored so that pyadctyl exposes get_servers()
and async_get_servers()
without impacting the existing behavior.
Some relevant links
https://discuss.python.org/t/how-can-async-support-dispatch-between-sync-and-async-variants-of-the-same-code/15014/14
https://gist.github.com/blink1073/969aeba85f32c285235750626f2eadd8
Could you make a command which checks the status of the server? By Status I mean to check whether the server online or offline!
If the command already exists could you just provide an example please?
Add methods to Update server build configuration and Update server startup parameters.
My code :
from pydactyl import PterodactylClient
client = PterodactylClient('https://panel.krag.host', 'apikeyhere')
env = {
'GIT_ADDRESS': '', 'BRANCH': '', 'USER_UPLOAD': '0', 'AUTO_UPDATE': '0', 'BOT_PY_FILE': 'bot.py', 'PY_PACKAGES': '', 'USERNAME': '', 'ACCESS_TOKEN': '', 'REQUIREMENTS_FILE': '', 'STARTUP': 'if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == "1" ]]; then git pull; fi; if [[ ! -z {{PY_PACKAGES}} ]]; then pip install -U --target .local/lib/python3.8/site-packages {{PY_PACKAGES}}; fi; if [[ -f /home/container/${REQUIREMENTS_FILE} ]]; then pip install -U --target .local/lib/python3.8/site-packages -r ${REQUIREMENTS_FILE}; fi; /usr/local/bin/python /home/container/{{BOT_PY_FILE}}', 'P_SERVER_LOCATION': 'panel.krag.host', 'P_SERVER_ALLOCATION_LIMIT': 0
}
startupCMD = 'if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == "1" ]]; then git pull; fi; if [[ ! -z {{PY_PACKAGES}} ]]; then pip install -U --target .local/lib/python3.8/site-packages {{PY_PACKAGES}}; fi; if [[ -f /home/container/${REQUIREMENTS_FILE} ]]; then pip install -U --target .local/lib/python3.8/site-packages -r ${REQUIREMENTS_FILE}; fi; /usr/local/bin/python /home/container/{{BOT_PY_FILE}}'
client.servers.create_server(name="Testing API", user_id=5, nest_id=6, egg_id=15, memory_limit=1028, swap_limit=0, disk_limit=1024, location_ids=[1], environment=env, cpu_limit=25, io_limit=500, database_limit=0, allocation_limit=3, backup_limit=0, docker_image='quay.io/parkervcp/pterodactyl-images:debian_python-3.8', startup_cmd=startupCMD, dedicated_ip=False, start_on_completion=True, oom_disabled=True, default_allocation=None, additional_allocations=None)
print("created")
Error I get :
raise PterodactylApiError('API Request resulted in errors: %s' %
pydactyl.exceptions.PterodactylApiError: API Request resulted in errors: [{'code': 'NoViableNodeException', 'status': '400', 'detail': 'No nodes satisfying the requirements specified for automatic deployment could be found.'}]
I have only one node and its ID is 1 and its short code is testnode.krag.host. Can someone tell me what's wrong?
Whenever I try to call servers.list_servers(), it returns an error TypeError: list indices must be integers or slices, not str
instead of returning a dict containing all the servers. This is happening just by calling the function, while I don't even do anything else. (Except from declaring a few variables, and loading a env)
from main import API_KEY
from pydactyl import PterodactylClient
from dotenv import load_dotenv
import os
load_dotenv()
API_KEY = os.getenv("API_KEY")
client = PterodactylClient(url="panel",api_key=API_KEY)
test = client.servers.list_servers()
print(test)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.9/site-packages/pydactyl/api/servers.py", line 14, in list_servers
return PaginatedResponse(self, endpoint, response)
File "/usr/lib/python3.9/site-packages/pydactyl/responses.py", line 9, in __init__
self._initial_data = data['data']
TypeError: list indices must be integers or slices, not str
Instead of raising the error, it should have returned a dict containing all the servers.
Environment
Also, just a suggestion but try not to act all superior to other developers in your support server, when you really are not.
I am using client.servers.create_server(name='test server', user_id=1, nest_id=2, egg_id=9, memory_limit=0, swap_limit=0, disk_limit=0, location_ids=[1])
what should work, but I keep getting 400 errors, but I can't seem to find how to fix it because the error handler only gives 400 client error
and nothing else. I'd suggest editing the error handler so it says what is wrong. (you also may know me from Discord, That Guy#5275)
Requesting implementation of the Allocations endpoint (at least the fetching of the existing allocations)
Describe the bug
files api endpoint incorrectly quotes file contents
"eula=true"
!= eula=true
Data is being passed as json and not text
To Reproduce
api.client.servers.files.write_file(server_id="abcd1234",path="eula.txt", contents="eula=true")
"eula=true"
!= eula=true
Expected behavior
File contents should be unquoted
Environment
This is what i did to get it to work:
Line 81 in 7f65673
if 'files/write' not in url:
response = self._session.post(url, params=params, headers=headers,
json=data)
else:
headers['Content-Type']="application/text"
response = self._session.post(url, params=params, headers=headers,
data=data)
https://github.com/iamkubi/pydactyl/blob/master/pydactyl/api/nodes.py - line 58
It lists the only args are node_id, shortcode, and the desc.
https://dashflo.net/docs/api/pterodactyl/v0.7/#edit-node
^ this contains all the information that should be editable.
i think this is a pydactyl problem of it not being updated.
Can you add a description argument to the create_server method?
When I try to create a server using the client.servers.create_server
I get
Traceback (most recent call last):
File "test.py", line 11, in <module>
client.servers.create_server("Testing API", 5, 6, 15, 1028, 0, 1024, location_ids=[1], environment=env, cpu_limit=25, io_limit=500, database_limit=0, allocation_limit=3, backup_limit=0, docker_image='quay.io/parkervcp/pterodactyl-images:debian_python-3.8', startup_cmd=startupCMD, dedicated_ip=False, start_on_completion=True, oom_disabled=True, default_allocation=None, additional_allocations=None)
File "C:\Users\K I N G\AppData\Local\Programs\Python\Python38\lib\site-packages\pydactyl\api\servers.py", line 224, in create_server
egg_info = self._api_request(
File "C:\Users\K I N G\AppData\Local\Programs\Python\Python38\lib\site-packages\pydactyl\api\base.py", line 106, in _api_request
response.raise_for_status()
File "C:\Users\K I N G\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\models.py", line 941, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://panel.krag.host/api/application/nests/6/eggs/15?include=variables
This is my code
from pydactyl import PterodactylClient
client = PterodactylClient('https://panel.krag.host', 'apikeyhere')
env = {
'GIT_ADDRESS': '', 'BRANCH': '', 'USER_UPLOAD': '0', 'AUTO_UPDATE': '0', 'BOT_PY_FILE': 'bot.py', 'PY_PACKAGES': '', 'USERNAME': '', 'ACCESS_TOKEN': '', 'REQUIREMENTS_FILE': '', 'STARTUP': 'if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == "1" ]]; then git pull; fi; if [[ ! -z {{PY_PACKAGES}} ]]; then pip install -U --target .local/lib/python3.8/site-packages {{PY_PACKAGES}}; fi; if [[ -f /home/container/${REQUIREMENTS_FILE} ]]; then pip install -U --target .local/lib/python3.8/site-packages -r ${REQUIREMENTS_FILE}; fi; /usr/local/bin/python /home/container/{{BOT_PY_FILE}}', 'P_SERVER_LOCATION': 'testnode.krag.host', 'P_SERVER_UUID': '61ac3975-6df4-4cb4-9dc1-fab6e53bc527', 'P_SERVER_ALLOCATION_LIMIT': 0
}
startupCMD = 'if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == "1" ]]; then git pull; fi; if [[ ! -z {{PY_PACKAGES}} ]]; then pip install -U --target .local/lib/python3.8/site-packages {{PY_PACKAGES}}; fi; if [[ -f /home/container/${REQUIREMENTS_FILE} ]]; then pip install -U --target .local/lib/python3.8/site-packages -r ${REQUIREMENTS_FILE}; fi; /usr/local/bin/python /home/container/{{BOT_PY_FILE}}'
client.servers.create_server("Testing API", 5, 6, 15, 1028, 0, 1024, location_ids=[1], environment=env, cpu_limit=25, io_limit=500, database_limit=0, allocation_limit=3, backup_limit=0, docker_image='quay.io/parkervcp/pterodactyl-images:debian_python-3.8', startup_cmd=startupCMD, dedicated_ip=False, start_on_completion=True, oom_disabled=True, default_allocation=None, additional_allocations=None)
Hey, I'm curious that how can we connect the code in html and how it actually works and stuff can u please make a detailed info please
Describe the bug
I would like to a function where if the code is: result = api.servers.create_server(info) that the id of the just created server would be set.
Currently there is no way to pass include parameters through. This is useful for methods like Locations.get_location_info()
where you may want to pass ?include=allocations
in order to get all allocations for a location.
Create a test that lets you plugin panel credentials, makes a bunch/all of the pydactyl api calls against the panel, then compares the output against a known good.
Ideally it would be automated so that it spins up a panel using the official docker image(s). It could either load the database with known good data, or make API calls to create the known good data (e.g. create_node(name='integration_test_node')
then get_node()
that checks that the name was set).
A mock API server would likely be effort to maintain and decrease the accuracy of the integration test.
pydactyl/pydactyl/api/servers.py
Line 392 in abcc4eb
Hilariously this is the one thing I'm trying to do 🥇
I need this feature to automate the updating of my server jar with a script so I don't have to go into every server panel and do it by hand.
I'd send a PR if I had any clue how to go about setting up a dev environment for this - I still might if I get the time to research that. It looks like it should be fairly trivial and easy to base off of update_server_build
There is an error when trying to obtain the resource utilization
This link does not exist in the api: client/servers/%s/utilization
response = self._api_request(
endpoint='client/servers/%s/utilization' % server_id)
The correct one is: client/servers/%s/resources
response = self._api_request(
endpoint='client/servers/%s/resources' % server_id)
pydactyl is incompatible with panel version 1.0 (latest version)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.