Passed
Push — main ( e5d7db...d12e93 )
by Yohann
56s
created

main.main()   A

Complexity

Conditions 3

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 21
rs 9.65
c 0
b 0
f 0
cc 3
nop 0
1
import dotenv
2
import socket
3
4
from client.src.client import Client
5
from client.src.ui import App
6
7
8
def main():
9
    print("Starting Client...")
10
11
    config = dotenv.dotenv_values('.env')
12
13
    ip = config.get('ip')
14
    if not ip:
15
        print("No server address were specified.")
16
        return
17
18
    port = config.get('port')
19
    if not port:
20
        print("No server port were specified.")
21
        return
22
23
    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
24
25
    client_socket.connect((ip, port))
26
    client_socket.setblocking(False)
27
28
    app = App(Client(client_socket))
29
30
31
if __name__ == '__main__':
32
    main()
33