Skip to content

This repository contains the API for Generating links that redirect you to the search results of Kayak.co.in website based on the date and destination of your choice.

Notifications You must be signed in to change notification settings

FAHADPN/Hotel-search-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hotel-search-API

This project contains the API for generating links that redirect you to the search results of Kayak.co.in website based on the date and destination of your choice. This helps you to create HyperLinks in your website or bots based on user choice of destination, check-in and check-out dates.

How to run

Installing Packages

  1. First step is make sure you have proper version of python

    Check your python version:
python --version
  1. Clone the repository to your local Machine

    Cloning Repository
git clone https://github.com/FAHADPN/Hotel-search-API.git
  1. Now install all the packages using following command:
pip install -r requirements.txt
  1. Now you make migrations and also migrate:
python manage.py makemigrations
python manage.py migrate
  1. Now that you have successfully migrated now you are ready to localhost the api. Use following command to run server:
python manage.py runserver
  1. Now the API will be running in the port 8000:
'http://127.0.0.1:8000/api/hotel_url/'
'http://localhost:8000/api/hotel_url/'
  1. The example json format of API request:
data = {
    'destination': 'New York',           # Replace with your destination
    'check_in_date': '2023-09-15',       # Replace with your check-in date
    'check_out_date': '2023-09-20',      # Replace with your check-out date
}
  1. You can check if the API is properly working by using the following python code
import requests
import json

# Replace with your API endpoint URL
api_url = 'http://127.0.0.1:8000/api/hotel_url/'

# Define the input data as a dictionary
data = {
    'destination': 'New York',           # Replace with your destination
    'check_in_date': '2023-09-15',       # Replace with your check-in date
    'check_out_date': '2023-09-20',      # Replace with your check-out date
}

# Make a POST request to the API
response = requests.post(api_url, data=json.dumps(data), headers={'Content-Type': 'application/json'})

# Check the response
if response.status_code == 200:
    result = response.json()
    kayak_url = result.get('url')
    print(f'Generated Kayak URL: {kayak_url}')
else:
    print(f'Error: {response.status_code} - {response.text}')

Conclusion

This project will help you as a starting point to building APIs using Django. Also helps you generate links for hotels in a particular area.

For help & support

contact :

LinkedIn: Fahad P N
mail: fahadpuzhakkaraillath@gmail.com

About

This repository contains the API for Generating links that redirect you to the search results of Kayak.co.in website based on the date and destination of your choice.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages