diff options
author | Scott Wichser <blast007@users.sourceforge.net> | 2019-01-25 02:30:15 +0000 |
---|---|---|
committer | Scott Wichser <blast007@users.sourceforge.net> | 2019-01-25 02:30:15 +0000 |
commit | f2de89d8a638da27d9efe49c473536046c48c3bd (patch) | |
tree | cfeca5a6a08890b6213e4b6c61c4bc063a552773 | |
parent | b006a4f329962555cfa10fe3bef7cfd3a29480c0 (diff) | |
download | supybot_github-f2de89d8a638da27d9efe49c473536046c48c3bd.tar.gz supybot_github-f2de89d8a638da27d9efe49c473536046c48c3bd.tar.bz2 supybot_github-f2de89d8a638da27d9efe49c473536046c48c3bd.zip |
Fix some TypeError's.
-rw-r--r-- | local/handler/GithubHandler.py | 12 | ||||
-rw-r--r-- | local/utility.py | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/local/handler/GithubHandler.py b/local/handler/GithubHandler.py index baf2cf1..99c5931 100644 --- a/local/handler/GithubHandler.py +++ b/local/handler/GithubHandler.py @@ -105,22 +105,22 @@ class GithubHandler(http.server.BaseHTTPRequestHandler): s.send_response(200) s.send_header('Content-type', 'text/plain') s.end_headers() - s.wfile.write("Thanks!\n") - s.wfile.write(s.path.split('/')) - s.wfile.write("\n") + s.wfile.write("Thanks!\n".encode()) + s.wfile.write(repr(s.path.lstrip('/').split('/')).encode()) + s.wfile.write("\n".encode()) except socket.error: pass if requireCode and receivedcode != configValue('passcode'): # The password is wrong - s.wfile.write("The password is wrong\n") + s.wfile.write("The password is wrong\n".encode()) return # Handle Github secrets secret = getChannelSecret(channel) if secret is not None: if not 'X-Hub-Signature' in s.headers: - s.wfile.write("This channel requires a secret\n") + s.wfile.write("This channel requires a secret\n".encode()) return digest = "sha1=%s" % (hmac.new(secret, payload, hashlib.sha1).hexdigest(),) @@ -130,7 +130,7 @@ class GithubHandler(http.server.BaseHTTPRequestHandler): log.debug("provided digest: %s", provided) if not secureCompare(digest, provided): - s.wfile.write("Invalid secret key\n") + s.wfile.write("Invalid secret key\n".encode()) return brackets = parseBrackets(configValue('brackets')) diff --git a/local/utility.py b/local/utility.py index ad63504..01159a5 100644 --- a/local/utility.py +++ b/local/utility.py @@ -72,7 +72,7 @@ def parseBrackets(bracketConfig): if "M" in bracketConfig: return tuple(bracketConfig.split('M', 1)) else: - mid = len(bracketConfig) / 2 + mid = math.floor(len(bracketConfig) / 2) if len(bracketConfig) % 2 == 0: return (bracketConfig[:mid], bracketConfig[mid:]) else: |