Droopy: easy file receiving
What is it ?
Droopy is a mini Web server whose sole purpose is to let others upload files to your computer.
Why ?
Say you’re chatting with a friend on MSN Messenger (perhaps with the excellent pidgin ?). She wants to send you amazing photos she took last week-end, so she uses Messenger file transfer. Unfortunately, the zip file is over 50 MB and it’s painfully slow. Now relax, droopy comes to rescue.
Does it work on my computer ?
You can use it on Unix (Linux, BSD, MacOSX) and Windows. Droopy is a python script so you’ll need to have Python installed.
How to use it ?
Note: A tutorial on how to set up Droopy on Windows was very kindly written by Ronan. The rest of this section focuses on Linux and MacOSX.
Droopy is a command-line program. I’ll suppose you’ve downloaded and saved the file in ~/bin/. Go to the directory where you want the uploaded files to be stored, for example:
mkdir ~/uploads
cd ~/uploads
Then, run droopy. You can give a message and a picture to display:
python ~/bin/droopy -m "Hi, it's me Bob. You can send me a file." -p ~/avatar.png
And it’s up and running on port 8000 of you computer. Check it out at http://localhost:8000, and give your computer’s address to your friends.
Type droopy -h to see all options:
Usage: droopy [options] [PORT] Options: -h, --help show this help message and exit -d DIRECTORY, --directory DIRECTORY set the directory to upload files to -m MESSAGE, --message MESSAGE set the message -p PICTURE, --picture PICTURE set the picture --dl provide download links --save-config save options in a configuration file --delete-config delete the configuration file and exit
License
Droopy is a free software distributed under the BSD License. There’s a git repository at http://gitorious.org/droopy. New releases are announced on Freshmeat.
Feedback and contribution
I’d love to hear about your experience using droopy. If you have ideas to improve it, please let me know. Pierre – stackp@online.fr.

Comments
the iframe part did not make it, which was to expect, so i put it here :
http://pad.1x4x.net/mIjIjDwS72
salam
Thanks for the patch Simon. Smart and simple.
New release: Use the
--dloption to show download links.I started with Simon’s patch but ended up reimplementing the feature completely. Thanks again to Simon anyway. As usual, feedback is welcome.
I really like this tool, it helped me a lot – it is easy to use and simply did what it should. Thanks Pierre!
Droopy works as well under Windows 7 and Python 2.6.6 (I am able to upload files), but the –dl option is broken (only with Win7, with Debian Squeeze it works!). If I use it, droopy starts, but if I open a browser windows to localhost:8000, it gets no reply and droopy shows this error:
droopy.py:655: UnicodeWarning: Unicode equal comparison failed to convert both a
rguments to Unicode – interpreting them as being unequal
elif name in self.published_files():
—————————————-
Exception happened during processing of request from (’192.168.115.109′, 58910)
Traceback (most recent call last):
File “C:\Python26\lib\SocketServer.py”, line 560, in process_request_thread
self.finish_request(request, client_address)
File “C:\Python26\lib\SocketServer.py”, line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File “C:\Python26\lib\SocketServer.py”, line 617, in __init__
self.handle()
File “droopy.py”, line 754, in handle
BaseHTTPServer.BaseHTTPRequestHandler.handle(self)
File “C:\Python26\lib\BaseHTTPServer.py”, line 329, in handle
self.handle_one_request()
File “C:\Python26\lib\BaseHTTPServer.py”, line 323, in handle_one_request
method()
File “droopy.py”, line 660, in do_GET
self.send_html(self.html(“main”))
File “droopy.py”, line 631, in html
urllib.quote(name.encode(‘utf-8′)),
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xfc in position 25: ordinal
not in range(128)
—————————————-
Hi André, thanks for the feedback.
It seems the name of one of your files includes a character that causes the bug.
I’ll dig into the issue. Would you mind sending me the list of filenames present in your folder (or just one filename that triggers the bug) ?
A filename with a german special character like ä/Ä, ö/Ö, ü/Ü or ß causes this error.
I have two files in my droopy directory, droopy.py and “HexEditor_0_9_5_UNI_dll_für_Notepad.zip”. If I delete the ü within the filename, droopy runs fine.
The newly uploaded version should fix the filename encoding issue. Tell me if it does not.
Cheers, Pierre.
I just downloaded http://stackp.online.fr/wp-content/uploads/droopy and tested it, but nothing has changed, droopy continues to crash:
droopy.py:655: UnicodeWarning: Unicode equal comparison failed to convert both a
rguments to Unicode – interpreting them as being unequal
elif name in self.published_files():
—————————————-
Exception happened during processing of request from (’127.0.0.1′, 1576)
Traceback (most recent call last):
File “C:\Python26\lib\SocketServer.py”, line 560, in process_request_thread
self.finish_request(request, client_address)
File “C:\Python26\lib\SocketServer.py”, line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File “C:\Python26\lib\SocketServer.py”, line 617, in __init__
self.handle()
File “droopy.py”, line 754, in handle
BaseHTTPServer.BaseHTTPRequestHandler.handle(self)
File “C:\Python26\lib\BaseHTTPServer.py”, line 329, in handle
self.handle_one_request()
File “C:\Python26\lib\BaseHTTPServer.py”, line 323, in handle_one_request
method()
File “droopy.py”, line 660, in do_GET
self.send_html(self.html(“main”))
File “droopy.py”, line 631, in html
urllib.quote(unicode(name).encode(‘utf-8′)),
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xfc in position 25: ordinal
not in range(128)
—————————————-
The newly uploaded version better handles filename encodings and should fix the above bug. This time. Hopefully.
New release with a polish translation thanks to Jacek Politowski. Cheers!
Hola, estaría bueno elegir que archivos enviar.
Saludos
[...] them. Running a miniature HTTP server won’t help you. Or maybe it will. What you need is Droopy – another Python mini server. Instead of serving files however, it creates a file upload page [...]
[...] Droopy ist ein kleiner in Python geschriebener Webserver um schnell und bequem per Browser Dateien anbieten und empfangen zu können. Zum Ausführen wird Python in Version 2.7.x benötigt. [...]
http://paste.ubuntu.com/659082/
I just had it choke on line 266 (invalid syntax error): ar = {“maintitle”: u”u265 […]
etc.
Does anybody port droopy with GUI (i.e. with wxPython) ? thanks !
Thanks for this tool – I really like it.
What about adding an option to run a command upon completion of every upload? e.g.:
droopy -x myscript.sh
would execute
myscript.sh “some filename”
upong receiving a file called
some filename
I hacked droopy to call a standard binary (/opt/droopy.sh) after downloading each file by adding 3 lines:
> diff droopy.orig droopy.new
734a735,738
> print ‘executing /opt/droopy.sh “%s”‘ % localpath
> import subprocess
> p = subprocess.Popen(['/opt/droopy.sh',localpath])
>
(yes sorry, it’s a hardcoding ugliness )
Note that subprocess.Popen doesn’t block waiting for droopy.sh to terminate so you can do stuff that take a lot of time without affecting droopy
Hi Nick, what does your script does ?
Hi Pierre, droopy uploads to a samba share and I need to execute this:
chmod g+rw0 file
so that the files are readable/writable by samba group (i.e. readable/writable for windows users connecting to samba).
I’m almost sure others will have quite different needs. BTW if you ever add an option for calling a script you could be passing the IP as the second parameter. Just in case someone wants to customize his logic based on the unloader’s IP.
Thanks again for the useful utility.
If I start the script like this in the terminal
~/droopy -p ~/puppylogo96-white.png -m ” this is a test ”
I get this error message ” it’s is not a valid port number ”
this is only if I add the -m ” this is a test ”
it functions correctly with just -p ~/puppylogo96-white.png
@geoff: strange, the exact same command runs fine here. What OS are you running ? Could you double-check that you did put quotes around the message ? Also may I ask you to copy the exact command and the exact error message ? Thanks.
If you need a VERY VERY quick’n'dirty authentication mechanism for droopy and have written a few lines of python code then you can add this line bellow the one reading”":
Password:
and these lines bellow the one reading “fileitem = form[self.form_field]“:
passwd = form["pass"].value
if passwd “YourSecretPass”:
raise Exception(“Wrong Password”)
The password is of course “YourSecretPass”.
WARNING: This is no serious authentication mechanism. The password is transmitted as plain text.
ooops! the html was striped out of my comment. Sorry but there is no preview:
I’ll try again replacing less-than with { and greater than with } — do the oposite:
a few lines of python code then you can add this line bellow the one reading “{input name=”upfile” type=”file”}”:
{/br}Password: {input name=”pass” type=”password” size=”20″}
doh! and of course the line that reads like this in my comment:
if passwd “YourSecretPass”:
is missing the less than, greater than between passwd and the string.
Anyway all this is trivial staff for anybody remotely familiar with python and html so I hope you’ll figure it out.
Very nice utility, thanks!
The permissions when uploading a zip file seem to be off; under the line stating
shutil.move(fileitem.tmpfilename, localpath)
I added
os.system(“chmod +r %s” % localpath)
which makes the file readable for everybody (at least under linux
Cheers
Great Job. Easy to use and functions as intended.
How do I get the droopy monster picture? Can’t seem to find it online.
@Nathan, you can find it here
@pierre Thanks.
New release with Taiwanese translation thanks to Li-cheng Hsu.
Please make a video tutorial, or at least a detailed image tutorial. I’ve never worked with python and for me this is quite confusing. I’m on Windows 7, just can’t get this running.
Using Windows7 and python 2.7, I get the error:
c:\python droopy.py -m “Hi, it’s me Bob. You can send me a file.” –dl
File “droopy.py”, line 420
“errortitle”: u”δ¼╕∞ £Ω░Ç δ░£∞â¥φûê∞è╡δïêδïñ”,
SyntaxError: (unicode error) ‘utf8′ codec can’t decode byte 0xec in position 3: unexpected end of data
Line 420 looks to be part of the Japanese translation so I removed Japanese, but I then got other unicode errors from other translations.
I fixed this by removing all of the Translations except for English and German and editing the the “translations” definition to:
translations = {“de”: de, “en”: en}
Am I missing a unicode library/module or is this a Windows7 thing?
[...] Droopy If you’re looking for a dead simple way for people to share files with you, Droopy is a mini web server with a singular function: helping people upload files to your computer.Not [...]
Very nice, thank you
Thanks to Ronan for providing a Windows tutorial.
http://www.techkings.org/general-pc-chat/34104-droopy-tutorial.html