Python binding for bgpkit-parser
from pybgpkit_parser import Parser
import json
parser = 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["origin_asns"])
print(json.dumps(elem, indent=4))
break
You can also add cache_dir
to Parser to cache the downloaded files to a specified directory.
Here is an example:
from pybgpkit_parser import Parser
import json
parser = Parser(
url="https://spaces.bgpkit.org/parser/update-example",
filters={"peer_ips": "185.1.8.65, 2001:7f8:73:0:3:fa4:0:1"},
cache_dir="./"
)
for elem in parser:
print(elem["origin_asns"])
print(json.dumps(elem, indent=4))
break
- Python3.8
- Python3.9
- Python3.10
- Python3.11
- Python3.12
python3 -m pip install pybgpkit-parser
maturin develop
builds local python module and add to the venv.
See BUILD.md for more details.