diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-10-20 21:51:54 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-10-20 21:51:54 +0300 |
commit | 65f1bf52be1537cd4b077e0665cb76c462bb013b (patch) | |
tree | 9738cdae1a3aa076789b77b5c9bb47d0ef951aae /gsxws | |
parent | 550dab72a1563b6cb9f3d0bb8f9c92c02342caf9 (diff) | |
download | py-gsxws-65f1bf52be1537cd4b077e0665cb76c462bb013b.tar.gz py-gsxws-65f1bf52be1537cd4b077e0665cb76c462bb013b.tar.bz2 py-gsxws-65f1bf52be1537cd4b077e0665cb76c462bb013b.zip |
Give nicer error for invalid environment
Diffstat (limited to 'gsxws')
-rw-r--r-- | gsxws/core.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gsxws/core.py b/gsxws/core.py index 083efed..17f6556 100644 --- a/gsxws/core.py +++ b/gsxws/core.py @@ -278,7 +278,11 @@ class GsxRequest(object): "Send the final SOAP message" global GSX_ENV, GSX_REGION, GSX_HOSTS, GSX_URL, GSX_TIMEOUT - self._url = GSX_URL.format(env=GSX_HOSTS[GSX_ENV], region=GSX_REGION) + try: + self._url = GSX_URL.format(env=GSX_HOSTS[GSX_ENV], region=GSX_REGION) + except KeyError: + raise GsxError('GSX environment (%s) must be one of: %s' % (GSX_ENV, + ', '.join(GSX_HOSTS.keys()))) logging.debug(self._url) logging.debug(xmldata) |