API reference¶
IP ASN History¶
- class pyipasnhistory.IPASNHistory(root_url: str | None = None, useragent: str | None = None, *, proxies: dict[str, str] | None = None)¶
- asn_meta(asn: int | None = None, source: str | None = None, address_family: str = 'v4', date: str | None = None, first: str | None = None, last: str | None = None, precision_delta: dict | None = None)¶
Get all the prefixes annonced by an AS
- property is_up: bool¶
Test if the given instance is accessible
- mass_cache(list_to_cache: list[dict[str, Any]])¶
Cache a list of IP queries. The next call on the same IPs will be very quick.
- mass_query(list_to_query: list[dict[str, Any]]) dict[str, Any]¶
Query a list of IPs.
- meta()¶
Get meta information from the remote instance
- query(ip: str, source: str | None = None, address_family: str | None = None, date: str | None = None, first: str | None = None, last: str | None = None, precision_delta: dict | None = None, aggregate: bool = False)¶
Launch a query.
- Parameters:
ip – IP to lookup
source – Source to query (caida or ripe_rrc00)
address_family – v4 or v6. If None: use ipaddress to figure it out.
date – Exact date to lookup. Fallback to most recent available.
first – First date in the interval
last – Last date in the interval
precision_delta – Max delta allowed between the date queried and the one we have in the database. Expects a dictionary to pass to timedelta. Example: {days=1, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0}
aggregate – (only if more than one response) Aggregare the responses if the prefix and the ASN are the same