Skip to content

AnirudhPangri/RestTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RestTest

Finds details of a mac address.

The details of the given Mac address are fetched from macaddress.io The given mac address is validated before sending the API request. API connection does not use requests/urllib/http.client packages of python. The API call is handled in a more rudimentary socket ssl programming way. Socket connection is established with the host over the https port 443, and response is parsed to extract the Json. The Hostname and API key required to access the details are stored in a separate config file, for security and easy management.

A new file config.py file should be created in the same directory with the hostname="api.macaddress.io" and the apiKey="API KEY", before testing.

Input: Mac Address.

example: Please enter the macAddress: 44:38:39:ff:ef:57

Output: Company name and details.

example:

Company Details: ##Company Name## ##Address##

Though only company details are shown as output, All the details returned by the API are stored as a json file for future use. The program also generates a log file, Log levels for the same can be set easily.

Also, this python app can be dockerized, and can be run as an independent container. Dockerfile is designed with minimal requirement to get the app working very quickly. Steps to create and run the docker container: (Assuming Docker is already installed and running on the machine)

step 1: docker build -t <your_docker_image_name> . {to be run at the location where dockerfile is present}

step 2: docker run -it <your_docker_image_name> {-i stands for interactive mode. Program expects some input from the User.}


Future enhancement: Socket encryption for security. RestClient that can handle all HTTP methods with any headers/ query params or request body. Details displayed as output can be improved.

About

Find details of a mac address.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published