-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
50 lines (41 loc) · 1.23 KB
/
main.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import tkinter as tk
import GUI
import threading
import speedtest
import mysql.connector
import datetime
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
mydb = mysql.connector.connect(
host="localhost",
user='yashaskm11',
password='4747',
database='Netmonk'
)
mycursor = mydb.cursor(buffered=True)
st=speedtest.Speedtest()
def pushspeed(val):
sql="insert into speedmonk values (%s,%s,%s)"
mycursor.execute(sql,val)
mydb.commit()
def SpeedT():
while True:
val=speed()
pushspeed(val)
def speed():
ul=st.upload()
dl=st.download()
ul = round(ul / (1e+6), 2)
dl = round(dl / (1e+6), 2)
timestamp = datetime.datetime.now()
return (ul,dl,timestamp)
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
print(speed())
#t1=threading.Thread(target=GUI.Gui)
# See PyCharm help at https://www.jetbrains.com/help/pycharm/