コード例 #1
0
ファイル: views.py プロジェクト: silent1mezzo/HackTO2
def category(request, category):
    template_name = "category.html"
    context = RequestContext(request)
    dict = {}
    form = SearchForm(request.GET)
    address = request.GET.get("address")
    dict["address"] = address
    dict["lat"], dict["lon"] = get_lat_long(address)
    dict["businesses"] = yellowcache.getResults(address)[category]
    dict["category"] = category
    dict["form"] = form
    return render_to_response(template_name, dict, context)
コード例 #2
0
ファイル: views.py プロジェクト: silent1mezzo/HackTO2
def search(request):
    template_name = "search.html"
    context = RequestContext(request)
    dict = {}

    if request.POST:
        form = SearchForm(request.POST)
        if form.is_valid():
            address = form.cleaned_data["address"]
            dict["address"] = address
            # api = YellowBetterAPI(api_key= '', where = address, uid='hackto2', test_mode=False)
            # dict['businesses'] = api.categoriesAndBusinesses()
            dict["businesses"] = yellowcache.getResults(address)
            dict["lat"], dict["lon"] = get_lat_long(address)

            # dict['businesses'] = BUSINESSES
    else:
        form = SearchForm()

    dict["form"] = form
    return render_to_response(template_name, dict, context)
コード例 #3
0
ファイル: test_sms.py プロジェクト: silent1mezzo/HackTO2
def send_message(address, category):
    print address, category
    for business in yellowcache.getResults(address)[category]:
        msg = "%s at %s %s, %s %s..." % (business['name'], business['address']['street'], business['address']['city'], business['address']['prov'], business['address']['pcode']) 
        message = client.sms.messages.create(to="+14162949555", from_="+16479311254", body=msg[:160])