diff options
author | Filipp Lepalaan <filipp@mac.com> | 2018-04-28 16:17:28 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2018-04-28 16:17:28 +0300 |
commit | d7d1e7f4aa7ed0e989d6d16f47537b6416debe2b (patch) | |
tree | 234df1b3a7129c5abb3211f70079a47a4248bcd0 /gsxws/core.py | |
parent | 6a85a5436da262b807e895832347e1e888c3f12a (diff) | |
download | py-gsxws-d7d1e7f4aa7ed0e989d6d16f47537b6416debe2b.tar.gz py-gsxws-d7d1e7f4aa7ed0e989d6d16f47537b6416debe2b.tar.bz2 py-gsxws-d7d1e7f4aa7ed0e989d6d16f47537b6416debe2b.zip |
Support overriding GSX_URL
Diffstat (limited to 'gsxws/core.py')
-rw-r--r-- | gsxws/core.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gsxws/core.py b/gsxws/core.py index b9d6f62..87f767b 100644 --- a/gsxws/core.py +++ b/gsxws/core.py @@ -98,7 +98,7 @@ ENVIRONMENTS = ( ) GSX_HOSTS = {'pr': '', 'it': 'it', 'ut': 'ut'} -GSX_URL = "https://gsxapi{env}.apple.com/gsx-ws/services/{region}/asp" +GSX_URL = os.getenv('GSX_URL', "https://gsxapi{env}.apple.com/gsx-ws/services/{region}/asp") def validate(value, what=None): @@ -199,6 +199,10 @@ class GsxError(Exception): return 'XXX' @property + def message(self): + return self.messages[0] + + @property def errors(self): return dict(list(zip(self.codes, self.messages))) @@ -367,7 +371,7 @@ class GsxRequest(object): logging.debug("Response: %s %s %s" % (res.status_code, res.reason, xml)) if res.status_code > 200: - raise GsxError(xml=xml, url=self._url, status=res.status_code) + raise GsxError(xml=xml, url=self._url, status=res.status_code, message=res.reason) if raw is True: return ET.fromstring(self.xml_response) |