# Path: lib/settings.py
# def get_top_domains(dbname):


from flask import Flask
from flask import request
from flask import abort
from flask import Response
from lib.logger import *
from lib.settings import homenet, lock, country_stats
import threading
import json
import lib.utils as utils
            resp = Response()
            resp.status_code = 200
            return resp
        else:
            abort(400)

    @staticmethod
    @app.route('/api/v1.0/falcongate/stats', methods=['POST'])
    def get_stats():
        if not request.json:
            abort(400)

        stype = str(request.json['stats_type'])
        stime = int(request.json['start_time'])
        etime = int(request.json['end_time'])
        if stype == 'country':
            data = get_country_stats(stime, etime)
            data = json.dumps(data)
            resp = Response()
            resp.data = data
            resp.status_code = 200
            resp.mimetype = "application/json"
            return resp
        else:
            abort(400)


def get_country_stats(stime, etime):
    countries = {}
    for k in country_stats.keys():

# Path: lib/settings.py
# def get_top_domains(dbname):


# Path: api/api.py
from flask import Flask
from flask import request
from flask import abort
from flask import Response
from lib.logger import *
from lib.settings import homenet, lock, country_stats
import threading
import json
import lib.utils as utils

            resp = Response()
            resp.status_code = 200
            return resp
        else:
            abort(400)

    @staticmethod
    @app.route('/api/v1.0/falcongate/stats', methods=['POST'])
    def get_stats():
        if not request.json:
            abort(400)

        stype = str(request.json['stats_type'])
        stime = int(request.json['start_time'])
        etime = int(request.json['end_time'])
        if stype == 'country':
            data = get_country_stats(stime, etime)
            data = json.dumps(data)
            resp = Response()
            resp.data = data
            resp.status_code = 200
            resp.mimetype = "application/json"
            return resp
        else:
            abort(400)


def get_country_stats(stime, etime):
    countries = {}
    for k in country_stats.keys():

            stats = country_stats[k].get_stats(stime, etime)