Simple Python3 http-server

Moderator: Forum moderators

Post Reply
User avatar
fredx181
Posts: 3087
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 376 times
Been thanked: 1315 times
Contact:

Simple Python3 http-server

Post by fredx181 »

*** Simple Python3 http-server xbps package ***

UPDATE: new attached package: v1.1_0, fixed that setting port number to other than 8000 didn't work in case of "upload enabled".

Originally made by @rcrsn51 (gtkdialog GUI and working with python2), I modified for KLV, to make it work with python3.
"Simple file-sharing system for your home LAN. It uses Python to run a basic HTTP server."
See: https://oldforum.puppylinux.com/viewtop ... 095#979095

Run the GUI (Menu > Internet > Simple Python HTTP server),
or: run directly with python3 in terminal (from standing in the directory to share):
python3 -m http.server 8000 # or any port instead of 8000, e.g. 80
Or with upload enabled:
python3 -m SimpleHTTPServerWithUpload 8000

The SimpleHTTPServerWithUpload.py script included in the package, I got from here: (edit replaced link, this fork works for setting port number)
https://gist.github.com/PerfectDay20/df ... 5c0ce68827

I think it's a nice simple way of local network sharing, downside is that you need a browser to access your files e.g. in adress bar 192.168.1.2:8000 or e.g. 192.168.1.2:80
Btw, (last time that I tried it worked) instead you can use also your external IP address, then e.g. <ext-ip-address>:80 (then access your files outside home LAN, so for everyone).

simple-python-http-server-1.1_0.noarch.xbps
Simple python3 http-server package
(8.28 KiB) Downloaded 49 times
Screenshot.png
Screenshot.png (149.38 KiB) Viewed 1007 times
Last edited by fredx181 on Wed Jan 25, 2023 4:17 pm, edited 1 time in total.
User avatar
wiak
Posts: 4082
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 65 times
Been thanked: 1208 times
Contact:

Re: Simple Python3 http-server

Post by wiak »

I should try this. I'm always needing something light to move files around without having to plug in usb sticks and moving them around (which gets me off my computer seat, but is an annoying distraction).

I only just noticed this post. I do not use any notification of new posts sort of system so rely on what I browse; actually I don't know how to arrange to follow thread posts. I'm bad for not learing useful tricks like that (assuming there are some).

The other rcrsn51 creation I kept meaning to try was his method of sending audio/video across the network. Pulseaudio never proved very good at that because of the tcp protocol it uses, whereas I recall rcrsn51 using a simple comms program (presumable using udp) such that little latency and good sync. trx or somename like that for part of it?

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
Sofiya
Posts: 2288
Joined: Tue Dec 07, 2021 9:49 pm
Has thanked: 1477 times
Been thanked: 1537 times

Re: Simple Python3 http-server

Post by Sofiya »

Super! Works great :thumbup2:

Attachments
Screenshot(1).jpg
Screenshot(1).jpg (111.16 KiB) Viewed 948 times

KL
PUPPY LINUX Simple fast free

User avatar
rockedge
Site Admin
Posts: 6553
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2757 times
Been thanked: 2629 times
Contact:

Re: Simple Python3 http-server

Post by rockedge »

Great to work with!

Sort of like using the builtin Hiawatha web server in Puppy Linux to serve files across a LAN or WLAN and could be reached externally easily if setup to allow it.
I should examine more how audio is served.......

One question though, I can't seem to be able to set the port to anything other than 8000 :?

User avatar
fredx181
Posts: 3087
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 376 times
Been thanked: 1315 times
Contact:

Re: Simple Python3 http-server

Post by fredx181 »

rockedge wrote: Wed Jan 25, 2023 11:59 am

....
One question though, I can't seem to be able to set the port to anything other than 8000 :?

Ah, yes, I see now, problem is only when upload is enabled though.
Found a fork of the python script SimpleHTTPServerWithUpload.py that works OK for setting port number: https://gist.github.com/PerfectDay20/df ... 5c0ce68827
New package attached at first post with fix (v1.1_0)

Btw, just a tip, if you want the server started at boot, just add a simple script to ~/Startup with contents e.g:

Code: Select all

#!/bin/bash
cd /path/to/share-folder    # change this to the folder you wish to share
python3 -m SimpleHTTPServerWithUpload 8000   # or change port number (v1.1_0 only)

User avatar
fredx181
Posts: 3087
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 376 times
Been thanked: 1315 times
Contact:

Re: Simple Python3 http-server

Post by fredx181 »

Updated Simple Python3 http-server xbps package, it has 'uploadserver' included which supports multiple file upload and uploading through commandline using curl.
See also: viewtopic.php?p=89393#p89393

simple-python-http-server-1.2_0.noarch.xbps
(11.37 KiB) Downloaded 39 times

-----------------------------------------------------------------------------------------------------------------------------
And simple-http-filemanager, supports upload and download to/from SimpleHTTP server

simple-http-filemanager-1.1_0.noarch.xbps
(9.49 KiB) Downloaded 44 times

Also, as extra, many 'index' http(s) sites supported for downloading.
Including https://rockedge.org, no browser needed to download latest KLV :) :

Screenshot(1).png
Screenshot(1).png (97.27 KiB) Viewed 753 times
Post Reply

Return to “KL-Dev_Work”