iamkubi / pydactyl

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

Listing Servers Issue #34

Closed Jaxon0 closed 2 years ago

Jaxon0 commented 3 years ago

hey there, client.client.list_servers() seems to be broken/not working.

ens-gijs commented 2 years ago

try client.servers.list_servers() instead

iamkubi commented 2 years ago

I believe this is just a documentation error. Since adding paginated responses to list_servers() the example code in the README doesn't use the correct structure for accessing the data.

ens-gijs commented 2 years ago

I'd say it's a documentation error - but Client.list_servers does exist so it seems like more than just documentation and calling client.client.list_servers() results in the following error

File "...pydactyl/api/client.py", line 13, in list_servers response = self._api_request(endpoint=endpoint) File "...pydactyl/api/base.py", line 106, in _api_request response.raise_for_status() File "/usr/lib/python3/dist-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://../api/client

iamkubi commented 2 years ago

Both exist, they're just part of different API namespaces. Anything under api/client requires a Client key, and anything under api/application requires an Application key. A 403 error usually means you're using the wrong type of API key, or a key without sufficient permissions.

ens-gijs commented 2 years ago

That make sense, however I don't see how a client key is created LOL. Ptero never has had the most intuitive UI :/

iamkubi commented 2 years ago

Agreed, it's not very intuitive.

image

iamkubi commented 2 years ago

Fixed by 3c45a16