Skip to content

Instantly share code, notes, and snippets.

View Greyvend's full-sized avatar

Serge Mosin Greyvend

View GitHub Profile
@Greyvend
Greyvend / gist:b912619625798edcad2a04ccfced75b5
Created February 20, 2017 15:34 — forked from nhoad/gist:8966377
Async stdio with asyncio
import os
import asyncio
import sys
from asyncio.streams import StreamWriter, FlowControlMixin
reader, writer = None, None
@asyncio.coroutine
def stdio(loop=None):
@Greyvend
Greyvend / Flask-Restful_S3_File_Upload.py
Created September 12, 2016 13:26 — forked from JMSwag/Flask-Restful_S3_File_Upload.py
Uploading a file to S3 while using Flask with Flask-Restful to create a REST API.
# -*- coding: utf-8 -*-
"""
An example flask application showing how to upload a file to S3
while creating a REST API using Flask-Restful.
Note: This method of uploading files is fine for smaller file sizes,
but uploads should be queued using something like celery for
larger ones.
"""
from cStringIO import StringIO