From acc558ed2433de61132887f24773d3c3653cb13a Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 12 Jun 2011 20:39:25 -0400 Subject: [PATCH] helpers --- httpbin/helpers.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 httpbin/helpers.py diff --git a/httpbin/helpers.py b/httpbin/helpers.py new file mode 100644 index 0000000..715128d --- /dev/null +++ b/httpbin/helpers.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +""" +httpbin.helpers +~~~~~~~~~~~~~~~ + +This module provides helper functions for httpbin. +""" + + + +def get_files(): + """Returns files dict from request context.""" + + files = dict() + + for k, v in request.files.items(): + files[k] = v.read() + + return files + + + +def get_headers(): + """Returns headers dict from request context.""" + + return CaseInsensitiveDict(request.headers.items()) \ No newline at end of file