This commit is contained in:
Roberto Abdelkader Martínez Pérez
2019-04-26 07:55:33 +02:00
parent bc65b5ba4f
commit 79a039fb89
3 changed files with 109 additions and 6 deletions
+3 -4
View File
@@ -1,5 +1,4 @@
#!/usr/bin/env python
from functools import partial
from urllib.parse import urlparse
from uuid import uuid4
import asyncio
@@ -61,12 +60,12 @@ class ConnectionHandler:
if content == 'filename':
try:
return field.filename.encode('utf-8')
except:
except Exception:
return b''
elif content == 'content':
try:
return field.file.read()
except:
except Exception:
return b''
else:
raise ValueError(f'Unknown content type {content!r}')
@@ -236,11 +235,11 @@ async def run_init_script():
})
await shell_task.wait()
async def start_background_tasks(app):
app["debug_tasks"] = app.loop.create_task(run_init_script())
def main():
app = web.Application(client_max_size=1024**3)
app.add_routes([