BGPKIT tools Python bindings
Project description
PyBGPKIT
Python bindings for BGPKIT software. For all software offerings, please check out our GitHub repository at https://github.com/bgpkit.
SDKs
BGPKIT Parser
See the bgpkit-parser-py documentation for the full API.
import bgpkit
# Full element parsing
parser = bgpkit.Parser(url="https://spaces.bgpkit.org/parser/update-example",
filters={"peer_ips": "185.1.8.65, 2001:7f8:73:0:3:fa4:0:1"})
for elem in parser:
print(elem)
# Route-level parsing (faster, fewer fields)
for route in bgpkit.RouteParser(url="https://spaces.bgpkit.org/parser/update-example"):
print(route.prefix, route.as_path)
# Reusable filter objects
from bgpkit import Filter
f = Filter.peer_ip("185.1.8.65")
parser = bgpkit.Parser.from_filters(url, [f])
BGPKIT Broker
import bgpkit
broker = bgpkit.Broker()
# Search MRT data files
items = broker.query(ts_start="2024-01-01T00:00:00Z", ts_end="2024-01-01T01:00:00Z")
print(len(items))
# Get latest files
latest = broker.latest()
# Query peer information
peers = broker.peers(asn=13335, full_feed=True)
# List collectors
collectors = broker.collectors(project="routeviews", active=True)
BGPKIT IP Lookup
ip_info = bgpkit.IpLookup().query("1.1.1.1")
print(ip_info.country, ip_info.as_number, ip_info.as_name)
BGPKIT ASN Lookup
result = bgpkit.AsnLookup().query(asn="13335", country="US")
for asn in result.data:
print(asn.asn, asn.name, asn.country)
BGPKIT Community Lookup
entries = bgpkit.CommunityLookup().query(asn="13335", page_size=50)
for entry in entries:
print(entry.value, entry.description)
sources = bgpkit.CommunityLookup().sources()
BGPKIT ROAS Lookup
BGPKIT ROAS Lookup
roas = bgpkit.Roas()
data = roas.query(asn=3333, date="2018-01-01")
for entry in data:
print(entry.prefix, entry.asn, entry.tal)
# Current ROAs only
current = roas.query(prefix="1.1.1.0/24", current=True)
Build and Publish
Push a version tag to build and publish automatically via GitHub Actions:
git tag v0.7.0
git push origin v0.7.0
Manual release:
python -m pip install --upgrade build twine
python -m build
twine upload --skip-existing dist/*
PyPI Trusted Publishing is configured for automated releases. See .github/workflows/release.yml.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybgpkit-0.7.0.tar.gz.
File metadata
- Download URL: pybgpkit-0.7.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
506745224c7553f6c918f02c55b99d220425989488f13605b8b5dacee8d8df55
|
|
| MD5 |
33c08f4ee53ad2e02615929aa8fe5e9f
|
|
| BLAKE2b-256 |
0de683e1e77ad2a87ba386986776e2ee05a67bc150f4d44eb2259af24f2aa89c
|
Provenance
The following attestation bundles were made for pybgpkit-0.7.0.tar.gz:
Publisher:
release.yml on bgpkit/pybgpkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybgpkit-0.7.0.tar.gz -
Subject digest:
506745224c7553f6c918f02c55b99d220425989488f13605b8b5dacee8d8df55 - Sigstore transparency entry: 1761703557
- Sigstore integration time:
-
Permalink:
bgpkit/pybgpkit@6defde06a1927b578f9582acac7311cecc164918 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/bgpkit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6defde06a1927b578f9582acac7311cecc164918 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pybgpkit-0.7.0-py3-none-any.whl.
File metadata
- Download URL: pybgpkit-0.7.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a45ac38e146584c1bbcebc5807afb6abf9a451fd2653f5696b5bc43c75215634
|
|
| MD5 |
47a16c41d8ee29a10da97afc1bdc0a4f
|
|
| BLAKE2b-256 |
ce811160463ff258671bfe4f233ff76bb8368cef42da6822b23c0bbc1440ce88
|
Provenance
The following attestation bundles were made for pybgpkit-0.7.0-py3-none-any.whl:
Publisher:
release.yml on bgpkit/pybgpkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybgpkit-0.7.0-py3-none-any.whl -
Subject digest:
a45ac38e146584c1bbcebc5807afb6abf9a451fd2653f5696b5bc43c75215634 - Sigstore transparency entry: 1761703691
- Sigstore integration time:
-
Permalink:
bgpkit/pybgpkit@6defde06a1927b578f9582acac7311cecc164918 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/bgpkit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6defde06a1927b578f9582acac7311cecc164918 -
Trigger Event:
push
-
Statement type: