Created
January 16, 2012 23:11
-
-
Save teh/1623516 to your computer and use it in GitHub Desktop.
uploader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import eventlet | |
from eventlet import wsgi | |
CHUNK_SIZE = 2**13 # 8k | |
def upload(env, start_response): | |
data = [] | |
while True: | |
d = env['wsgi.input'].read(CHUNK_SIZE) | |
if len(d) < CHUNK_SIZE: | |
break | |
data.append(d) | |
start_response('200 OK', {}) | |
print "MAGIC HAPPENS AFTER UPLOAD" | |
return ["HI"] | |
wsgi.server(eventlet.listen(('', 3000)), upload) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment