pyhamtools/README.md

134 lines
3.9 KiB
Markdown
Raw Normal View History

2014-06-15 09:06:17 +02:00
# pyhamtools
2014-04-24 13:48:38 +02:00
Linux & MacOS [![Build Status](https://travis-ci.org/dh1tw/pyhamtools.svg?branch=master)](https://travis-ci.org/dh1tw/pyhamtools)
Windows [![Build status](https://ci.appveyor.com/api/projects/status/it6077sklplhgkyf?svg=true)](https://ci.appveyor.com/project/dh1tw/pyhamtools)
2015-05-23 10:08:08 +02:00
Pyhamtools is a set of functions and classes for Amateur Radio purpose.
Currently the core part is the Callsign Lookup which decodes any amateur radio
callsign string and provides the corresponding information (Country, DXCC
entity, CQ Zone...etc). This basic functionality is needed for Logbooks,
2018-01-28 00:30:34 +01:00
DX-Clusters or Log Checking. This and additional convenience features are
provided for the following sources:
2014-06-15 10:13:09 +02:00
Currently,
2018-01-28 00:30:34 +01:00
* [AD1C's Country-Files.org](http://country-files.org)
2014-06-15 09:06:17 +02:00
* [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)
2015-04-06 20:05:18 +02:00
* [QRZ.com XML API](http://www.qrz.com/XML/current_spec.html)
2014-06-15 09:06:17 +02:00
* [Redis.io](http://redis.io)
2018-01-28 00:30:34 +01:00
* [ARRL Logbook of the World (LOTW)](http://https://lotw.arrl.org)
* [eQSL.cc user list](https://www.eqsl.cc)
* [Clublog & OQRS user list](http://clublog.freshdesk.com/support/solutions/articles/3000064883-list-of-club-log-and-lotw-users)
2014-04-24 17:46:46 +02:00
Other modules include location based calculations (e.g. distance,
heading between Maidenhead locators) or frequency based calculations
(e.g. frequency to band).
2014-09-21 20:42:52 +02:00
2014-06-15 10:18:48 +02:00
## References
This Library is used in production at the [DXHeat.com DX Cluster](https://dxheat.com), performing several thousand lookups and calculations per day.
## Compatibility
2018-01-28 00:39:01 +01:00
Pyhamtools is since version 0.6.0 compatible with > Python 2.7 and > python 3.3.
We check compatibility on OSX, Windows and Linux with the following Python
versions:
2018-01-28 00:30:34 +01:00
* Python 2.7
* Python 3.3
* Python 3.4
* Python 3.5
* Python 3.6
* [pypy](https://pypy.org/) (Python 2)
2014-06-15 10:13:09 +02:00
## Documentation
2018-01-28 00:30:34 +01:00
Check out the full documentation including the changelog at:
[pyhamtools.readthedocs.org](http://pyhamtools.readthedocs.org/en/latest/index.html)
2014-06-15 09:06:17 +02:00
## License
2018-01-28 00:30:34 +01:00
Pyhamtools is published under the permissive [MIT License](http://choosealicense.com/licenses/mit/). You can find a good comparison of
Open Source Software licenses, including the MIT license at [choosealicense.com](http://choosealicense.com/licenses/)
2014-06-15 10:13:09 +02:00
## Installation
2014-06-15 09:06:17 +02:00
2018-01-28 00:30:34 +01:00
Easiest way to install pyhamtools is through the packet manager `pip`:
```bash
$ pip install pyhamtools
2014-06-15 10:25:16 +02:00
2018-01-28 00:30:34 +01:00
```
2014-06-15 09:06:17 +02:00
2014-06-15 10:18:48 +02:00
## Example: How to use pyhamtools
2014-06-15 09:06:17 +02:00
``` python
2014-09-21 20:42:52 +02:00
>>> from pyhamtools.locator import calculate_heading
>>> calculate_heading("JN48QM", "QF67bf")
74.3136
2014-06-15 09:06:17 +02:00
>>> 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,
2018-01-28 00:39:01 +01:00
'longitude': 10.0,
2014-06-15 09:06:17 +02:00
'cqz': 14,
'ituz': 28
}
```
2014-06-15 10:13:09 +02:00
## Testing
An extensive set of unit tests has been created for all Classes & Methods.
In order to be able to perform all tests you need a QRZ.com account and a
[Clublog API key](http://clublog.freshdesk.com/support/solutions/articles/54910-api-keys).
pyhamtools rely on the [pytest](https://docs.pytest.org/en/latest/) testing
framework. In order to install it with all the needed dependencies run:
```bash
$ pip install -r requirements-pytest.txt
```
The QRZ.com credentials and the Clublog API key have to be set in environment
variables:
```bash
$ export CLUBLOG_APIKEY="<your API key>"
$ export QRZ_USERNAME="<your qrz.com username>"
$ export QRZ_PWD="<your qrz.com password>"
```
To run the tests, simply execute:
```bash
$ pytest
```
## Generate the documentation
You can generate the documentation of pyhamtools with the following commands:
```bash
$ pip install -r requirements-docs.txt
$ cd docs
$ make html
```