https://github.com/ocelotsloth/goqrz
Golang QRZ.com XML Library and Command Line Client
https://github.com/ocelotsloth/goqrz
amateur-radio callsigns cli ham-radio qrz
Last synced: about 1 month ago
JSON representation
Golang QRZ.com XML Library and Command Line Client
- Host: GitHub
- URL: https://github.com/ocelotsloth/goqrz
- Owner: ocelotsloth
- License: mit
- Created: 2018-10-04T18:49:29.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2021-02-03T04:50:57.000Z (over 5 years ago)
- Last Synced: 2026-05-09T06:17:13.082Z (about 2 months ago)
- Topics: amateur-radio, callsigns, cli, ham-radio, qrz
- Language: Go
- Homepage: http://goqrz.com
- Size: 111 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# GoQRZ Library
GoQRZ is a simple Go Library which implements the QRZ.com [specification](https://www.qrz.com/XML/current_spec.html).
## Usage
First, import the library:
```go
import "github.com/ocelotsloth/goqrz"
```
Next, create a new session, providing a QRZ.com username and password as well as a User Agent which identifies your program to the API service:
```go
qrzSession := goqrz.GetSession("user", "pass", "userAgent")
```
Finally, request data using the `GetCallsign` or `GetDXCC` functions:
```go
qrzSession.GetCallsign("KN4IJZ")
```
Documentation for the returned datatypes can be found via godoc or within the source code.
## GoQRZ Command Line Interface
Included in this library is a CLI tool which can be used to query QRZ for information on callsigns and DXCC entities.
### Install GoQRZ CLI
There are two ways to install and use the CLI; compiling from source and downloading precompiled binaries.
#### From Source
The CLI can be compiled from source by running the following:
```shell
go get github.com/ocelotsloth/goqrz/goqrz
```
Provided your `GOPATH` is configured correctly you should now be able to run `goqrz` from the command line.
#### Precompiled Binaries
Look at the [releases](https://github.com/ocelotsloth/goqrz/releases) page on github for downloadable binaries. This utility can be cross-compiled to most any popular archetecture in use. Open an issue if you need an additional archetecture added to the list of precompiled binaries.
### CLI Usage
Before pulling data from the XML API, it is important to log in. This library does its best to remain secure by not storing your username or password between calls. Instead it provides two methods to store the session key.
#### Get Session Key
First, run `goqrz login -u -p ` to receive your session key. The key is printed to stdout, so you can store it as an environment variable (store it to `GOQRZ_KEY`) or by passing the key to each subsequent call via the `--key` flag.
#### Query Data
There are two queries currently implemented: callsigns and dxcc zones.
##### Callsigns
To retrieve callsign data, use the command `goqrz callsign [--key=] Callsign [AdditionalCallsigns...]`. To be efficient, please consider batching your callsign requests to one single call to the `goqrz` CLI. This will reduce the overhead with setting up the connection to QRZ.com.
Data is returned as JSON. I personally recommend using `jq` to further deal with the data.
##### DXCC Zones
DXCC data can be retrieved in the exact same fasion as Callsigns, except with the following syntax: `goqrz dxcc [--key=] DXCCID [AdditionalDXCCIDs...]`