python module SimpleHTTPServer

what is

The SimpleHTTPServer module can be used in the following manner in order to set up a very basic web server serving files relative to the current directory.

Warning SimpleHTTPServer is not recommended for production. It only implements basic security checks.

Example 1: fetch files from a server

    1. Start SimpleHTTPServer on server node
      1
      2
      3
      cd   your_file_dir
      python -m SimpleHTTPServer <PORT>
      ...
    1. Excute command on client node
      wget <SERVER_NODE_IP>:<PROT>/relative path/test.sh

or go to the browser and type this URL: http://<SERVER_NODE_IP>:<PROT> and see the output.

✍TIP
The SimpleHTTPServer module has been merged into http.server in Python 3.0. The 2to3 tool will automatically adapt imports when converting your sources to 3.0.
python3 -m http.server

Donate
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2019-2024 John Doe
  • Visitors: | Views:

请我喝杯咖啡吧~