From 0e950154103ba9385b13f76548befa87509995f3 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 16 Aug 2014 22:37:25 +0200 Subject: Remove sys.version_info checks for python2 and clean some imports. --- slixmpp/componentxmpp.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'slixmpp/componentxmpp.py') diff --git a/slixmpp/componentxmpp.py b/slixmpp/componentxmpp.py index 52829dfa..b00e084e 100644 --- a/slixmpp/componentxmpp.py +++ b/slixmpp/componentxmpp.py @@ -12,10 +12,7 @@ :license: MIT, see LICENSE for more details """ -from __future__ import absolute_import - import logging -import sys import hashlib from slixmpp.basexmpp import BaseXMPP @@ -136,10 +133,7 @@ class ComponentXMPP(BaseXMPP): # Construct a hash of the stream ID and the component secret. sid = xml.get('id', '') - pre_hash = '%s%s' % (sid, self.secret) - if sys.version_info >= (3, 0): - # Handle Unicode byte encoding in Python 3. - pre_hash = bytes(pre_hash, 'utf-8') + pre_hash = bytes('%s%s' % (sid, self.secret), 'utf-8') handshake = ET.Element('{jabber:component:accept}handshake') handshake.text = hashlib.sha1(pre_hash).hexdigest().lower() -- cgit v1.2.3