Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 compatibility updates #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
requests>=2.10.0,<3
websocket-client==0.43.0
requests>=2.18.3,<3
websocket_client==0.44.0
3 changes: 2 additions & 1 deletion screepsapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from screepsapi import *
from __future__ import absolute_import
from .screepsapi import *

__version__ = '0.2.0'
12 changes: 5 additions & 7 deletions screepsapi/screepsapi.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# Copyright @dzhu, @tedivm
# https://gist.github.com/dzhu/d6999d126d0182973b5c

from __future__ import print_function

from base64 import b64decode
from collections import OrderedDict
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
from io import StringIO

from gzip import GzipFile
import json
import logging
import requests
import ssl
import sys
import websocket
import zlib

Expand All @@ -30,7 +28,7 @@ def req(self, func, path, **args):
try:
return json.loads(r.text, object_pairs_hook=OrderedDict)
except ValueError:
print ('JSON failure:', r.text)
print('JSON failure: %s' % r.text)
return None

def get(self, _path, **args): return self.req(requests.get, _path, params=args)
Expand Down Expand Up @@ -238,7 +236,7 @@ def __init__(self, user, password, ptr=False, logging=False, host=None, secure=N
self.user_id = None

def on_error(self, ws, error):
print (error)
print(error)

def on_close(self, ws):
self.disconnect()
Expand Down