为什么QPX查询结果与Google Flights中的结果有所不同? [英] Why does a QPX query result differ from that in Google Flights?

查看:154
本文介绍了为什么QPX查询结果与Google Flights中的结果有所不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始尝试Google的QPX Express API,一种机票搜索API。然而,这么多查询结果与我在Google Flights中获得的结果有所不同。



我不确定我错过了什么,但至少自Google Google Flights在内部使用API​​后,它应该返回相同的结果

例如,以下是我在Python中尝试的内容:

 导入json 
导入请求

url =https://www.googleapis.com/qpxExpress/v1/trips/search?key=myAPIKey
标题= {
content-type:application / json
}
with open(sample.json)as fp:
data = json.load(fp)
$ b = requests.post(url,data = json.dumps(data),headers = headers)
$ b $ print(r.json()[trip] [ tripOption] [0] [pricing] [0] [saleTotal])

应该返回最便宜的机票。但是,这似乎与您从网上的Google Flights获得的不同。我的JSON文件应该注入到请求的主体中,如下所示:

  {
request :{
passengers:{
adultCount:1,
childCount:0,
infantInLapCount:0,
infantInSeatCount: 0,
seniorCount:0
},
slice:[
{
origin:PEK,
destination :MIL,
date:2017-01-14,
maxStops:1
}
],
maxPrice: USD $ 500,
saleCountry:US,
可退款:false,
解决方案:500
}
}

我在Google Flights中输入了相同的内容,但结果不同。



为什么他们返回差异不同的结果?我在这里错过了什么?




截至目前,QPX返回的最便宜航班为239USD,而Google Flights返回241USD。

解决方案

我注意到QPX API和Ita Software Matrix(Google)给出了相同的结果,不包括很多公司像瑞安航空。 Google航班包含这些结果。



我向Google支持部门询问了这件事情。 答案是:

>

QPX Express API和Matrix仅包含与ATPCO一起提交的票价。有许多小型运营商和低成本运营商未提交。 / em>



询问Google是否考虑将这些航班添加到他们的API中,答案是:


$ b $

航空公司决定他们想要参与的分销渠道。如果其中任何一家航空公司要向ATPCO提交申请,那么我们肯定会对此感兴趣。

I just started to try Google's QPX Express API, an airline ticket search API. However, so many query results differ from those I get in Google Flights.

I'm not sure what I'm missing, but at least it should return the same results since Google Flights use the API internally.

For example, here is what I tried in Python:

import json
import requests

url = "https://www.googleapis.com/qpxExpress/v1/trips/search?key=myAPIKey"
headers = {
    "content-type": "application/json"
}
with open("sample.json") as fp:
    data = json.load(fp)

r = requests.post(url, data=json.dumps(data), headers=headers)

print(r.json()["trip"]["tripOption"][0]["pricing"][0]["saleTotal"])

This should return the cheapest flight ticket. However, this seems to be different from the one you can get from Google Flights on the Web. My JSON file, which should be poured into the body of the request, is the following:

    {
        "request": {
            "passengers": {
                "adultCount": 1,
                "childCount": 0,
                "infantInLapCount": 0,
                "infantInSeatCount": 0,
                "seniorCount": 0
            },
            "slice": [
                {
                    "origin": "PEK",
                    "destination": "MIL",
                    "date": "2017-01-14",
                    "maxStops": 1
                }
            ],
            "maxPrice": "USD500",
            "saleCountry": "US",
            "refundable": false,
            "solutions": 500
        }
    }

I typed in the same input into Google Flights, but the result was different.

Why do they return the different results? What am I missing here?


As of now, the QPX returned the cheapest flight as 239USD while Google Flights returned 241USD.

解决方案

I noticed that the QPX API and Ita Software Matrix (by Google) gives the same results, not including a lot of companies like Ryanair. Google flights includes these results.

I asked Google Support about it.

The answer is:

"QPX Express API and Matrix only include fares that are filed with ATPCO. There are a number of small carriers and low cost carriers that do not file."

Asking Google if they consider to add these flights to their APIs the answer was:

"Airlines determine which distribution channel they want to participate in. If any of these airlines were to file with ATPCO, then we would certainly be interested."

这篇关于为什么QPX查询结果与Google Flights中的结果有所不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆