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 ...@@ -20,7 +20,7 @@ import base64
import binascii import binascii
import collections import collections
import hashlib import hashlib
import httplib import http.client
import struct import struct
OPCODE_CONTINUATION = 0x0 OPCODE_CONTINUATION = 0x0
...@@ -37,7 +37,7 @@ WS_HDRS = ('UPGRADE', 'CONNECTION', ...@@ -37,7 +37,7 @@ WS_HDRS = ('UPGRADE', 'CONNECTION',
Message = collections.namedtuple('Message', ['tp', 'data', 'extra']) Message = collections.namedtuple('Message', ['tp', 'data', 'extra'])
class BadRequestException(httplib.HTTPException): class BadRequestException(http.client.HTTPException):
code = 400 code = 400
...@@ -120,7 +120,7 @@ def parse_message(buf): ...@@ -120,7 +120,7 @@ def parse_message(buf):
g = parse_frame(buf) g = parse_frame(buf)
while True: while True:
result = g.next() result = next(g)
if result: if result:
break break
else: else:
...@@ -153,9 +153,9 @@ def parse_message(buf): ...@@ -153,9 +153,9 @@ def parse_message(buf):
g = parse_frame(buf) g = parse_frame(buf)
while not fin: while not fin:
result = g.next() result = next(g)
while result is None: while result is None:
result = g.next() result = next(g)
yield yield
fin, opcode, payload = result fin, opcode, payload = result
...@@ -219,7 +219,7 @@ def make_handshake(request): ...@@ -219,7 +219,7 @@ def make_handshake(request):
if not request_line.startswith("GET"): if not request_line.startswith("GET"):
raise BadRequestException("The method should be GET") raise BadRequestException("The method should be GET")
message = httplib.HTTPMessage(request) message = http.client.HTTPMessage(request)
headers = dict(message) headers = dict(message)
if 'websocket' != headers.get('upgrade', '').lower().strip(): if 'websocket' != headers.get('upgrade', '').lower().strip():
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
import logging import logging
from StringIO import StringIO from io import StringIO
from collections import deque from collections import deque
from gi.repository import Gio from gi.repository import Gio
...@@ -97,7 +97,7 @@ class Session(GObject.GObject): ...@@ -97,7 +97,7 @@ class Session(GObject.GObject):
if self._parse_g is None: if self._parse_g is None:
self._parse_g = protocol.parse_message(self._message) self._parse_g = protocol.parse_message(self._message)
parsed_message = self._parse_g.next() parsed_message = next(self._parse_g)
if parsed_message: if parsed_message:
self._parse_g = None self._parse_g = None
...@@ -183,7 +183,7 @@ if __name__ == "__main__": ...@@ -183,7 +183,7 @@ if __name__ == "__main__":
server.connect("session-started", session_started_cb) server.connect("session-started", session_started_cb)
port = server.start() port = server.start()
print "Listening on port %d" % port print("Listening on port %d" % port)
main_loop = GLib.MainLoop() main_loop = GLib.MainLoop()
main_loop.run() 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