当前位置:   article > 正文

携程酒店价格采集API_idatariver 携程api

idatariver 携程api

近期调研发现iDataRiver平台 https://idatariver.com 上有供应商上架了开箱即用的携程酒店API,可以按需调用。本人简单测试了一下效果还可以,故记录下来以备日后使用。

接口使用详情请参考携程API文档

https://idatariver.com/zh-cn/project/7713

接口介绍

1. 获取携程酒店指定日期的客房列表
参数类型是否必填默认值示例值描述
apikeystringidr_***控制台里复制apikey
hotel_idstring16983307酒店id
check_instring2024-06-05入住日期
check_outstring2024-06-06离店日期

python代码使用requests库请求示例

import requests

# 构建请求URL
# Build request URL
url = "https://apiok.us/api/7713/hotel/rooms/v1"

# 将apikey替换为自己的
# Replace apikey with yours
params = {
    'apikey': 'idr_***',
    'hotel_id': '16983307',
    'check_in': '2024-06-05',
    'check_out': '2024-06-06',
}

response = requests.get(url, params=params, timeout=60)
data = response.json()

# 打印返回结果
# print response
print(f"Your response is: {data}")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/874828
推荐阅读
相关标签
  

闽ICP备14008679号