def test_init(): from app import app mta = Mtapi(app.config['MTA_KEY'], app.config['STATIONS_FILE'], max_trains=app.config['MAX_TRAINS'], max_minutes=app.config['MAX_MINUTES'], expires_seconds=app.config['CACHE_SECONDS'], threaded=app.config['THREADED'])
try: if isinstance(obj, datetime): return obj.isoformat() iterable = iter(obj) except TypeError: pass else: return list(iterable) return JSONEncoder.default(self, obj) app.json_encoder = CustomJSONEncoder mta = Mtapi(os.environ.get('MTA_KEY'), app.config['STATIONS_FILE'], max_trains=app.config['MAX_TRAINS'], max_minutes=app.config['MAX_MINUTES'], expires_seconds=app.config['CACHE_SECONDS'], threaded=app.config['THREADED']) def cross_origin(f): @wraps(f) def decorated_function(*args, **kwargs): resp = f(*args, **kwargs) if app.config['DEBUG']: resp.headers['Access-Control-Allow-Origin'] = '*' elif 'CROSS_ORIGIN' in app.config: resp.headers['Access-Control-Allow-Origin'] = app.config[ 'CROSS_ORIGIN']