Carlos85G / locate-numbers

Django project to locate and validate numbers according to POST request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API to evaluate phone numbers and locate them

By: Carlos Eduardo González López (Carlos85G) {carlos85g at gmail dot com}

Assumptions

  • The running server is able to call docker-compose and has a working internet connection to download the required Docker images.
  • Provided numbers represent valid or invalid phone numbers in the United States of NorthAmerica.
  • Files will only be uploaded through the /locate_numbers endpoint, using the POST method.
  • Requests will only be served through port 9000.
  • The specified command:
curl -i -X POST -F "numbers=@numbers.csv" -H "Content-Type: multipart/form-data" http://localhost:9000/locate_numbers

will make a POST request with a form which includes a CSV file in the "numbers" fiels and will output the response headers (-i flag) and body to the console.

  • The command specified above will NOT output the requested output file ("output.csv") by itself, as there's no specified output file parameter and the printed headers will make one unreadable.
  • The requested output file will be generated using the following command:
curl -o output.csv -X POST -F "numbers=@numbers.csv" -H "Content-Type: multipart/form-data" http://localhost:9000/locate_numbers

where the headers flag has been ommited and there's a new paramenter (-o flag) specifying the file to which the result should be dumped to.

Running

  • Inside a properly set-up command line, navigate into the project's directory and run
docker-compose up
  • Grab a cup of coffee while the system downloads and sets up the dependencies.
  • Run the cURL command.

Protip: run this command

docker-compose up -d

instead to re-use the same command line.

Dependencies used

  • Docker (including docker-compose)
  • NginX
  • Python 3
  • Django 2.2
  • PhoneNumbers

Notes about development

While PhoneNumbers inputs a lot of metadata, it'll be better to wait until all the phone numbers are validated and only make the GeoCoder request with those data which have already been deemed as valid.

License

This software does not provide a license and its use is limited to users which have the creator's express consent

About

Django project to locate and validate numbers according to POST request


Languages

Language:Python 98.4%Language:Dockerfile 1.6%