iamkubi / pydactyl

Python wrapper for the Pterodactyl Panel API
MIT License
69 stars 21 forks source link

Create server issue #35

Closed ZikaCodez closed 3 years ago

ZikaCodez commented 3 years ago

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)