<commit_before>from django.shortcuts import render
import requests
import urllib
import json

GOOGLEKEY = open("key.txt").readline()

def index(request):
    return render(request, "index.html")

def search(request):
    if request.method == "GET":
        return index(request)
    elif request.method == "POST":
        #Work in progress
        args = {"searchParam": request.POST["search"]}
        payload = {"address": urllib.quote_plus(request.POST["search"]), "key": GOOGLEKEY}
        geocode = requests.get('https://maps.googleapis.com/maps/api/geocode/json', params=payload) #returns 404

        print geocode.text
        payload = {"location": urllib.quote_plus(request.POST["search"]), "types":"bakery|cafe|food|meal_takeaway|restaurant" ,"rankby":"distance", "key": GOOGLEKEY}
        nearbysearch = requests.get('https://maps.googleapis.com/maps/api/place/nearbysearch/json', params=payload)
        print r.url
        print r.text
        args["places"] = nearbysearch.json["results"]
        return render(request, "search.html", args)

def place(request, PLACE_ID):
    return render(request, "place.html")

def register(request):
    return render(request, "register.html")

def login(request):
    return render(request, "login.html")

def profile(request):
    return render(request, "profile.html")<commit_msg>profile view got info from models<commit_after>from django.shortcuts import render
import requests
import urllib
import json

GOOGLEKEY = open("key.txt").readline()

def index(request):
    return render(request, "index.html")

def search(request):
    if request.method == "GET":
        return index(request)
    elif request.method == "POST":
        #Work in progress
        args = {"searchParam": request.POST["search"]}
        payload = {"address": urllib.quote_plus(request.POST["search"]), "key": GOOGLEKEY}
        geocode = requests.get('https://maps.googleapis.com/maps/api/geocode/json', params=payload) #returns 404

        print geocode.text
        payload = {"location": urllib.quote_plus(request.POST["search"]), "types":"bakery|cafe|food|meal_takeaway|restaurant" ,"rankby":"distance", "key": GOOGLEKEY}
        nearbysearch = requests.get('https://maps.googleapis.com/maps/api/place/nearbysearch/json', params=payload)
        print r.url
        print r.text
        args["places"] = nearbysearch.json["results"]
        return render(request, "search.html", args)

def place(request, PLACE_ID):
    return render(request, "place.html")

def register(request):
    return render(request, "register.html")

def login(request):
    return render(request, "login.html")

def profile(request):
    context_dict = {}
    user = request.user
    context_dict['user'] = user
    return render(request, 'profile.html', context_dict)
{'fraction_non_alphanumeric': 0.14485981308411214, 'fraction_numerical': 0.002156721782890007, 'mean_word_length': 3.9785330948121644, 'pattern_counts': {'":': 18, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4418158', 'n_tokens_mistral': 856, 'n_tokens_neox': 823, 'n_words': 182}