Skip to content
Snippets Groups Projects
Commit 71e1e273 authored by kunal arora's avatar kunal arora Committed by James Cameron
Browse files

2to3 changes

parent 777954a3
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ import base64
import binascii
import collections
import hashlib
import httplib
import http.client
import struct
OPCODE_CONTINUATION = 0x0
......@@ -37,7 +37,7 @@ WS_HDRS = ('UPGRADE', 'CONNECTION',
Message = collections.namedtuple('Message', ['tp', 'data', 'extra'])
class BadRequestException(httplib.HTTPException):
class BadRequestException(http.client.HTTPException):
code = 400
......@@ -120,7 +120,7 @@ def parse_message(buf):
g = parse_frame(buf)
while True:
result = g.next()
result = next(g)
if result:
break
else:
......@@ -153,9 +153,9 @@ def parse_message(buf):
g = parse_frame(buf)
while not fin:
result = g.next()
result = next(g)
while result is None:
result = g.next()
result = next(g)
yield
fin, opcode, payload = result
......@@ -219,7 +219,7 @@ def make_handshake(request):
if not request_line.startswith("GET"):
raise BadRequestException("The method should be GET")
message = httplib.HTTPMessage(request)
message = http.client.HTTPMessage(request)
headers = dict(message)
if 'websocket' != headers.get('upgrade', '').lower().strip():
......
......@@ -14,7 +14,7 @@
# limitations under the License.
import logging
from StringIO import StringIO
from io import StringIO
from collections import deque
from gi.repository import Gio
......@@ -97,7 +97,7 @@ class Session(GObject.GObject):
if self._parse_g is None:
self._parse_g = protocol.parse_message(self._message)
parsed_message = self._parse_g.next()
parsed_message = next(self._parse_g)
if parsed_message:
self._parse_g = None
......@@ -183,7 +183,7 @@ if __name__ == "__main__":
server.connect("session-started", session_started_cb)
port = server.start()
print "Listening on port %d" % port
print("Listening on port %d" % port)
main_loop = GLib.MainLoop()
main_loop.run()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment