asn_to_name

privex.helpers.net.asn_to_name(as_number: Union[int, str], quiet: bool = True)str[source]

Look up an integer Autonomous System Number and return the human readable name of the organization.

Usage:

>>> asn_to_name(210083)
'PRIVEX, SE'
>>> asn_to_name('13335')
'CLOUDFLARENET - Cloudflare, Inc., US'

This helper function requires dnspython>=1.16.0, it will not be visible unless you install the dnspython package in your virtualenv, or systemwide:

pip3 install dnspython
Parameters
  • as_number (int/str) – The AS number as a string or integer, e.g. 210083 or ‘210083’

  • quiet (bool) – (default True) If True, returns ‘Unknown ASN’ if a lookup fails. If False, raises a KeyError if no results are found.

Raises

KeyError – Raised when a lookup returns no results, and quiet is set to False.

Return str as_name

The name and country code of the ASN, e.g. ‘PRIVEX, SE’