Deploying html-reports using a python web server

Osanda Deshan Nimalarathna
Test Automation Master
2 min readJan 13, 2019

What is a web server?

A Web server is a program that uses HTTP (Hypertext Transfer Protocol) to serve the files that form Web pages to users, in response to their requests, which are forwarded by their computers’ HTTP clients. Dedicated computers and appliances may be referred to as Web servers as well.

What is python simple http server?

Python standard library comes with a inbuilt web server which can be invoked for simple web client server communication. The port number can be assigned programmatically and the web server is accessed through this port. Though it is not a full featured web server which can parse many kinds of file, it can parse simple static html files and serve them by responding them with required response codes.

Pre-requisites

Python should be installed.
(If you don’t have python, download it from here and install it.)

Steps

  1. Go to the html report location on your computer.
  2. Shift + Right click and get a command prompt.
  3. Execute the below command if your machine has Python 3 installed.
python -m http.server 8000

For other python versions, execute the below command.

python -m SimpleHTTPServer 8000

4. Now you have successfully up a web server on the port 8000.

5. You can get your computer name by executing the below command on the command prompt.

hostname

6. Now share your report using the below URL.

http://{hostname}:8000/index.html

Ex:

http://maxsoftcomputer:8000/index.html

--

--

Osanda Deshan Nimalarathna
Test Automation Master

Founder of MaxSoft | RPA Solution Architect | Open-source Contributor | Automation Framework Developer | Technical Specialist