Skip to content

Commit b0f9813

Browse files
committed
Improve python2 backward comapt for ResponseError
Signed-off-by: Jason DeTiberus <[email protected]>
1 parent 6a5d56c commit b0f9813

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packet/baseapi.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def __init__(self, resp, data, exception=None):
2727
msg = data["error"]
2828
elif "errors" in data:
2929
msg = ", ".join(data["errors"])
30-
super().__init__("Error {0}: {1}".format(resp.status_code, msg), exception)
30+
super(ResponseError, self).__init__(
31+
"Error {0}: {1}".format(resp.status_code, msg), exception
32+
)
3133
self._response = resp
3234

3335
@property

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,30 @@
77
from setuptools import setup
88
except ImportError:
99
from ez_setup import use_setuptools
10+
1011
use_setuptools()
1112
from setuptools import setup
1213

1314

1415
with open("README.md") as readme, open("CHANGELOG.md") as changelog:
1516
long_description = readme.read() + "\n" + changelog.read()
1617

18+
1719
def read(rel_path):
1820
here = os.path.abspath(os.path.dirname(__file__))
19-
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
21+
with codecs.open(os.path.join(here, rel_path), "r") as fp:
2022
return fp.read()
2123

24+
2225
def get_version(rel_path):
2326
for line in read(rel_path).splitlines():
24-
if line.startswith('__version__'):
27+
if line.startswith("__version__"):
2528
delim = '"' if '"' in line else "'"
2629
return line.split(delim)[1]
2730
else:
2831
raise RuntimeError("Unable to find version string.")
2932

33+
3034
setup(
3135
name="packet-python",
3236
version=get_version("packet/__init__.py"),

0 commit comments

Comments
 (0)