def location(request): if 'location' in request.GET: message=request.GET['location'] main.apply_access_token() file_out=main.add_timeline(message) dic=main.get_geo(message) loc={} loc['lat']=dic['latitude'] loc['longs']=dic['longitude'] f=open(file_out,'r') i=1 latlong={} for line in f.readlines(): c={} c['info']=line.split(';')[-4] c['lat']=line.split(';')[-3] c['longs']=line.split(';')[-2] c['address']=line.split(';')[-2] latlong[i]=c i +=1 f.close() return render_to_response('map.html',locals()) else: error=True return render_to_response('map.html',{'error':error})
def weibo(request): if 'location' in request.GET: message=request.GET['location'] main.apply_access_token() main.updateweibo(message) out="you have update a weibo" else: out ='please input a weibo' return HttpResponse(out)