mirror of
https://github.com/dh1tw/pyhamtools.git
synced 2025-12-06 06:52:00 +01:00
improved handling of expired QRZ.com session keys
This commit is contained in:
parent
6ae47d1442
commit
88a80525ad
|
|
@ -1,6 +1,14 @@
|
|||
Changelog
|
||||
---------
|
||||
|
||||
PyHamTools 0.5.1
|
||||
================
|
||||
|
||||
14. April 2015
|
||||
|
||||
* improved handling of expired QRZ.com sessions
|
||||
|
||||
|
||||
PyHamTools 0.5.0
|
||||
================
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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])))
|
||||
|
|
|
|||
Loading…
Reference in a new issue