diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 0bd3096..efbcdb4 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -1,6 +1,14 @@ Changelog --------- +PyHamTools 0.5.1 +================ + +14. April 2015 + + * improved handling of expired QRZ.com sessions + + PyHamTools 0.5.0 ================ diff --git a/docs/source/conf.py b/docs/source/conf.py index 00a7622..aa2ea5b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -52,7 +52,7 @@ master_doc = 'index' # General information about the project. project = u'pyhamtools' -copyright = u'2014, Tobias Wellnitz, DH1TW' +copyright = u'2015, Tobias Wellnitz, DH1TW' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/pyhamtools/lookuplib.py b/pyhamtools/lookuplib.py index 977a775..f471627 100644 --- a/pyhamtools/lookuplib.py +++ b/pyhamtools/lookuplib.py @@ -788,16 +788,23 @@ class LookupLib(object): root = BeautifulSoup(response.text) lookup = {} - if root.error: #try to get a new session key and try to request again + if root.error: if re.search('Not found', root.error.text, re.I): #No data available for callsign raise KeyError(root.error.text) - elif re.search('Session Timeout', root.error.text, re.I): # Get new session key + + #try to get a new session key and try to request again + elif re.search('Session Timeout', root.error.text, re.I) or re.search('Invalid session key', root.error.text, re.I): self._apikey = apikey = self._get_qrz_session_key(self._username, self._pwd) - response = self._request_callsign_info_from_qrz(callsign, apikey) + response = self._request_callsign_info_from_qrz(callsign, apikey, apiv) root = BeautifulSoup(response.text) + + #if this fails again, raise error + if root.error: + raise AttributeError(root.error.text) #most likely session key invalid + else: - raise AttributeError(root.error.text) #most likely session key missing or invalid + raise AttributeError(root.error.text) #most likely session key missing if root.callsign is None: raise ValueError diff --git a/pyhamtools/version.py b/pyhamtools/version.py index 3431970..d035ac8 100644 --- a/pyhamtools/version.py +++ b/pyhamtools/version.py @@ -1,4 +1,4 @@ #VERSION = (0, 5, 0, 'dev') -VERSION = (0, 5, 0) +VERSION = (0, 5, 1) __release__ = ''.join(['-.'[type(x) == int]+str(x) for x in VERSION])[1:] __version__ = '.'.join((str(VERSION[0]), str(VERSION[1])))