Beispiel #1
0
    def post(self, request):
        exception = None
        response = {"result": {"result": None}}
        responsecode = 0

        hotels_data = {}
        Message = {}
        ErrorMessage = {}

        print ':Valid serializer'
        hotels = Hotels()

        hotels_response = hotels.GetCountries()

        print ':Hotels  View REsponse: ', hotels_response

        response['result'] = json.loads(hotels_response)
        print 'Results : %s' % (response)

        return ApiResponse(responsecode, response, exception)
Beispiel #2
0
    def post(self, request):
        exception = None
        response = {"result": {"result": None}}
        responsecode = 0
        serializer = self.serializer_class(data=request.data)
        hotels_data = {}
        Message = {}
        ErrorMessage = {}

        if serializer.is_valid():
            print ':Valid serializer'
            hotels = Hotels()

            hotels_data['hotel_ids'] = serializer.validated_data['hotel_ids']
            hotel_ids = hotels_data['hotel_ids']

            print "Hotel id %s" % hotel_ids

            hotels_data['extras'] = serializer.validated_data['extras']
            extras = hotels_data['extras']

            print "Extras id %s" % extras

            hotels_response = hotels.GetHotels(hotel_ids, extras)

            print ':Hotels  View REsponse: ', hotels_response

            response['result'] = json.loads(hotels_response)
            print 'Results : %s' % (response)

        else:
            print ':Invalid serializer'
            responsecode = 7
            response['errors'] = serializer.errors

        return ApiResponse(responsecode, response, exception)
Beispiel #3
0
    def post(self, request):
        exception = None
        response = {"result": {"result": None}}
        responsecode = 0
        serializer = self.serializer_class(data=request.data)
        hotels_data = {}
        Message = {}
        ErrorMessage = {}

        if serializer.is_valid():
            print ':Valid serializer'
            hotels = Hotels()

            hotels_data['languages'] = serializer.validated_data['languages']
            languages = hotels_data['languages']

            print "Languages %s" % languages

            hotels_data['rows'] = serializer.validated_data['rows']
            rows = hotels_data['rows']

            print "Number of rows%s" % rows

            hotels_response = hotels.GetHotelTypes(languages, rows)

            print ':Hotels  View REsponse: ', hotels_response

            response['result'] = json.loads(hotels_response)
            print 'Results : %s' % (response)

        else:
            print ':Invalid serializer'
            responsecode = 7
            response['errors'] = serializer.errors

        return ApiResponse(responsecode, response, exception)