The problem
PeeringDB is heavily rate-limiting access to its API. Developing against the API will get you in trouble. Running your live environment against their API? No, you better don’t do that. But wait, in a modern world where all the data we need and depend on lives in PeeringDB, how can I automate against it? The official answer and communication is: Sync PDB locally, automate against your local copy.
Thanks to the wonders of NAT, CGNAT, and other horrible consumer inventions, my jumphost was blocked even for syncing, probably because others were using the same IP. So, let’s install a PDB sync on a FreeBSD machine I control. That’s what was needed:
The solution
OS Level
Currently on 14-3 Release with a python3.11. You might need to adjust the version to your needs.
# pkg install py311-sqlite3
Python virtual env
$ mkdir peeringdb
$ cd peeringdb/
$ python3 -m venv .
$ . bin/activate
required modules and peeringdb itself
(peeringdb venv) $ pip install peeringdb
(peeringdb venv) $ pip install django django_countries django_peeringdb
Login to PeeringDB, generate an API key and do not forget to use it when you enter peeringdb config mode. When everything is set up, you can start a sync by running peeringdb sync --fetch-private in your virtual environment, which results in a peeringdb.sqlite3 database file with all the data you will need for your automation. Check out DB Browser for SQLite if you are lost.