Skip to content

Instantly share code, notes, and snippets.

View yeraydiazdiaz's full-sized avatar

Yeray Díaz yeraydiazdiaz

View GitHub Profile
@nhoad
nhoad / gist:8966377
Last active March 2, 2023 09:30
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):
@vmihailenco
vmihailenco / tastypie_logging.py
Created April 14, 2012 08:29
Logging mixin for Django tastypie
class LoggingMixin(object):
def dispatch(self, request_type, request, **kwargs):
logger.debug(
'%s %s %s' %
(request.method, request.get_full_path(), request.raw_post_data))
try:
response = super(LoggingMixin, self).dispatch(
request_type, request, **kwargs)
except (BadRequest, fields.ApiFieldError), e: