File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import requests as r
2+ def Get_Prices (origin = "JAX" , destination = "NYC" , month = "AUGUST 2021" , data = None ):
3+ url = "https://jbrest.jetblue.com/bff/bff-service/bestFares"
4+ headers = {
5+ "Accept" : "application/json, text/plain, */*" ,
6+ "Content-Type" : "application/json" ,
7+ "Referer" : "https://www.jetblue.com/best-fare-finder" ,
8+ "sec-ch-ua" : '" Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"' ,
9+ "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36" ,
10+ }
11+ if data == None :
12+ data = {
13+ "origin" : origin ,
14+ "destination" : destination ,
15+ "fareType" : "LOWEST" ,
16+ "month" : month ,
17+ "tripType" : "ONE_WAY" ,
18+ "adult" : "1" ,
19+ "child" : "0" ,
20+ "infant" : "0" ,
21+ }
22+ res = r .post (url = url , json = data , headers = headers )
23+ return res .json ()
24+
25+ if __name__ == '__main__' :
26+ data = {
27+ "origin" : "JFK" ,
28+ "destination" : "DFW" ,
29+ "fareType" : "POINTS" ,
30+ "month" : "AUGUST 2021" ,
31+ "tripType" : "ONE_WAY" ,
32+ "adult" : "1" ,
33+ "child" : "0" ,
34+ "infant" : "0" ,
35+ }
36+ r = Get_Prices (data = data )
37+ print (r )
You can’t perform that action at this time.
0 commit comments