Setting up a simple HTTP server using Python Last Updated : 02 Sep, 2020 Comments Improve Suggest changes Like Article Like Report In this article, we are going to learn how to set up a simple and local HTTP server using Python. An HTTP server can be very useful for testing Android, PC or Web apps locally during development. It can also be used to share files between two devices connected over the same LAN or WLAN network. Installation On the terminal run the following statement: python3 -m http.server or python -m http.server Python3 server commandAccessing the server locally For accessing the server locally you need to visit http://localhost:8000/. Here you can see all the directories of your local storage along with all the data. You can also access an HTML page, It will be rendered by your web browser as you access it. The localhost pageAccessing the server over a Network Before going into application make a note that the device on which you have run the above commands is called a Server or a Host and the second device that you will be using to access the Server over the network is called Client. For accessing the server over a Network make sure that both the device(Server and the Client) are connected over the same LAN or WLAN network. To access the Server you need the IP address of the server. For obtaining the IP address the following steps are to be followed on your Server device: On the Windows command prompt, execute the following statement: ipconfig On the Linux, Unix or macOS terminal, execute the following statement: ifconfig Note the IP address returned by the above command. We will use this IP address further. The result of 'ifconfig' command in Linux. Once you know the IP address open any web browser on the Client device and type in the IP address of the first machine(Server device), along with port 8000: http://[ip address]:8000 Congratulations!! Now you know how to host a simple HTTP server using Python. Note: This HTTP server has limited security only so use it only for development purposes or sharing files locally it's not recommended for use over a production environment. Comment More infoAdvertise with us Next Article Setting up a simple HTTP server using Python H haridarshanc Follow Improve Article Tags : Python python-utility Practice Tags : python Similar Reads Simple Port Scanner using Sockets in Python Prerequisites: Socket Programming in Python Before going to the programming, let us discuss about ports. In this article, we will check the virtual ports of a server or websites, or localhost. Every port has a unique number. There are 65,535 ports available in a host starting from 0. We can assign t 3 min read Launch an HTTP Server with a Single Line of Python Code Python, with its built-in capabilities, offers a simple and effective way to do this. With just a single line of code, you can launch an HTTP server to serve files from your local directory. This feature can be incredibly handy for developers, educators, and anyone needing a quick and easy way to sh 2 min read GET and POST Requests Using Python This post discusses two HTTP (Hypertext Transfer Protocol) request methods  GET and POST requests in Python and their implementation in Python. What is HTTP? HTTP is a set of protocols designed to enable communication between clients and servers. It works as a request-response protocol between a cli 7 min read File Sharing App using Python Computer Networks is an important topic and to understand the concepts, practical application of the concepts is needed. In this particular article, we will see how to make a simple file-sharing app using Python.  An HTTP Web Server is software that understands URLs (web address) and HTTP (the proto 4 min read How To Send Files Using Python Built-In Http Server Python's built-in HTTP server offers a straightforward way to share files over a local network or the internet without the need for complex setups. In this tutorial, we'll walk through the step-by-step process of using Python's built-in HTTP server to send files to clients. Setting Up the HTTP Serve 2 min read Test the given page is found or not on the server Using Python In this article, we are going to write a Python script to test the given page is found or not on the server. We will see various methods to do the same. Method 1: Using Urllib. Urllib is a package that allows you to access the webpage with the program. Installation: pip install urllib Approach: Impo 2 min read File Transfer using TCP Socket in Python In this article, we implement a well-known Protocol in Computer Networks called File Transfer Protocol (FTP) using Python. We use the TCP Socket for this, i.e. a connection-oriented socket. FTP (File Transfer Protocol) is a network protocol for transmitting files between computers over Transmission 4 min read Python | Build a REST API using Flask Prerequisite: Introduction to Rest API REST stands for REpresentational State Transfer and is an architectural style used in modern web development. It defines a set or rules/constraints for a web application to send and receive data. In this article, we will build a REST API in Python using the Fla 3 min read Create API Tester using Python Requests Module Prerequisites: Python Requests module, API In this article, we will discuss the work process of the Python Requests module by creating an API tester. API stands for Application Programming Interface (main participant of all the interactivity). It is like a messenger that takes our requests to a syst 3 min read Python - Simple Port Scanner with Sockets Ports can be scanned to check which ports are engaged and which ports are open or free. In Python "Socket" module provides access to the BSD socket interface, which is available on all platforms. To scan the ports, the following steps can be implemented: 1] Recognize the host's IP address 2] Create 2 min read Like