iamkubi / pydactyl

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

servers.list_servers() raising an error instead of returning a dict. #33

Closed Kabir-Sidhu closed 3 years ago

Kabir-Sidhu commented 3 years ago

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)

  1. Call list_servers() using sample code:
    
    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)

2. Fails with error:

Traceback (most recent call last): File "", line 1, in 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**
 - Pydactyl version: latest
 - Python version: 3.9

Also, just a suggestion but try not to act all superior to other developers in your support server, when you really are not.
Kabir-Sidhu commented 3 years ago

My bad, I forgot that Ryan told me he can not take more of how idiotic I and my questions were. I am sorry.