Errors

Bogons #

bgpstuff.net returns client errors if attempting to check bogons ASN and IPs. The clients will also check for bogons to prevent them even attempting to query bogons ranges:

>>> c.get_route("10.0.0.0")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mellowd/go/src/github.com/mellowdrifter/python-bgpstuff.net/bgpstuff/bgpstuff.py", line 237, in get_route
    raise ValueError(f"{ip_address} is not a public IP address")
ValueError: 10.0.0.0 is not a public IP address
>>> c.get_as_name(23456)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mellowd/go/src/github.com/mellowdrifter/python-bgpstuff.net/bgpstuff/bgpstuff.py", line 294, in get_as_name
    raise ValueError(f"{asn} is not a valid ASN")
ValueError: 23456 is not a valid ASN

Status #

When a query is made, you should always check to ensure the status was 200. If not, then the client’s state will not be updated with the result. status_code is an HTTP status number, but you can also check status to see a human readable version.

>>> c.status_code
200
>>> c.status
'OK'

Request ID #

Every request should get a random request ID, even if the query fails. This ID is not guarenteed to be unique. If you notice a bug, please let me know the query and request ID via a github issue. You can view the request ID like so:

>>> c.request_id
'{XV3dFA6O31tt}'