Skip to main content

A python library providing information about ASNs (AS Name, Country and MANRS membership)

Project description

ASN Info

A python library providing information about ASNs (AS Name, Country and MANRS membership)

This library downloads the Autonomous System list and information from RIPE NCC and provides its contents as objects.

There are three data points:

  • Autonomous System Name: get_as_name()
  • Autonomous System Country: get_as_country()
  • Wether an ASN is a MANRS Participant: is_manrs_participant()

MANRS Data is not loaded by default, since it requires an API key. In case you want to load it, you will have to prepare a .env file containing a line like this:

MANRS_API_KEY=ad83444d-4c68-4727-9ff6-ce2df6649c05

You can obtain an API key here

Example use:

import asn_info

asn_data = asn_info.Asns()

h = asn_data.load_asn_data(add_manrs_data=True)

print(asn_data.get_as_name(58280))
print(asn_data.get_as_country(58280))
print(asn_data.is_manrs_participant(58280))

Result:

STUCCHIMAX-AS Massimiliano Andrea Stucchi
CH
False

You can also filter the ASNs per country, as follows:

switzerland = asn_data.asns_per_country("CH")

for asn in switzerland:
    print("{} has {}".format(asn, switzerland[asn]))

Output:

...
58280 has {'country': 'CH', 'as_name': 'STUCCHIMAX-AS Massimiliano Andrea Stucchi'}
...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asn_info-0.4.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

asn_info-0.4-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page