Skip to content
Advertisement

how to force python call to speedtest.py use secure servers

I’m calling speedtest.py from my python program in order to run a speed test. After importing speedtest.py I create a speedtest object using

JavaScript

then run upload/download tests. This has been working, but recently it has been failing. I found if I just ran speedtest from the cli, I’d get a 403 forbidden error. I then read than Speedtest now requires the use of secure servers. SO, if from the cli I type

JavaScript

it runs perfectly.

My question is: How can I tell speedtest to use secure servers from my python program?

I’ve tried variations of

JavaScript

and

JavaScript

Advertisement

Answer

I haven’t used the Python API for speedtest-cli, but looking at the source, Speedtest() has a secure parameter which presumably makes it require secure servers. So you’d just need to specify it when instantiating the class:

JavaScript

BTW, there is documentation for the Python API, but it’s super barebones and doesn’t mention this parameter at all.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement