Sign inSign up

januzo/ip-getter-python-flask-sqlite

By januzo

•Updated over 4 years ago

A simple webapp returning clients' IP addresses supporting .html, .txt, .xml, .yaml formats

Image
0

997

januzo/ip-getter-python-flask-sqlite repository overview

⁠What's my IP address

A simple application returning client's IP addresses (public and local) as well as two lists containing IPs that have queried the app in the past. The lists are stored in a SQLite database. The app supports .html, .txt, .xml, .yaml and .json formats which correspond to the following MIME types respectively:

  • text/html
  • text/plain
  • application/xml
  • application/x-yaml
  • application/json

The app implements rate limiting. The maximum number of requests is set to 50 per hour and 5 per minute.

⁠Prerequisites

Docker⁠

⁠Setup

Open Command Prompt or Terminal and run docker image:

docker run -dp 5000:5000 januzo/ip-getter-python-flask-sqlite

The command launches the app automatically after downloading the image.

If you are using Docker Desktop you can terminate the app by pressing stop button. Alternatively, you can type docker ps and copy the ID of the container you want to shut down and replace PROCESS_ID with the ID:

docker kill PROCESS_ID

You can also pass the automatically generated name instead of ID. Trying to pass januzo/ip-getter-python-flask-sqlite as the name will not work.

⁠Running

You can access the app from your browser by accessing http://localhost:5000/⁠.

You can also send requests using Postman or cURL by typing:

curl http://localhost:5000/ -H "Accept: text/plain"

The -H option stands for header. The application will send a response in the specified format.

Tag summary

Content type

Image

Digest

Size

27.4 MB

Last updated

over 4 years ago

docker pull januzo/ip-getter-python-flask-sqlite