Esempio n. 1
0
    def get(self, request):
        if 'uuid' in self.request.GET and 'lon' in self.request.GET and 'lat' in self.request.GET \
                and 'ts' in self.request.GET:
            uuid = self.request.GET['uuid']
            lon = float(self.request.GET['lon'])
            lat = float(self.request.GET['lat'])
            ts = int(self.request.GET['ts'])
        else:
            response = HttpResponse("Insufficient data provided.")
            response.status_code = 400
            return response

        if 'ac' in self.request.GET:
            ac = self.request.GET['ac']
            if ac not in ['0', '1', '2', '3']:
                ac = 0
            else:
                ac = int(ac)
        else:
            ac = 0

        if 'ignore' in self.request.GET:
            ignore = self.request.GET['ignore']
        else:
            ignore = 'None'

        # +--------------------------------------+
        # | Get poi_num param for final version. |
        # +--------------------------------------+

        dict_res = get_recommendation(ts, {'lat': lat, 'lon': lon}, uuid, ignore)
        response = HttpResponse(json.dumps(dict_res), content_type="application/json")
        response.status_code = 200
        return response
Esempio n. 2
0
    def get(self, request):
        if 'uuid' in self.request.GET and 'lon' in self.request.GET and 'lat' in self.request.GET \
                and 'ts' in self.request.GET:
            uuid = self.request.GET['uuid']
            lon = float(self.request.GET['lon'])
            lat = float(self.request.GET['lat'])
            ts = int(self.request.GET['ts'])
        else:
            return HttpResponse("Insufficient data provided.")

        if 'ac' in self.request.GET:
            ac = self.request.GET['ac']
            if ac not in ['0', '1', '2', '3']:
                ac = 0
            else:
                ac = int(ac)
        else:
            ac = 0

        if 'ignore' in self.request.GET:
            ignore = self.request.GET['ignore']
        else:
            ignore = 'None'

        # +--------------------------------------+
        # | Get poi_num param for final version. |
        # +--------------------------------------+

        dict_res = get_recommendation(ts, {
            'lat': lat,
            'lon': lon
        }, uuid, ignore)
        return HttpResponse(json.dumps(dict_res),
                            content_type="application/json")
Esempio n. 3
0
File: views.py Progetto: ALojdl/CAR
    def get(self, request):
        if 'uuid' in self.request.GET and 'matrix' in self.request.GET and 'lon' in self.request.GET and 'lat' in \
                self.request.GET and 'ts' in self.request.GET:
            matrix = self.request.GET['matrix']
            uuid = self.request.GET['uuid']
            lon = float(self.request.GET['lon'])
            lat = float(self.request.GET['lat'])
            ts = int(self.request.GET['ts'])
        else:
            response = HttpResponse("Insufficient data provided.")
            response.status_code = 400
            return response

        if 'ignore' in self.request.GET:
            ignore = self.request.GET['ignore']
        else:
            ignore = 'None'

        if 'number' in self.request.GET:
            number = int(self.request.GET['number'])
        else:
            number = 5

        dict_res = get_recommendation(matrix, ts, {'lat': lat, 'lon': lon}, uuid, ignore, number)
        response = HttpResponse(json.dumps(dict_res), content_type="application/json")
        response.status_code = 200
        return response
Esempio n. 4
0
 def get(self, request):
     dict_res = get_recommendation(
         u"dd61702d4b4e13e2291723bbb22d5981",
         1429260495,
         {"lat": 45.254, "lon": 19.824},
         "vfdjv36q9347fdvgsdv",
         None,
         5,
     )
     return HttpResponse(str(dict_res))
Esempio n. 5
0
    def get(self, request):
        if (
            "uuid" in self.request.GET
            and "matrix" in self.request.GET
            and "lon" in self.request.GET
            and "lat" in self.request.GET
            and "ts" in self.request.GET
        ):
            matrix = self.request.GET["matrix"]
            uuid = self.request.GET["uuid"]
            lon = float(self.request.GET["lon"])
            lat = float(self.request.GET["lat"])
            ts = int(self.request.GET["ts"])
        else:
            response = HttpResponse("Insufficient data provided.")
            response.status_code = 400
            return response

        if "ac" in self.request.GET:
            ac = self.request.GET["ac"]
            if ac not in ["0", "1", "2", "3"]:
                ac = 0
            else:
                ac = int(ac)
        else:
            ac = 0

        if "ignore" in self.request.GET:
            ignore = self.request.GET["ignore"]
        else:
            ignore = "None"

        if "number" in self.request.GET:
            number = int(self.request.GET["number"])
        else:
            number = 5

        dict_res = get_recommendation(matrix, ts, {"lat": lat, "lon": lon}, uuid, ignore, number)
        response = HttpResponse(json.dumps(dict_res), content_type="application/json")
        response.status_code = 200
        return response
Esempio n. 6
0
    def get(self, request):
        if (
            "uuid" in self.request.GET
            and "lon" in self.request.GET
            and "lat" in self.request.GET
            and "ts" in self.request.GET
        ):
            uuid = self.request.GET["uuid"]
            lon = float(self.request.GET["lon"])
            lat = float(self.request.GET["lat"])
            ts = int(self.request.GET["ts"])
        else:
            response = HttpResponse("Insufficient data provided.")
            response.status_code = 400
            return response

        if "ac" in self.request.GET:
            ac = self.request.GET["ac"]
            if ac not in ["0", "1", "2", "3"]:
                ac = 0
            else:
                ac = int(ac)
        else:
            ac = 0

        if "ignore" in self.request.GET:
            ignore = self.request.GET["ignore"]
        else:
            ignore = "None"

        # +--------------------------------------+
        # | Get poi_num param for final version. |
        # +--------------------------------------+

        dict_res = get_recommendation(ts, {"lat": lat, "lon": lon}, uuid, ignore)
        response = HttpResponse(json.dumps(dict_res), content_type="application/json")
        response.status_code = 200
        return response
Esempio n. 7
0
 def get(self, request):
     dict_res = get_recommendation(1429260495, {'lat': 45.2555, 'lon': 19.8454321}, "vfdjv36q9347fdvgsdv", None)
     return HttpResponse(str(dict_res))