diff --git a/README.md b/README.md index 29bb371..24aac8e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,39 @@ -pyhamtools -========== +# pyhamtools -A Library with Amateur Radio specific Functions and Classes. +A Library with Amateur Radio specific Functions and Classes for any kind of Callsign Lookup Service, e.g. Logbooks +or DX-Clusters. Currently, +* [Country-Files.org](http://country-files.org), +* [Clublog Prefixes & Exceptions XML File](https://clublog.freshdesk.com/support/articles/54902-downloading-the-prefixes-and-exceptions-as) +* [Clublog DXCC Query API](http://clublog.freshdesk.com/support/articles/54904-how-to-query-club-log-for-dxcc) +* [Redis.io](http://redis.io) +are supported sources. +All services can be accessed through a unified interface. -The library is currently in Alpha state. Please do not use this library for operational code. +This Library is used in production at DxHeat.com. + +# Installation + +Easiest way to install pyhamtools is through the packet manager PIP: +`pip install pyhamtools' + +# How to use pyhamtools + +``` +>>> from pyhamtools import LookupLib, Callinfo +>>> my_lookuplib = LookupLib(lookuptype="countryfile") +>>> cic = Callinfo(my_lookuplib) +>>> cic.get_all("DH1TW") + { + 'country': 'Fed. Rep. of Germany', + 'adif': 230, + 'continent': 'EU', + 'latitude': 51.0, + 'longitude': -10.0, + 'cqz': 14, + 'ituz': 28 + } + +``` + +Check out the full documentation at: +[PyHamTools.readthedocs.org](pyhamtools.readthedocs.org/en/latest/index.html) \ No newline at end of file diff --git a/docs/build/doctrees/Callinfo.doctree b/docs/build/doctrees/Callinfo.doctree index be42781..18d2438 100644 Binary files a/docs/build/doctrees/Callinfo.doctree and b/docs/build/doctrees/Callinfo.doctree differ diff --git a/docs/build/doctrees/environment.pickle b/docs/build/doctrees/environment.pickle index 55dac28..b62293c 100644 Binary files a/docs/build/doctrees/environment.pickle and b/docs/build/doctrees/environment.pickle differ diff --git a/docs/build/doctrees/lookuplib.doctree b/docs/build/doctrees/lookuplib.doctree index eea2d5b..458a8fa 100644 Binary files a/docs/build/doctrees/lookuplib.doctree and b/docs/build/doctrees/lookuplib.doctree differ diff --git a/docs/build/html/Callinfo.html b/docs/build/html/Callinfo.html index 9530e74..99225ab 100644 --- a/docs/build/html/Callinfo.html +++ b/docs/build/html/Callinfo.html @@ -25,7 +25,7 @@ - +
Returns ADIF id of a callsign’s country
Strips off country prefixes (HC2/**DH1TW) and activity suffixes (DH1TW/P**).
This class is a wrapper for the following three Amateur Radio databases:
It’s aim is to provide a homogeneous interface to different databases.
-Typically an instance of this class is injected as a dependency in the Callinfo class, but it can also be used directly.
+Typically an instance of this class is injected as a dependency in the Callinfo class, but it can also +be used directly.
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.
+The entire lookup data can also be copied into Redis, which an extremely fast in-memory Key/Value store. +A LookupLib object can be instanciated to perform then all lookups in Redis, instead processing and loading +the data from Internet / File. This saves some time and allows several instances of LookupLib +to query the same data concurrently.
| Parameters: |
|
|---|
Copy the complete lookup data into redis. Old data will be overwritten.
+| Parameters: |
|
+
|---|---|
| Returns: | returns True when the data has been copied successfully into Redis + |
+
| Return type: | bool + |
+
Example
+Copy the entire lookup data from the Country-files.com PLIST File into Redis. This example requires a running +instance of Redis, as well the python Redis connector (pip install redis-py).
+>>> from pyhamtools import LookupLib
+>>> import redis
+>>> r = redis.Redis()
+>>> my_lookuplib = LookupLib(lookuptype="countryfile")
+>>> print my_lookuplib.copy_data_in_redis(redis_prefix="CF", redis_instance=r)
+True
+Now let’s create an instance of LookupLib, using Redis to query the data +>>> from pyhamtools import LookupLib +>>> import redis +>>> r = redis.Redis() +>>> my_lookuplib = LookupLib(lookuptype=”countryfile”, redis_instance=r, redis_prefix=”CF”) +>>> my_lookuplib.lookup_callsign(“3D2RI”) +{
+++u’adif’: 460, +u’continent’: ‘OC’, +u’country’: ‘Rotuma Island’, +u’cqz’: 32, +u’ituz’: 56, +u’latitude’: -12.48, +u’longitude’: -177.08
}
+Note
+This method is available for the following lookup type
+Returns True if an operations is known as invalid