{"id":2813,"date":"2025-03-31T06:50:16","date_gmt":"2025-03-31T06:50:16","guid":{"rendered":"https:\/\/www.makcorps.com\/blog\/?p=2813"},"modified":"2025-04-09T10:23:12","modified_gmt":"2025-04-09T10:23:12","slug":"extract-booking-com-data-with-python-and-makcorps-api","status":"publish","type":"post","link":"https:\/\/www.makcorps.com\/blog\/extract-booking-com-data-with-python-and-makcorps-api\/","title":{"rendered":"Extract Booking.com Data with Python and Makcorps Hotel API"},"content":{"rendered":"\n<p>To gain a competitive edge, many companies extract data from their competitors. However, doing this requires building a web scraper. Simply using a basic GET request isn\u2019t effective, as the host website will quickly detect and block your IP, making it impossible to access the data reliably.<\/p>\n\n\n\n<p id=\"d6d4\">In this tutorial, I will explain how, with the help of&nbsp;<a href=\"https:\/\/www.python.org\/\" rel=\"noreferrer noopener\" target=\"_blank\">Python<\/a>&nbsp;and Makcorps&nbsp;<a href=\"https:\/\/www.makcorps.com\/\" rel=\"noreferrer noopener\" target=\"_blank\">Hotel API<\/a>, you can pull data of millions of hotels from&nbsp;<a href=\"https:\/\/www.booking.com\/\" rel=\"noreferrer noopener\" target=\"_blank\">booking.com<\/a>.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #e29a12;color:#e29a12\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #e29a12;color:#e29a12\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.makcorps.com\/blog\/extract-booking-com-data-with-python-and-makcorps-api\/#Requirements\" >Requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.makcorps.com\/blog\/extract-booking-com-data-with-python-and-makcorps-api\/#Extracting_data_from_Bookingcom\" >Extracting data from Booking.com<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.makcorps.com\/blog\/extract-booking-com-data-with-python-and-makcorps-api\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.makcorps.com\/blog\/extract-booking-com-data-with-python-and-makcorps-api\/#Additional_Resources\" >Additional Resources<\/a><\/li><\/ul><\/nav><\/div>\n<h1 class=\"wp-block-heading\" id=\"9886\"><span class=\"ez-toc-section\" id=\"Requirements\"><\/span>Requirements<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<p id=\"8e29\">I hope you have already installed&nbsp;<a href=\"https:\/\/www.python.org\/\" rel=\"noreferrer noopener\" target=\"_blank\">Python<\/a>&nbsp;on your machine; if not, you can download it from here. Next, you have to&nbsp;<a href=\"https:\/\/www.makcorps.com\/signup.html\" rel=\"noreferrer noopener\" target=\"_blank\">sign up<\/a>&nbsp;for the free trial of Makcorps<\/p>\n\n\n\n<p id=\"8c3e\">Now, create a folder by any name you like.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir hotel<\/pre>\n\n\n\n<p id=\"660a\">Install the<mark style=\"background-color:var(--global-palette7)\" class=\"has-inline-color has-theme-palette-7-color\">\u00a0<code><a href=\"https:\/\/pypi.org\/project\/requests\/\" target=\"_blank\" rel=\"noreferrer noopener\">requests<\/a><\/code><\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-theme-palette-7-color\">\u00a0<\/mark>library inside this folder. This library will be used to make an HTTP connection with the Makcorps API.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pip install requests<\/pre>\n\n\n\n<p id=\"f1ef\">Finally, create a Python file by any name you like. I am naming the file as\u00a0<code><strong><mark style=\"background-color:var(--global-palette7)\" class=\"has-inline-color\">booking.py<\/mark><\/strong><\/code>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"9463\"><span class=\"ez-toc-section\" id=\"Extracting_data_from_Bookingcom\"><\/span>Extracting data from Booking.com<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<pre class=\"wp-block-preformatted\">import requests<br><br>url = \"https:\/\/api.makcorps.com\/booking\"<br>params = {<br>    \"country\": \"us\",<br>    \"hotelid\": \"holiday-inn-sacramento-capitol-plaza\",<br>    \"checkin\": \"2025-07-05\",<br>    \"checkout\": \"2025-07-11\",<br>    \"currency\": \"USD\",<br>    \"kids\": 0,<br>    \"adults\": 2,<br>    \"rooms\": 1,<br>    \"api_key\": \"your-api-key\"<br>}<br><br>response = requests.get(url, params=params)<br><br>if response.status_code == 200:<br>    print(response.json())<br>else:<br>    print(f\"Request failed with status code {response.status_code}\")<\/pre>\n\n\n\n<p id=\"a76d\">The code is pretty simple, but let me give you an overview of this code.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, we imported the\u00a0<code><mark style=\"background-color:var(--global-palette7)\" class=\"has-inline-color\">requests<\/mark><\/code>\u00a0library.<\/li>\n\n\n\n<li>Then, we have created a params object in which we have passed\u00a0<code><mark style=\"background-color:var(--global-palette7)\" class=\"has-inline-color\">checkin<\/mark><\/code>,\u00a0<code><mark style=\"background-color:var(--global-palette7)\" class=\"has-inline-color\">checkout<\/mark><\/code>\u00a0dates, the ID of the hotel used by Booking.com itself,\u00a0<code><mark style=\"background-color:var(--global-palette7)\" class=\"has-inline-color\">currency<\/mark><\/code>, <mark style=\"background-color:var(--global-palette7)\" class=\"has-inline-color\">number of\u00a0<code>kids<\/code><\/mark>,\u00a0<code><mark style=\"background-color:var(--global-palette7)\" class=\"has-inline-color\">rooms<\/mark><\/code>, and\u00a0<code><mark style=\"background-color:var(--global-palette7)\" class=\"has-inline-color\">adults<\/mark><\/code>.<\/li>\n\n\n\n<li>Then, using\u00a0<code><mark style=\"background-color:var(--global-palette7)\" class=\"has-inline-color\">requests<\/mark><\/code>\u00a0library, we are making a GET request to the\u00a0<code><mark style=\"background-color:var(--global-palette7)\" class=\"has-inline-color\">api.makcorps.com\/booking<\/mark><\/code>\u00a0endpoint.<\/li>\n\n\n\n<li>If the API responds with a 200 status code, we are going to console the output.<\/li>\n\n\n\n<li>Otherwise, we are printing the error.<\/li>\n<\/ul>\n\n\n\n<p id=\"152c\">Let\u2019s run the code and see what we get.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:881\/1*BWvC5njPzeF1ohUv9S5C3A.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"46e6\">We got all the details in a JSON format. In this response, you will find all the room prices offered by that hotel.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"0bde\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<p id=\"4f80\">Scraping data from Booking.com manually can be time-consuming, error-prone and often leads to IP bans. That\u2019s where <a href=\"https:\/\/www.makcorps.com\/\">Makcorps\u2019 Hotel Price API<\/a> comes in. It gives you direct access to real-time pricing data from Booking.com with just a simple API call, no scraping setup, no maintenance, and no headaches.<\/p>\n\n\n\n<p id=\"b5fe\">Whether you\u2019re building a price comparison tool, analyzing market trends, or simply want to keep tabs on competitor pricing, this API provides a fast and scalable solution. With reliable data and easy integration, you can focus on building your product, not battling anti-scraping mechanisms.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"5041\"><span class=\"ez-toc-section\" id=\"Additional_Resources\"><\/span>Additional Resources<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.makcorps.com\/blog\/extract-hotel-prices-from-multiple-vendors-using-google-sheet-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">Extract Hotel Price Data From Multiple Vendors Using Google Sheets and Hotel Price API<\/a><a href=\"https:\/\/scrapingking.medium.com\/?source=post_page---byline--3d12a99f42bc---------------------------------------\" target=\"_blank\" rel=\"noopener\"><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.makcorps.com\/blog\/extract-booking-com-hotel-prices-into-google-sheets\/\" target=\"_blank\" rel=\"noreferrer noopener\">Extract Booking.com hotel prices in a Google sheet<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.makcorps.com\/blog\/track-cheapest-hotel-prices-across-vendors-using-google-sheet\/\">How to Track the Cheapest Hotel Prices Across Top Vendors Using Hotel Price API and Google Sheets<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.makcorps.com\/blog\/track-hotel-deals-under-budget-using-hotel-price-api\/\">Track Hotel Deals Under Budget with Make.com and Hotel Price API<\/a><br><br><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To gain a competitive edge, many companies extract data from their competitors. However, doing this requires building a web scraper. Simply using a basic GET request isn\u2019t effective, as the host website will quickly detect and block your IP, making it impossible to access the data reliably. In this tutorial, I will explain how, with&#8230;<\/p>\n","protected":false},"author":3,"featured_media":2816,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[49],"tags":[],"class_list":["post-2813","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/www.makcorps.com\/blog\/wp-json\/wp\/v2\/posts\/2813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.makcorps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.makcorps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.makcorps.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.makcorps.com\/blog\/wp-json\/wp\/v2\/comments?post=2813"}],"version-history":[{"count":3,"href":"https:\/\/www.makcorps.com\/blog\/wp-json\/wp\/v2\/posts\/2813\/revisions"}],"predecessor-version":[{"id":2823,"href":"https:\/\/www.makcorps.com\/blog\/wp-json\/wp\/v2\/posts\/2813\/revisions\/2823"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.makcorps.com\/blog\/wp-json\/wp\/v2\/media\/2816"}],"wp:attachment":[{"href":"https:\/\/www.makcorps.com\/blog\/wp-json\/wp\/v2\/media?parent=2813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.makcorps.com\/blog\/wp-json\/wp\/v2\/categories?post=2813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.makcorps.com\/blog\/wp-json\/wp\/v2\/tags?post=2813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}