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
# Loads environment variables from a .envrc or .env file into os.environ | |
# Also useful to load .env environment variables into PyCharm's Python Console | |
# Usage: Download this file into your project's directory and add the following snippet | |
# to the Python Console's Starting Script. | |
# Settings > Build, Execution, Deployment > Console > Python Console > Starting script | |
# ``` | |
# from env_loader import load | |
# load(".env") | |
# del load | |
# ``` |
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
""" A payload parser middleware for the Falcon Framework <http://falconframework.org/> | |
Currently it only works with Content-Type: application/json. | |
It is easily extendable for other Content-Types | |
""" | |
__author__ = "Luis Benitez" | |
__license__ = "MIT" | |
import falcon | |
import json |
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
# Monkey patch Decimal's default Context to allow | |
# inexact and rounded representation of floats | |
import decimal | |
from boto.dynamodb.types import DYNAMODB_CONTEXT | |
# Inhibit Inexact Exceptions | |
DYNAMODB_CONTEXT.traps[decimal.Inexact] = 0 | |
# Inhibit Rounded Exceptions | |
DYNAMODB_CONTEXT.traps[decimal.Rounded] = 0 |
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
""" A CORS middleware for the Falcon Framework <http://falconframework.org/> | |
""" | |
__author__ = "Luis Benitez" | |
__license__ = "MIT" | |
from falcon import HTTP_METHODS | |
class CorsMiddleware(object): | |
"""Implements (partially) the Cross Origin Resource Sharing specification |