From 24d83f4ad95200c92a53d7acd3b3da8bc805bc2e Mon Sep 17 00:00:00 2001 From: dtookey Date: Tue, 20 Apr 2021 21:36:59 -0400 Subject: [PATCH] fixed urlencode --- twitch_script_standalone.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/twitch_script_standalone.py b/twitch_script_standalone.py index f9a706c..267df05 100644 --- a/twitch_script_standalone.py +++ b/twitch_script_standalone.py @@ -87,16 +87,15 @@ class Twitch_Module(): def is_command(self, word: str) -> bool: # todo need to url-escape word - clean_param = urlencode(word, quote_via=quote_plus) - url = "http://localhost:5000/api/v1/command?name=%s" % clean_param + clean_param = urlencode({'name': word}) + url = "http://localhost:5000/api/v1/command?%s" % clean_param resp = requests.get(url) return resp.status_code == 200 def exec_command(self, command: str, rest: str): - #todo need to url-escape command and rest - clean_command = urlencode(command, quote_via=quote_plus) - clean_rest = urlencode(rest, quote_via=quote_plus) - url = "http://localhost:5000/api/v1/exec?command_name=%s&rest=%s" % (clean_command, clean_rest) + # todo need to url-escape command and rest + params = urlencode({'command_name': command, 'rest': rest}) + url = "http://localhost:5000/api/v1/exec?%s" % params resp = requests.get(url) if resp.status_code == 200: data = loads(resp.text) @@ -104,7 +103,7 @@ class Twitch_Module(): if msg is not None: self.send_message(msg) else: - #todo handle failed requests + # todo handle failed requests pass def send_whisper(self, user, message):