LookupLib

class pyhamtools.lookuplib.LookupLib(lookuptype='clublogxml', apikey=None, filename=None, logger=None)

This class provides a homogeneous interface to three different Amateur Radio Callsign lookup sources:

  1. Clublog.org (daily updated XML File)
  2. Clublog.org (HTTPS lookup)
  3. Country-files.com (infrequently updated PLIST File)

The class provides getters to access the data in a structured way. Even the interface is the same for all lookup sources, the returning data can be different. The documentation of the various methods provide more detail.

By default, LookupLib requires an Internet connection to download the libraries or perform the lookup against the Clublog API.

Parameters:

lookuptype : str

“clublogxml” or “clublogapi” or “countryfile”

apikey : str

Clublog API Key

filename : str, optional

Filename for Clublog XML or Country-files.com cty.plist file

logger : logging.getLogger(__name__), optional

Python logger

Methods

is_invalid_operation(callsign, timestamp=datetime.datetime(2014, 4, 24, 1, 26, 14, 12004, tzinfo=<UTC>))

Returns True if an operations is known as invalid

Parameters:

callsign : string

Amateur Radio callsign

timestamp : datetime, optional

datetime in UTC (tzinfo=pytz.UTC)

Returns:

bool :

True if a record exists for this callsign (at the given time)

Raises:

NoResult :

No matching callsign found

APIKeyMissingError :

API Key for Clublog missing or incorrect

Notes

This method is available for:

  • clublogxml
lookup_callsign(callsign=None, timestamp=datetime.datetime(2014, 4, 24, 1, 26, 14, 11988, tzinfo=<UTC>))

Returns lookup data if an exception exists for a callsign

Parameters:

callsign : string

Amateur radio callsign

timestamp : datetime, optional

datetime in UTC (tzinfo=pytz.UTC)

Returns:

dict :

Dictionary containing the country specific data of the callsign

Raises:

NoResult :

No matching callsign found

APIKeyMissingError :

API Key for Clublog missing or incorrect

Notes

This method is available for:

  • clublogxml
  • clublogapi
  • countryfile
lookup_entity(entity=None)

Returns lookup data of a ADIF Entity

Parameters:

entity : int

ADIF identifier of country

Returns:

dict :

Dictionary containing the country specific data

Raises:

NoResult :

No matching entity found

Notes

This method is available for:

  • clublogxml
lookup_prefix(prefix, timestamp=datetime.datetime(2014, 4, 24, 1, 26, 14, 11988, tzinfo=<UTC>))

Returns lookup data of a Prefix

Parameters:

prefix : string

Prefix of a Amateur Radio callsign

timestamp : datetime, optional

datetime in UTC (tzinfo=pytz.UTC)

Returns:

dict :

Dictionary containing the country specific data of the Prefix

Raises:

NoResult :

No matching Prefix found

APIKeyMissingError :

API Key for Clublog missing or incorrect

Notes

This method is available for:

  • clublogxml
  • countryfile
lookup_zone_exception(callsign, timestamp=datetime.datetime(2014, 4, 24, 1, 26, 14, 12009, tzinfo=<UTC>))

Returns a CQ Zone if an exception exists for the given callsign

Parameters:

callsign : string

Amateur radio callsign

timestamp : datetime, optional

datetime in UTC (tzinfo=pytz.UTC)

Returns:

int :

Value of the the CQ Zone exception which exists for this callsign (at the given time)

Raises:

NoResult :

No matching callsign found

APIKeyMissingError :

API Key for Clublog missing or incorrect

Notes

This method is available for:

  • clublogxml

Previous topic

PyHamTools

This Page