<commit_before>from flask import Flask, request, render_template
app = Flask(__name__)
from iplookup import *

def remote_addr(request):
    """
    The remote address of the client.
    gist source: https://gist.github.com/coreydowning/4099188
    """
    fwd = request.environ.get('HTTP_X_FORWARDED_FOR', None)
    if fwd is None:
        return request.environ.get('REMOTE_ADDR')
    # sometimes x-forwarded-for contains multiple addresses,
    # actual client is first, rest are proxy
    fwd = fwd.split(',')[0]
    return fwd

@app.route('/')
def index():
    ipaddr = remote_addr(request)
    jsonipdata=iplookup(ipaddr);
    try:
        lon = json.loads(jsonipdata)['lon']
        lat = json.loads(jsonipdata)['lat']
    except KeyError:
        lon = None
        lat = None

    if (lon == None or lat == None):
        return render_template('iplookup.html', jsonipdata=jsonipdata)
    elif (lon != None and lat !=None):
        return render_template('iplookup.html', jsonipdata=jsonipdata, lon=lon, lat=lat)

@app.route('/<path:path>',methods=['GET'])
def apiHandler(path):
	ipaddr = path
	jsonipdata=iplookup(ipaddr)
	return render_template('iplookup.html', jsonipdata=jsonipdata)

if __name__ == "__main__":
    app.run(host='0.0.0.0', debug=True)<commit_msg>wrong lon/lat<commit_after>from flask import Flask, request, render_template
app = Flask(__name__)
from iplookup import *

def remote_addr(request):
    """
    The remote address of the client.
    gist source: https://gist.github.com/coreydowning/4099188
    """
    fwd = request.environ.get('HTTP_X_FORWARDED_FOR', None)
    if fwd is None:
        return request.environ.get('REMOTE_ADDR')
    # sometimes x-forwarded-for contains multiple addresses,
    # actual client is first, rest are proxy
    fwd = fwd.split(',')[0]
    return fwd

@app.route('/')
def index():
    ipaddr = remote_addr(request)
    jsonipdata=iplookup(ipaddr);
    try:
        lon = json.loads(jsonipdata)['lon']
        lat = json.loads(jsonipdata)['lat']
    except KeyError:
        lon = None
        lat = None

    if (lon == None or lat == None):
        return render_template('iplookup.html', jsonipdata=jsonipdata)
    elif (lon != None and lat !=None):
        return render_template('iplookup.html', jsonipdata=jsonipdata, lon=lat, lat=lon)

@app.route('/<path:path>',methods=['GET'])
def apiHandler(path):
	ipaddr = path
	jsonipdata=iplookup(ipaddr)
	return render_template('iplookup.html', jsonipdata=jsonipdata)

if __name__ == "__main__":
    app.run(host='0.0.0.0', debug=True)
{'fraction_non_alphanumeric': 0.13529411764705881, 'fraction_numerical': 0.009411764705882352, 'mean_word_length': 3.629764065335753, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2686081', 'n_tokens_mistral': 885, 'n_tokens_neox': 868, 'n_words': 196}