-
Notifications
You must be signed in to change notification settings - Fork 1
/
static.py
55 lines (52 loc) · 1.69 KB
/
static.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
DESTINATIONS = [
{"name": "Pensacola, FL", "code": "PNS"},
{"name": "Myrtle Beach, SC", "code": "MYR"},
{"name": "Tybee Island, GA", "code": "SAV"},
{"name": "Virginia Beach, VA", "code": "ORF"},
{"name": "Carolina Beach, NC", "code": "OAJ"},
{"name": "Laguna Beach, CA", "code": "SNA"},
{"name": "San Juan, PR", "code": "SJU"},
{"name": "Boca Raton, FL", "code": "FLL"},
{"name": "Orlando, FL", "code": "MCO"},
{"name": "Folly Beach, SC", "code": "CHS"},
{"name": "San Diego, CA", "code": "SAN"},
{"name": "Maui, HI", "code": "OGG"},
{"name": "Carmel-by-the-Sea, CA", "code": "MRY"},
{"name": "Palm Springs, CA", "code": "PSP"}
]
ORIGINS = [
{"name": "New York, NY", "code": "NYC"},
{"name": "Denver, CO", "code": "DEN"},
{"name": "San Francisco, CA", "code": "SFO"}
]
DARK_SKY_ROUTE = 'https://api.darksky.net/forecast/{api_key}/{latitude:.4f},{longitude:.4f},{time}'
def make_search_payload(from_code, to_code, date_start, date_end, nonstop=False):
return {
"request": {
"passengers": {
"kind": "qpxexpress#passengerCounts",
"adultCount": 1,
"childCount": 0,
"infantInLapCount": 0,
"infantInSeatCount": 0,
"seniorCount": 0
},
"slice": [
{
"kind": "qpxexpress#sliceInput",
"origin": from_code,
"destination": to_code,
"date": date_start.strftime("%Y-%m-%d"),
"maxStops": 0 if nonstop else 1
},
{
"kind": "qpxexpress#sliceInput",
"origin": to_code,
"destination": from_code,
"date": date_end.strftime("%Y-%m-%d"),
"maxStops": 0 if nonstop else 1
}
],
"solutions": 3
}
}