|
|
@ -2,7 +2,10 @@ from flask import Flask, request |
|
|
|
from flask_restful import Resource, Api |
|
|
|
from flask_restful import Resource, Api |
|
|
|
from sqlalchemy import create_engine |
|
|
|
from sqlalchemy import create_engine |
|
|
|
from json import dumps |
|
|
|
from json import dumps |
|
|
|
|
|
|
|
#rate limiting support |
|
|
|
from flask.ext.jsonpify import jsonify |
|
|
|
from flask.ext.jsonpify import jsonify |
|
|
|
|
|
|
|
from flask_limiter import Limiter |
|
|
|
|
|
|
|
from flask_limiter.util import get_remote_address |
|
|
|
import time |
|
|
|
import time |
|
|
|
import sys |
|
|
|
import sys |
|
|
|
import os |
|
|
|
import os |
|
|
@ -17,6 +20,12 @@ db_connect = create_engine('sqlite:///' + db_path) |
|
|
|
app = Flask(__name__) |
|
|
|
app = Flask(__name__) |
|
|
|
api = Api(app) |
|
|
|
api = Api(app) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
limiter = Limiter( |
|
|
|
|
|
|
|
app, |
|
|
|
|
|
|
|
key_func=get_remote_address, |
|
|
|
|
|
|
|
default_limits=["500/day", "60/hour"] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
#quickly figure out which is old or new |
|
|
|
#quickly figure out which is old or new |
|
|
|
def age_calc(ustamp): |
|
|
|
def age_calc(ustamp): |
|
|
|
if (time.time() - ustamp) <= 14400 : |
|
|
|
if (time.time() - ustamp) <= 14400 : |
|
|
|