add ssl support

This commit is contained in:
iou1name 2019-11-05 08:08:04 -05:00
parent 7dc97123be
commit 86933f1954
2 changed files with 7 additions and 3 deletions

View File

@ -6,7 +6,7 @@ All static data came from https://github.com/WFCD/warframe-worldstate-data
## Requirements ## Requirements
Python 3.6+ Python 3.6+
Python packages: `twisted service_identity requests` Python packages: `twisted pyOpenSSL service_identity requests`
## Config ## Config
`server` - Server address. `server` - Server address.

View File

@ -11,7 +11,7 @@ import threading
import configparser import configparser
import requests import requests
from twisted.internet import protocol, reactor from twisted.internet import ssl, protocol, reactor
from twisted.words.protocols import irc from twisted.words.protocols import irc
URI = "http://content.warframe.com/dynamic/worldState.php" URI = "http://content.warframe.com/dynamic/worldState.php"
@ -288,6 +288,10 @@ if __name__ == "__main__":
server = config["server"] server = config["server"]
port = config.getint("port") port = config.getint("port")
print("Connecting to:", server) print("Connecting to:", server)
reactor.connectTCP(server, port, WarBotFactory(config)) reactor.connectSSL(
server,
port,
WarBotFactory(config),
ssl.ClientContextFactory())
reactor.addSystemEventTrigger('before','shutdown', stop.set) reactor.addSystemEventTrigger('before','shutdown', stop.set)
reactor.run() reactor.run()