Python is familiar with opening an HTTP download service

Source: Internet
Author: User
Share files in the current folder as HTTP

 

$ Python-M simplehttpserver

This command starts the simplehttpserver module of Python.

This command is probably the simplest method for cross-platform file transfer.

 

After the command is executed, the HTTP service will be opened on port 8000 of the Local Machine and opened in browsers of other machines that can access the local machine.

Ttp: // ip: 8000 open a directory list and click to download.

 

Start a web server using the current directory as the root directory. Because the default port is 8000, and to avoid resetting the port forwarding on the router, I specified port 9393:

 
Python-M simplehttpserver 9393

Success, cool!

To facilitate future use, I wrote an alias program and added it to my. bash_profile.

 
Alias HTTP = "Python-M simplehttpserver"

Later, I want to share more files. I only need to CD them to the relevant directory and execute HTTP or HTTP 9393.

Official reference

Source Code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.