-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscrape.py
47 lines (32 loc) · 1009 Bytes
/
scrape.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
import logging
import rich
import rich.console
import rich.traceback
from aviator import Aviator
rich.traceback.install()
console = rich.console.Console()
logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s', level=logging.INFO, datefmt='%m/%d/%Y %I:%M:%S')
def signal_handler(sig, frame):
global stop
print('You pressed Ctrl+C!')
stop = True
# sys.exit(0)
stop = False
def main():
while stop is False:
try:
aviator = Aviator(debug=True)
aviator.login()
aviator.go_to_game()
while aviator.in_game() and stop is False:
if aviator.disconnected():
break
aviator.wait_for_game_to_finish()
aviator.add_to_log(aviator.get_last_game_result())
except Exception as e:
console.print_exception(show_locals=True)
logging.error(e)
finally:
aviator.close()
if __name__ == "__main__":
main()