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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file asn_info-0.4.tar.gz.

File metadata

  • Download URL: asn_info-0.4.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for asn_info-0.4.tar.gz
Algorithm Hash digest
SHA256 866ccd2349e4db39515caa5a3b9775789ff353741b92bbac7b42f3ad3b94d1e2
MD5 2bc4ece36aa0be695605949479b9f546
BLAKE2b-256 b48ee52d2d47b10cebd2f89f40a5bf083ba7e09c9a1d1cd5501bbde178857e6b

See more details on using hashes here.

File details

Details for the file asn_info-0.4-py3-none-any.whl.

File metadata

  • Download URL: asn_info-0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for asn_info-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c5bb5bb1b26c064940972fed9ed59e9d45a769fc829ac6ce59a9ef7546550853
MD5 cfcbb76e166579183a7170da65aeaf79
BLAKE2b-256 2234a7da82fb86e9dcd14182f9bd23727dfb2d1b83de4542c067eaec24b36d18

See more details on using hashes here.

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