forked from zebpalmer/pyQRZ
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqrz_example.py
28 lines (24 loc) · 840 Bytes
/
qrz_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from __future__ import print_function
from __future__ import print_function
from __future__ import print_function
from qrz import QRZ
def print_keys(key_names, query_result):
"""
Prints results and does not throw exception on queries
like W1AW where fname key does not exist
"""
info = ""
for key_name in key_names:
if key_name in query_result:
info += query_result[key_name] + " "
print(info)
if __name__ == '__main__':
qrz = QRZ('./settings.cfg')
result = qrz.callsign("w7atc")
print_keys(['fname', 'name'], result)
print_keys(['addr2', 'state'], result)
print_keys(['country'], result)
# Show all the data available from QRZ.com
print('-' * 50)
for dict_key, dict_value in sorted(result.items()):
print(u'{0}: {1}'.format(dict_key, dict_value))