Commit 89472538 authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

Add global variables for received and sent messages, print them before exiting

parent b037748b
Pipeline #230 skipped
......@@ -8,6 +8,8 @@ import multiprocessing, urllib.request, urllib.error, urllib.parse, time, os
import dbtools, phototools, setuptools
currentRun = []
rec = 0
snt = 0
def status(driver):
if "/main/login.php" not in driver.page_source:
......@@ -70,7 +72,7 @@ def messageHandler(sender, recipient, mid, date, driver, mode = 0, db = dbtools.
currentRun += [mid]
def pageHandler(driver, db = dbtools.dbHelper()):
global currentRun
global currentRun, rec, snt
count = 0
juha = BeautifulSoup(driver.page_source, "html5lib")
......@@ -88,8 +90,10 @@ def pageHandler(driver, db = dbtools.dbHelper()):
if not db.checkID(mid):
if mode == 0:
messageHandler(user, setuptools.user(), mid, date, driver, mode, db)
rec += 1
else:
messageHandler(setuptools.user(), user, mid, date, driver, mode, db)
snt += 1
count += 1
except IndexError:
pass
......@@ -124,3 +128,5 @@ if __name__ == "__main__":
p.terminate()
p.join()
driver.close()
print("Received", rec, "messages")
print("Sent", snt, "messages")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment