Example #1
0
def index():
    if request.method == 'HEAD':
        # Just returns ack if the webserver is running
        return 'Ack'
    load_session()
    q = Querying()
    sources = q.get_sources(date=session['date'])['response']
    session.pop('asn', None)
    session.pop('country', None)
    ranks = q.asns_global_ranking(limit=100, **session)['response']
    r = [(asn, rank, q.get_asn_descriptions(int(asn))['response']) for asn, rank in ranks]
    return render_template('index.html', ranks=r, sources=sources, countries=get_country_codes(), **session)
Example #2
0
def json_asns_global_ranking():
    query = request.get_json(force=True)
    to_return = {'meta': query, 'response': {}}
    q = Querying()
    to_return['response'] = q.asns_global_ranking(**query)['response']
    return Response(json.dumps(to_return), mimetype='application/json')