|
6 | 6 | from rich.table import Table
|
7 | 7 | from rich import box
|
8 | 8 | from rich.style import Style
|
9 |
| -from requests import Session |
10 |
| -from signalr import Connection |
11 | 9 | #</editor-fold>
|
12 | 10 |
|
13 | 11 | #<editor-fold desc="Set Ups">
|
|
17 | 15 | mainStyle = Style(color = "yellow")
|
18 | 16 | #</editor-fold>
|
19 | 17 |
|
20 |
| -def LiveTiming(username, password): |
21 |
| - #LiveTimingResults() |
22 |
| - with Session() as session: |
23 |
| - # create a connection |
24 |
| - connection = Connection("https://livetiming.formula1.com/signalr", session) |
25 |
| - |
26 |
| - # get chat hub |
27 |
| - chat = connection.register_hub('chat') |
28 |
| - |
29 |
| - # start a connection |
30 |
| - connection.start() |
31 |
| - |
32 |
| - # create new chat message handler |
33 |
| - def print_received_message(data): |
34 |
| - print('received: ', data) |
35 |
| - |
36 |
| - # create new chat topic handler |
37 |
| - def print_topic(topic, user): |
38 |
| - print('topic: ', topic, user) |
39 |
| - |
40 |
| - # create error handler |
41 |
| - def print_error(error): |
42 |
| - print('error: ', error) |
43 |
| - |
44 |
| - # receive new chat messages from the hub |
45 |
| - chat.client.on('newMessageReceived', print_received_message) |
46 |
| - |
47 |
| - # process errors |
48 |
| - connection.error += print_error |
49 |
| - |
50 |
| - # start connection, optionally can be connection.start() |
51 |
| - with connection: |
52 |
| - # post new message |
53 |
| - #chat.server.invoke('send', 'Python is here') |
54 |
| - |
55 |
| - # change chat topic |
56 |
| - #chat.server.invoke('setTopic', 'Welcome python!') |
57 |
| - |
58 |
| - # invoke server method that throws error |
59 |
| - #chat.server.invoke('requestError') |
60 |
| - |
61 |
| - # post another message |
62 |
| - # chat.server.invoke('send', 'Bye-bye!') |
63 |
| - |
64 |
| - # wait a second before exit |
65 |
| - connection.wait(1) |
| 18 | +def LiveTiming(): |
| 19 | + LiveTimingResults() |
66 | 20 |
|
67 | 21 | def LiveTimingResults():
|
68 | 22 | # Creates A Table To Output The Results
|
|
0 commit comments