From 66fb2b1cc12733aa34a5668852712cd581c7970f Mon Sep 17 00:00:00 2001 From: Kamal Gill Date: Tue, 6 Sep 2011 17:28:18 -0700 Subject: [PATCH] Use simplejson when available; PEP8 compliance for imports --- flaskext/api.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/flaskext/api.py b/flaskext/api.py index df96412..babec78 100644 --- a/flaskext/api.py +++ b/flaskext/api.py @@ -11,11 +11,21 @@ from __future__ import absolute_import -from flask import Response, request +from functools import wraps from time import time import traceback + +try: + import simplejson as json +except ImportError: + import json + +from flask import Response, request from flask import current_app +from apibee import Client as ApiBeeClient + + class ArgumentError(Exception):pass def _get_args(required, optional): @@ -35,7 +45,6 @@ def _get_args(required, optional): apiargs[arg] = optional[arg] return apiargs -from functools import wraps def api(required=None, optional=None): if required is None: required = {} @@ -67,10 +76,6 @@ def decorated_function(*args, **kwargs): # # Api Client # - -from apibee import Client as ApiBeeClient -import json - class ApiError(Exception): pass class Http404(Exception): pass