Skip to content

Instantly share code, notes, and snippets.

@bkvirendra
Last active February 15, 2017 23:51
Show Gist options
  • Save bkvirendra/e0d768a955efbff2890ce0f84c621f75 to your computer and use it in GitHub Desktop.
Save bkvirendra/e0d768a955efbff2890ce0f84c621f75 to your computer and use it in GitHub Desktop.
booking.com request
import requests
url = "https://www.booking.com/fragment.en-gb.json"
querystring = {"label":"gen173nr-1FCAsoUEITYXBhcnRtZW50LWVkaW5idXJnaEgzYgVub3JlZmhQiAEBmAEuwgEDYWJuyAEM2AEB6AEB-AELqAIE;sid=492fbc101c48a00638737132bfafa6f3"}
payload = "name=searchresults.restricted_availability&checkin=2017-03-21&checkout=2017-03-24&simpleav=1&src=srflex&search_config=%7B%22b_adults_total%22%3A2%2C%22b_nr_rooms_needed%22%3A1%2C%22b_children_total%22%3A0%2C%22b_is_group_search%22%3A0%2C%22b_pets_total%22%3A0%2C%22b_rooms%22%3A%5B%7B%22b_adults%22%3A2%2C%22b_room_order%22%3A1%7D%5D%7D&hids=%5B%221395666%22%5D"
headers = {
'cookie': "cws=true; _gat=1; zz_cook_tms_seg1=2; has_preloaded=1; zz_cook_tms_ed=1; zz_cook_tms_seg3=5; __qca=P0-1520944886-1487187098481; vpmss=1; zz_cook_tms_hlist=1395666; _tq_id.TV-634572-1.3b4c=5bf4a2d99216597d.1487187099.0.1487187430..; BJS=-; _ga=GA1.2.1446933302.1487187035; lastSeen=0; bkng=11UmFuZG9tSVYkc2RlIyh9YfDNyGw8J7nziSz%2Fat4kbjEhEP2TcjD8BVRhU29TkUSjNonsJ8%2FR9IhFXlvoEcApjaF1qV8aPP2FAib8x8eeTMgpqjKI5bNqHIwqrjeCxh4KThNsSy%2F%2B2rVOF5CKuSr5ErlbY55JNkQgLdqbFqMWIUD0as0eB8qHLAQpY02DKitXW4pbObBs7vyUVvm93JMlNA%3D%3D; utag_main=v_id:015a4341641d000d8a22cae40d650507800cc07000bd0$_sn:1$_ss:0$_st:1487189245942$ses_id:1487187043362%3Bexp-session$_pn:13%3Bexp-session$4split:0",
'x-booking-aid': "304142",
'x-booking-csrf': "DCGlWAAAAAA=yMLUvt2o2Z6OmLumQzdvgcETHPJGMa4fpNL0tfslrfxfCtKsSBUQYdADXSEk52Nfhx6yW7feWNTDVVpQl70lqeYz1sP1eXnNyzay98lrpmXxWgIfTD7o8imXmGpKfd46Mz5E2p_sfspxZU2iu1ieziTf4GJhERsL79yFXqEJ4XeZcRZgMyotSMxEb78",
'x-booking-info': "143209,144972,165077,168357,183127,184119,185503,192261,192706,193817,194168,194643,195650,195661,195926,196643,196946,197113,197382,197899,198584,198852,199439,199447,199619,199997,200087,200409,200440,200473,200497,200818,200864,201186,201237,201280,201435,201547,201619,201921,201964,202071,202212,202279,202326,202378,202398,202541,202643,202675,202804,203014,203107,203248,203311,203372,203375,203389,203403,203549,203613,203693,203875,204321,204335,204450,204508,204513,204536,204547,204653,204666,204668,204693,204695,204697,204699,204701,204742,204887,205089,205103,205221,205232,205443,205460,205512,205547,205564,205682,205697,205703,205712,205717,205723,205732,205873,205875,206104,206184,206196,206273,206342,206349,206358,206381,206386,206395,206630,206686,206706,206708,206712,206789,206793,YPNXKbBPVOaDUSCbCQPFaXKe|1,YPNXKbBPVOaDUSCbCQPFaXKe|3,VKGOQPKPZJFSMPXRO,206342|1,202398|1,205547|1,203403|1,200497|2,205089|1,184119|2,194643|1,204508|1,201280|1,183127|4,168357|3,204887|3,202279|1,202398|2,183127|1,199619|1,206712|1,VKGOQPKPZJFSMPXWBONPBXQdJC",
'x-booking-label': "gen173nr-1FCAsoUEITYXBhcnRtZW50LWVkaW5idXJnaEgzYgVub3JlZmhQiAEBmAEuwgEDYWJuyAEM2AEB6AEB-AELqAIE",
'x-booking-language-code': "en-gb",
'x-booking-pageview-id': "3ab7a7666ed402b1",
'x-booking-session-id': "492fbc101c48a00638737132bfafa6f3",
'x-booking-sitetype-id': "1",
'x-partner-channel-id': "3",
'x-requested-with': "XMLHttpRequest",
'user-agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
'cache-control': "no-cache",
'postman-token': "8c0c2eb4-2597-360e-c4f7-7c4e295ea429",
'content-type': "application/x-www-form-urlencoded"
}
response = requests.request("POST", url, data=payload, headers=headers, params=querystring)
print(response.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment