mirror of
https://github.com/pyro2927/SouthwestCheckin.git
synced 2025-12-06 01:13:19 +00:00
Compatibility between python3 and python2.7.11
Tested locally, just needed to update the print statements
This commit is contained in:
12
checkin.py
12
checkin.py
@@ -24,7 +24,7 @@ body = r.json()
|
|||||||
|
|
||||||
# Confirm this reservation is found
|
# Confirm this reservation is found
|
||||||
if 'httpStatusCode' in body and body['httpStatusCode'] == 'NOT_FOUND':
|
if 'httpStatusCode' in body and body['httpStatusCode'] == 'NOT_FOUND':
|
||||||
print body['message']
|
print(body['message'])
|
||||||
else:
|
else:
|
||||||
now = datetime.now(pytz.utc).astimezone(get_localzone())
|
now = datetime.now(pytz.utc).astimezone(get_localzone())
|
||||||
tomorrow = now + timedelta(days=1)
|
tomorrow = now + timedelta(days=1)
|
||||||
@@ -41,17 +41,17 @@ else:
|
|||||||
if date > now:
|
if date > now:
|
||||||
break
|
break
|
||||||
|
|
||||||
print "Flight information found, departing {} at {}".format(airport, date.strftime('%b %d %I:%M%p'))
|
print("Flight information found, departing {} at {}".format(airport, date.strftime('%b %d %I:%M%p')))
|
||||||
|
|
||||||
# Wait until checkin time
|
# Wait until checkin time
|
||||||
if date > tomorrow:
|
if date > tomorrow:
|
||||||
delta = (date-tomorrow).total_seconds()
|
delta = (date-tomorrow).total_seconds()
|
||||||
m, s = divmod(delta, 60)
|
m, s = divmod(delta, 60)
|
||||||
h, m = divmod(m, 60)
|
h, m = divmod(m, 60)
|
||||||
print "Too early to check in. Waiting {} hours, {} minutes, {} seconds".format(trunc(h), trunc(m), s)
|
print("Too early to check in. Waiting {} hours, {} minutes, {} seconds".format(trunc(h), trunc(m), s))
|
||||||
time.sleep(delta)
|
time.sleep(delta)
|
||||||
|
|
||||||
print "Attempting check-in..."
|
print("Attempting check-in...")
|
||||||
|
|
||||||
# Get our passengers to get boarding passes for
|
# Get our passengers to get boarding passes for
|
||||||
passengers = []
|
passengers = []
|
||||||
@@ -66,9 +66,9 @@ else:
|
|||||||
body = r.json()
|
body = r.json()
|
||||||
|
|
||||||
if 'httpStatusCode' in body and body['httpStatusCode'] == 'FORBIDDEN':
|
if 'httpStatusCode' in body and body['httpStatusCode'] == 'FORBIDDEN':
|
||||||
print body['message']
|
print(body['message'])
|
||||||
else:
|
else:
|
||||||
# Spit out info about boarding number
|
# Spit out info about boarding number
|
||||||
for checkinDocument in body['passengerCheckInDocuments']:
|
for checkinDocument in body['passengerCheckInDocuments']:
|
||||||
for doc in checkinDocument['checkinDocuments']:
|
for doc in checkinDocument['checkinDocuments']:
|
||||||
print "You got {}{}!".format(doc['boardingGroup'], doc['boardingGroupNumber'])
|
print("You got {}{}!".format(doc['boardingGroup'], doc['boardingGroupNumber']))
|
||||||
|
|||||||
Reference in New Issue
Block a user