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)
Call list_servers() using sample code:
from main import API_KEY
from pydactyl import PterodactylClient
from dotenv import load_dotenv
import os
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.
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)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 "", 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