-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
68 lines (52 loc) · 1.5 KB
/
app.py
File metadata and controls
68 lines (52 loc) · 1.5 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# [[source]]
# name = "pypi"
# url = "https://pypi.org/simple"
# verify_ssl = true
# [dev-packages]
# [packages]
# requests = "*"
# py-getch = "*"
# pyinstaller = "*"
# pywinauto = "*"
# [requires]
# python_version = "3.8"
from requests import get
from time import sleep
import winsound
from getch import pause
from win10toast import ToastNotifier
# from pywinauto import *
req = "https://www.google.com"
class Connect:
# app = application.Application()
def notif(self):
n = ToastNotifier()
n.show_toast("Bad Connection",
"Wait until your connection is stable", duration=3)
# while n.notification_active():
# sleep(0.1)
def check(self):
try:
res = get(req, timeout=4)
print("Connection is normal with status code : " + str(res.status_code))
except Exception as e:
print("error occured")
# winsound.MessageBeep(winsound.SND_ASYNC)
self.notif()
# SetForegroundWindow(find_window(title='Connection Checker.exe'))
# appp = self.app.connect(
# path="C:\\Users\\ZAKI\\Desktop\\Connection Checker.exe")
# appp.minimize()
# appp.restore()
sleep(1)
# CLA Main menu
print("=== Just press 'CTRL + C' to Exit/ close ===")
pause("Press any key to start...")
# var = True
try:
while True:
Connect().check()
sleep(2)
except Exception as e:
print('Closing the program', e)
sleep(3)