HamQTH provides a simple interface for application developers.
Python-HamQTH
provides a simple interface to querying the HamQTH XML callbook service.
pip install hamqth
pipenv install hamqth
HamQTHClient
>>> client = HamQTHClient()
If you have a session-id you can use it.
>>> client = HamQTHClient(session_id='your-session-id')
>>> client.authenticate('username', 'password')
Check if your client is authenticated.
>>> client.is_authenticated
True
This only checks for the existence of a session ID, it does not validate it. If the session ID is not valid, methods requiring authentication will fail.
>>> client.logout()
>>> client.is_authenticated
False
Use the HamQTH XML callbook search with an authenticated client. If the callsign exists, an XML object is returned.
These methods require authentication. If the client is not authenticated, or if the session ID is invalid (e.g. expired), an exception will be raised.
>>> client.search_callsign('callsign')
>>> client.search_callsign_bio('callsign')
>>> client.search_callsign_recent_activity('callsign')