aboutsummaryrefslogtreecommitdiffstats
path: root/local/handler/GithubHandler.py
diff options
context:
space:
mode:
authorScott Wichser <blast007@users.sourceforge.net>2019-01-23 22:38:51 +0000
committerScott Wichser <blast007@users.sourceforge.net>2019-01-23 22:38:51 +0000
commitd85f5f6e634b80416e0cee1c80377978c6f9f6c1 (patch)
treef19e0e6ac524f31b941c7ad30b2347cb8deba532 /local/handler/GithubHandler.py
parentb431c5476514784f97985419323cf4bec9a61500 (diff)
downloadsupybot_github-d85f5f6e634b80416e0cee1c80377978c6f9f6c1.tar.gz
supybot_github-d85f5f6e634b80416e0cee1c80377978c6f9f6c1.tar.bz2
supybot_github-d85f5f6e634b80416e0cee1c80377978c6f9f6c1.zip
Through the use of 2to3 and some manual fixes, the plugin loads successfully on Python 3.
Diffstat (limited to 'local/handler/GithubHandler.py')
-rw-r--r--local/handler/GithubHandler.py40
1 files changed, 20 insertions, 20 deletions
diff --git a/local/handler/GithubHandler.py b/local/handler/GithubHandler.py
index 0c3a0dc..baf2cf1 100644
--- a/local/handler/GithubHandler.py
+++ b/local/handler/GithubHandler.py
@@ -5,12 +5,12 @@ import json
import time
import random
import socket
-import urllib
-import urllib2
+import urllib.request, urllib.parse, urllib.error
+import urllib.request, urllib.error, urllib.parse
import hashlib
-import urlparse
+import urllib.parse
import threading
-import BaseHTTPServer
+import http.server
from time import strftime
import supybot.log as log
@@ -27,30 +27,30 @@ import supybot.callbacks as callbacks
from ..globals import *
from ..utility import *
-import PingHandler
-import PushHandler
-import WikiHandler
-import IssueHandler
-import StatusHandler
-import TravisHandler
-import MessageHandler
-import NetlifyHandler
-import ReleaseHandler
-import UnknownHandler
-import AppVeyorHandler
-import CreateDeleteHandler
-import IssueCommentHandler
+from . import PingHandler
+from . import PushHandler
+from . import WikiHandler
+from . import IssueHandler
+from . import StatusHandler
+from . import TravisHandler
+from . import MessageHandler
+from . import NetlifyHandler
+from . import ReleaseHandler
+from . import UnknownHandler
+from . import AppVeyorHandler
+from . import CreateDeleteHandler
+from . import IssueCommentHandler
from .. import theme as themes
#TODO: Use a better name and location for this
-class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler):
+class GithubHandler(http.server.BaseHTTPRequestHandler):
def do_POST(s):
"""Respond to a POST request."""
length = int(s.headers['Content-Length'])
payload = s.rfile.read(length).decode('utf-8')
if 'content-type' not in s.headers or s.headers['content-type'] == 'application/x-www-form-urlencoded':
- post_data = urlparse.parse_qs(payload)
+ post_data = urllib.parse.parse_qs(payload)
data = json.loads(post_data['payload'][0])
else:
data = json.loads(payload)
@@ -81,7 +81,7 @@ class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler):
# Analyse the URL
i = 0
for part in path:
- part = urllib.unquote(part)
+ part = urllib.parse.unquote(part)
if i == 1 and requireCode:
receivedcode = part

© 2014-2024 Faster IT GmbH | imprint | privacy policy