Adds a way to test, and console bell
Also fixes exiting the program when done checking
This commit is contained in:
parent
d254930cca
commit
7f9cac6be8
11
scraper.py
11
scraper.py
@ -28,6 +28,9 @@ def scrape():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
testing = True
|
||||||
|
will_exit = False
|
||||||
|
|
||||||
hours = 3
|
hours = 3
|
||||||
|
|
||||||
arg_count = len(sys.argv)
|
arg_count = len(sys.argv)
|
||||||
@ -50,14 +53,15 @@ if __name__ == '__main__':
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
tmp = scrape()
|
tmp = scrape()
|
||||||
if text != tmp:
|
if text != tmp or testing:
|
||||||
|
print("\a")
|
||||||
print("New job posting! Here's the text:")
|
print("New job posting! Here's the text:")
|
||||||
print(tmp)
|
print(tmp)
|
||||||
print("And here's the link: https://kingslanding.nb.ca/employment/")
|
print("And here's the link: https://kingslanding.nb.ca/employment/")
|
||||||
print("Do you want to keep checking? (y/n): ", end="")
|
print("Do you want to keep checking? (y/n): ", end="")
|
||||||
choice = input()
|
choice = input()
|
||||||
if choice == "n" or choice == "N":
|
if choice == "n" or choice == "N":
|
||||||
break
|
will_exit = True
|
||||||
else:
|
else:
|
||||||
text = tmp
|
text = tmp
|
||||||
except urllib.error.URLError as err:
|
except urllib.error.URLError as err:
|
||||||
@ -67,4 +71,7 @@ if __name__ == '__main__':
|
|||||||
print("An unknown error has occurred: {}".format(err))
|
print("An unknown error has occurred: {}".format(err))
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
if will_exit:
|
||||||
|
exit(0)
|
||||||
|
else:
|
||||||
time.sleep(timer)
|
time.sleep(timer)
|
||||||
|
Loading…
Reference in New Issue
Block a user