Obtain the information about any IP Address. Built with IP2Location and fastapi.
There are three main endpoints:
GET /ip
- The main endpoint. Returns the information about the IP AddressGET /ip/{ip}
- Returns information about the specified IP AddressGET /refreshdatabase
- Downloads the latest database from IP2Location (You should run this endpoint any day the first week of the month)
-
Clone the repository
-
Install the dependencies
pip3 install -r ./requirements.txt
-
Set the environment variables (copy the
.env.example
file) -
Run the server
uvicorn main:app --reload --host 0.0.0.0 --port 8000 --env-file ./.env
To build with docker:
-
Set environment variables in the
Dockerfile
(ordocker-compose.yaml
) -
Build the image
docker build -t soundicly-ipcollector .
You will need to create a volume for the database
ipcollector:
image: soundicly-ipcollector
...
volumes:
- ip2location-db:/app/data
volumes:
ip2location-db: