PRSW, the RIPE Stat Wrapper, is a Python package that allows for simple access to the RIPEstat Data API.
PRSW is supported on Python 3.7+ and can be installed via pip.
pip install prsw
To install the latest development version run the following instead:
pip install --upgrade https://github.com/jvoss/prsw/archive/master.zip
RIPEstat can be instantiated with a few options. For details see the documentation at https://prsw.readthedocs.io.
To instantiate a basic instance of RIPEstat:
import prsw
ripe = prsw.RIPEstat()
With the ripe instance you can interact with the RIPEstat API:
# Find all announced prefixes for a Autonomous System
prefixes = ripe.announced_prefixes(3333)
# Interact with the looking glass
for collector in ripe.looking_glass('140.78.0.0/16'):
print(collector.location)
for peer in collector.peers:
print(
peer.asn_origin,
peer.as_path,
peer.community,
peer.last_update,
peer.prefix,
peer.peer,
peer.origin,
peer.next_hop,
peer.latest_time
)
# Check RPKI validation status
print(ripe.rpki_validation_status(3333, '193.0.0.0/21').status)
Please see the documentation for more options.
Contributions are encouraged. Please see CONTRIBUTING for details.
Inspiration for several elements of this project came from PRAW, the Python Reddit API Wrapper.
PRSW is licened under the Simplified BSD License.