Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a method for converting a server dictionary to a server list #789

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tivasic
Copy link

@Tivasic Tivasic commented Oct 10, 2022

I found the following error in the code if I want to get a better server this way:

sp = speedtest.Speedtest()
best_servers = sp.get_servers()
sp.get_best_server(best_servers)

I get an error:

Traceback (most recent call last):
  File "/speedtest/main.py", line 18, in <module>
    test_connection()
  File "/speedtest/main.py", line 8, in test_connection
    sp.get_best_server(best_servers)
  File "\speedtest\venv\lib\site-packages\speedtest.py", line 1459, in get_best_server
    url = os.path.dirname(server['url'])
TypeError: 'float' object is not subscriptable

I also added the else block, otherwise the condition is incorrect on line 1456.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant