From 86933f1954ab20842b615decfcdaf051d4dd6728 Mon Sep 17 00:00:00 2001 From: iou1name Date: Tue, 5 Nov 2019 08:08:04 -0500 Subject: [PATCH] add ssl support --- README.md | 2 +- warbot.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cb49204..46a1edc 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ All static data came from https://github.com/WFCD/warframe-worldstate-data ## Requirements Python 3.6+ -Python packages: `twisted service_identity requests` +Python packages: `twisted pyOpenSSL service_identity requests` ## Config `server` - Server address. diff --git a/warbot.py b/warbot.py index 9acdd34..177eb8e 100755 --- a/warbot.py +++ b/warbot.py @@ -11,7 +11,7 @@ import threading import configparser import requests -from twisted.internet import protocol, reactor +from twisted.internet import ssl, protocol, reactor from twisted.words.protocols import irc URI = "http://content.warframe.com/dynamic/worldState.php" @@ -288,6 +288,10 @@ if __name__ == "__main__": server = config["server"] port = config.getint("port") 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.run()