-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspeed_recorder.pyw
34 lines (28 loc) · 941 Bytes
/
speed_recorder.pyw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import fast
import requests
import time
import subprocess
import sys
import urllib3
urllib3.disable_warnings()
gurl='https://docs.google.com/forms/d/e/******/formResponse'
gFormPreFilledURL = 'https://docs.google.com/forms/d/*********'
speed = None
# since we dont want to track work wifi
WifiName = "Your Home Wifi Name"
try:
p = subprocess.check_output( ["powershell.exe", "netsh", "wlan", "show", "interfaces"], shell=True)
content = p.decode()
if WifiName in content:
print (f"Connected to Wifi : {WifiName}")
speed = fast.main()
print(f"Speed = {speed}")
except Exception as e:
print(e)
if speed:
gFormParams = {'entry.198552954' : time.strftime('%d/%m/%Y %R'), 'entry.4356128' : speed}
resp = requests.post(gurl, data=gFormParams, verify=False)
if resp.status_code == 200:
print('Successfully posted data to Form.')
else:
print('Error: %s' % resp.content)