31 lines
871 B
Python
Executable File
31 lines
871 B
Python
Executable File
#!/usr/bin/python
|
|
# -*- coding: latin-1 -*-
|
|
|
|
#sudo apt-get install python-pip
|
|
#sudo pip install speedtest-cli
|
|
#speedtest-cli --list |grep France <== Recherche serveur le plus proche
|
|
|
|
import subprocess as sub
|
|
import os
|
|
|
|
f = os.popen('speedtest --share --simple')
|
|
#f = open('/tmp/speedtest')
|
|
valeurvariable = f.read()
|
|
|
|
liste = str(valeurvariable)
|
|
columns2 = liste.split(' ')
|
|
columns = [i for i in columns2 if i != '']
|
|
|
|
ping = str(columns[1])
|
|
download = str(columns[3])
|
|
upload = str(columns[5])
|
|
|
|
url='curl -y 2 "http://localhost:81/json.htm?type=command¶m=udevice&idx=323&nvalue=0&svalue='+ping+'"'
|
|
url1='curl -y 2 "http://localhost:81/json.htm?type=command¶m=udevice&idx=325&nvalue=0&svalue='+download+'"'
|
|
url2='curl -y 2 "http://localhost:81/json.htm?type=command¶m=udevice&idx=324&nvalue=0&svalue='+upload+'"'
|
|
|
|
os.system(url)
|
|
os.system(url1)
|
|
os.system(url2)
|
|
|