1
0
mirror of https://github.com/pyro2927/SouthwestCheckin.git synced 2025-12-06 01:13:19 +00:00

Removing dependance on tz_local

Allows easier usage inside of Docker containers
This commit is contained in:
Joseph Pintozzi
2019-04-28 20:01:16 -07:00
parent 50adc51789
commit a680d6f4c0
3 changed files with 3 additions and 7 deletions

View File

@@ -22,7 +22,6 @@ from math import trunc
from pytz import utc
from southwest import Reservation, openflights
from threading import Thread
from tzlocal import get_localzone
import sys
import time
@@ -31,7 +30,7 @@ CHECKIN_EARLY_SECONDS = 5
def schedule_checkin(flight_time, reservation):
checkin_time = flight_time - timedelta(days=1)
current_time = datetime.now(utc).astimezone(get_localzone())
current_time = datetime.utcnow().replace(tzinfo=utc)
# check to see if we need to sleep until 24 hours before flight
if checkin_time > current_time:
# calculate duration to sleep
@@ -52,7 +51,7 @@ def auto_checkin(reservation_number, first_name, last_name, notify=[]):
body = r.lookup_existing_reservation()
# Get our local current time
now = datetime.now(utc).astimezone(get_localzone())
now = datetime.utcnow().replace(tzinfo=utc)
tomorrow = now + timedelta(days=1)
threads = []

View File

@@ -9,6 +9,5 @@ python-dateutil
pytz
requests
requests_mock
tzlocal
uuid
vcrpy

View File

@@ -5,8 +5,7 @@ import southwest
import checkin
from datetime import datetime, timedelta
from .my_vcr import custom_vcr
from pytz import timezone, utc
from tzlocal import get_localzone
from pytz import timezone
my_vcr = custom_vcr()
r = southwest.Reservation('XXXXXX', 'John', 'Smith')
@@ -19,7 +18,6 @@ def test_generate_headers():
@my_vcr.use_cassette()
def test_reservation_lookup():
print(r.notifications)
try:
r.lookup_existing_reservation()
except Exception: