Server.py 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env python
  2. import configparser;
  3. import sys
  4. class Server():
  5. def __init__(self, config : configparser.ConfigParser):
  6. self.Address = None
  7. self.PortReceiver = None
  8. self.PortNotification = None
  9. self.WebUiUrl = None
  10. self.WebUiSequenceNotification = None
  11. self.WebUiConfigurationReceiver = None
  12. # search the required sections
  13. for key in config:
  14. if 'address' == key:
  15. self.Address = config['address']
  16. elif 'portreceiver' == key:
  17. self.PortReceiver = int(config['portreceiver'])
  18. elif 'portnotification' == key:
  19. self.PortNotification = int(config['portnotification'])
  20. if self.Address is None:
  21. sys.stderr.write('No server-address configuration found!')
  22. sys.exit(-1)
  23. if self.PortReceiver is None:
  24. sys.stderr.write('No server-port-receiver configuration found!')
  25. sys.exit(-1)
  26. if self.PortNotification is None:
  27. sys.stderr.write('No server-port-notification configuration found!')
  28. sys.exit(-1)