diff -r 588aff83bb87 -r c17b82b1f573 rest.py --- a/rest.py Mon Aug 03 19:45:57 2015 +0300 +++ b/rest.py Tue Aug 04 22:39:22 2015 +0300 @@ -26,6 +26,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' +from __future__ import print_function import ssl import socket import errno @@ -44,15 +45,17 @@ g_portnumber = None g_throttle = [] +# TODO: get rid of this array valid_repos = ['torr_samaho/zandronum', 'torr_samaho/zandronum-stable', - 'crimsondusk/zandronum-sandbox', 'crimsondusk/zandronum-sandbox-stable', 'crimsondusk/zfc9000', 'blzut3/doomseeker'] + 'crimsondusk/zandronum-sandbox', 'crimsondusk/zandronum-sandbox-stable', + 'crimsondusk/zfc9000', 'blzut3/doomseeker'] def is_throttled (address): i = 0 while i < len (g_throttle): if g_throttle[i][1] <= datetime.utcnow(): - print 'Throttle of %s expired' % g_throttle[i][0] + print ('Throttle of %s expired' % g_throttle[i][0]) item = g_throttle.pop (i) # expired if item[0] == address: @@ -154,7 +157,7 @@ try: self.socket.do_handshake() break - except ssl.SSLError, err: + except ssl.SSLError as err: if err.args[0] == ssl.SSL_ERROR_WANT_READ: select.select([self.socket], [], []) elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: @@ -211,7 +214,7 @@ self.setsockopt (socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.bind (('', g_portnumber)) self.listen (5) - print 'REST server initialized' + print ('REST server initialized') def handle_accept (self): sock, address = self.accept()