mirror of
https://github.com/pyro2927/SouthwestCheckin.git
synced 2025-12-06 01:13:19 +00:00
Initial commit
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.pyc
|
||||
*.swp
|
||||
7
README.md
Normal file
7
README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# SW Checkin
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
$ python ./checkin.py CONFIRMATION_NUMBER FIRST_NAME LAST_NAME
|
||||
```
|
||||
30
checkin.py
Normal file
30
checkin.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import requests
|
||||
import sys
|
||||
|
||||
# Pulled from proxying the Southwest iOS App
|
||||
headers = {'Host': 'mobile.southwest.com', 'Content-Type': 'application/vnd.swacorp.com.mobile.reservations-v1.0+json', 'X-API-Key': 'l7xxab4b3533b8d54bad9df230deb96a6f90', 'Accept': '*/*'}
|
||||
|
||||
reservation_number = sys.argv[1]
|
||||
first_name = sys.argv[2]
|
||||
last_name = sys.argv[3]
|
||||
|
||||
# Find our existing record
|
||||
url = "https://mobile.southwest.com/api/extensions/v1/mobile/reservations/record-locator/{}?first-name={}&last-name={}".format(reservation_number, first_name, last_name)
|
||||
|
||||
r = requests.get(url, headers=headers)
|
||||
body = r.json()
|
||||
|
||||
# Get our passengers to get boarding passes for
|
||||
passengers = []
|
||||
for passenger in body['passengers']:
|
||||
passengers.append({'firstName': passenger['secureFlightName']['firstName'], 'lastName': passenger['secureFlightName']['lastName']})
|
||||
|
||||
# Check in
|
||||
headers['Content-Type'] = 'application/vnd.swacorp.com.mobile.boarding-passes-v1.0+json'
|
||||
url = "https://mobile.southwest.com/api/extensions/v1/mobile/reservations/record-locator/{}/boarding-passes".format(reservation_number)
|
||||
r = requests.post(url, headers=headers, json={'names': passengers})
|
||||
|
||||
# Spit out info about boarding number
|
||||
for checkinDocument in r.json()['passengerCheckInDocuments']:
|
||||
for doc in checkinDocument['checkinDocuments']:
|
||||
print "You got {}{}!".format(doc['boardingGroup'], doc['boardingGroupNumber'])
|
||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
requests
|
||||
Reference in New Issue
Block a user