Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

hamkit.repeaterbook

PyPI - Version PyPI - Python Version


[!NOTE]
hamkit.repeaterbook is a small standalone component of hamkit. You can use it by itself (see below) if queries against the RepeaterBook database is all that you need. Alternatively, install the entire collection of HamKit modules with pip install hamkit.

[!TIP]
Even if you do not use RepeaterBook instances directly (e.g, if you want to run your own database queries), RepeaterBook.download() is useful for downloading and parsing the data into sqlite for local queries.

A simple library to work with a local copy of the RepeaterBook US & Canada database

pip install hamkit-repeaterbook

Download the RepeaterBook data, and load it into a sqlite database

import os
import logging
from hamkit.repeaterbook import RepeaterBook

logging.basicConfig(level=logging.DEBUG)

sources = [
    "https://www.repeaterbook.com/api/export.php?state=Washington",
    "https://www.repeaterbook.com/api/export.php?state=Washington&stype=gmrs",
]

# Download the database, if not already present
db_file = "repeaterbook.db"
if not os.path.isfile(db_file):
    RepeaterBook.download("repeaterbook.db", sources),

# Query information about a callsign
rb = RepeaterBook(db_file)
for r in rb.find_nearest(lat=47.658009, lon=-122.103288):
    print(f"{r}\n")

which will output the following:

Repeater(callsign='KC7IYE', downlink_freq=145.31, downlink_tone='', uplink_freq=144.71, uplink_tone='103.5', nearest_city='Redmond', landmark='', county='King', state='Washington', state_id='53', country='United States', latitude=47.67399979, longitude=-122.12200165, precise=0, use='OPEN', operational_status='On-air', fm_analog=1, ares=0, races=0, skywarn=0, canwarn=0, allstar_node='0', echoLink_node='', irlp_node='0', wires_node='', dmr=0, dmr_color_code='', dmr_id='', dstar=0, nxdn=0, apco_p25=0, p25_nac='', m17=0, m17_can='', tetra=0, tetra_mcc='', tetra_mnc='', system_fusion=0, ysf_dg_id_uplink='', ysf_dg_is_downlink='', ysf_dsc='', notes='', last_update='2021-07-06', distance=2.2639443534336845)

Repeater(callsign='KC7IYE', downlink_freq=53.07, downlink_tone='179.9', uplink_freq=51.37, uplink_tone='100.0', nearest_city='Redmond', landmark='', county='King', state='Washington', state_id='53', country='United States', latitude=47.6925, longitude=-122.1114, precise=0, use='OPEN', operational_status='On-air', fm_analog=1, ares=0, races=0, skywarn=0, canwarn=0, allstar_node='0', echoLink_node='0', irlp_node='0', wires_node='', dmr=0, dmr_color_code='', dmr_id='', dstar=0, nxdn=0, apco_p25=0, p25_nac='', m17=0, m17_can='', tetra=0, tetra_mcc='', tetra_mnc='', system_fusion=0, ysf_dg_id_uplink='', ysf_dg_is_downlink='', ysf_dsc='', notes='', last_update='2023-03-17', distance=3.8830227407299263)

Repeater(callsign='N7QT', downlink_freq=442.325, downlink_tone='103.5', uplink_freq=447.325, uplink_tone='103.5', nearest_city='Redmond', landmark='', county='King', state='Washington', state_id='53', country='United States', latitude=47.67459, longitude=-122.05393, precise=0, use='OPEN', operational_status='Unknown', fm_analog=1, ares=0, races=0, skywarn=0, canwarn=0, allstar_node='0', echoLink_node='0', irlp_node='0', wires_node='', dmr=1, dmr_color_code='2', dmr_id='311757', dstar=0, nxdn=0, apco_p25=0, p25_nac='', m17=0, m17_can='', tetra=0, tetra_mcc='', tetra_mnc='', system_fusion=0, ysf_dg_id_uplink='', ysf_dg_is_downlink='', ysf_dsc='', notes='', last_update='2023-12-15', distance=4.130456951733273)

...

In general, the operation is straightforward enough, but RepeaterBook.download() has numerous options, as per the following docstring:

"""
Download the RepeaterBook data and load it into a local sqlite database for querying.

Parameters:
    db_filename:  The location of the sqlite database to create.
    sources:      A list of URIs to download, or local file paths. Each URI or file
                  must resolve to a json file that uses the RepeaterBook format.
                  E.g.,
                    ["https://www.repeaterbook.com/api/export.php?state=Washington"]
                  Or
                    ["./cache/Washington.json"]

		  Repeated calls to repeaterbook.com are internally rate-limited to
		  one per minute.

                  CAUTION: each call to RepeaterBook will return a limited number
                           of records (at this time 3500). It is best to gather only
                           what you need, such as one state.
                           DO NOT MAKE FREQUENT CALLS, or you will be rate-limited or
                           blocked.

                  For details see: https://www.repeaterbook.com/wiki/doku.php?id=api

    overwrite:    If true, overwrite any existing file (Default: False)
"""

License

hamkit-repeaterbook is distributed under the terms of the MIT license.

Metadata

Release files for hamkit-repeaterbook 0.0.1a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hamkit-repeaterbook 0.0.1a1
File Size Uploaded Provenance
hamkit_repeaterbook-0.0.1a1.tar.gz 8.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hamkit-repeaterbook 0.0.1a1
File Interpreter ABI Platform
hamkit_repeaterbook-0.0.1a1-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / hamkit_repeaterbook-0.0.1a1.tar.gz

Download URL hamkit_repeaterbook-0.0.1a1.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a97ae40c2f030eebe20dd09222dbcf6e28afc685f8ea667156294c22638e893e
BLAKE2b-256 checksum
How to use checksums
3744d19bf16e1e7526c014cd3515eef6b82e8e8f2f328798d6bb4e036b93353f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.26.0

Release files / hamkit_repeaterbook-0.0.1a1-py3-none-any.whl

Download URL hamkit_repeaterbook-0.0.1a1-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66d2fc68ce94a46bcf1825b18b1213f4a051b5052e741fbc1eccc532e8028347
BLAKE2b-256 checksum
How to use checksums
65c1aea5d58b0f6f62fd7baa8e9c427f1bc99e661559b98c29adffff56c5a074
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.26.0

Security for hamkit-repeaterbook 0.0.1a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page