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:
@@ -22,7 +22,6 @@ from math import trunc
|
|||||||
from pytz import utc
|
from pytz import utc
|
||||||
from southwest import Reservation, openflights
|
from southwest import Reservation, openflights
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from tzlocal import get_localzone
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ CHECKIN_EARLY_SECONDS = 5
|
|||||||
|
|
||||||
def schedule_checkin(flight_time, reservation):
|
def schedule_checkin(flight_time, reservation):
|
||||||
checkin_time = flight_time - timedelta(days=1)
|
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
|
# check to see if we need to sleep until 24 hours before flight
|
||||||
if checkin_time > current_time:
|
if checkin_time > current_time:
|
||||||
# calculate duration to sleep
|
# calculate duration to sleep
|
||||||
@@ -52,7 +51,7 @@ def auto_checkin(reservation_number, first_name, last_name, notify=[]):
|
|||||||
body = r.lookup_existing_reservation()
|
body = r.lookup_existing_reservation()
|
||||||
|
|
||||||
# Get our local current time
|
# Get our local current time
|
||||||
now = datetime.now(utc).astimezone(get_localzone())
|
now = datetime.utcnow().replace(tzinfo=utc)
|
||||||
tomorrow = now + timedelta(days=1)
|
tomorrow = now + timedelta(days=1)
|
||||||
|
|
||||||
threads = []
|
threads = []
|
||||||
|
|||||||
@@ -9,6 +9,5 @@ python-dateutil
|
|||||||
pytz
|
pytz
|
||||||
requests
|
requests
|
||||||
requests_mock
|
requests_mock
|
||||||
tzlocal
|
|
||||||
uuid
|
uuid
|
||||||
vcrpy
|
vcrpy
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ import southwest
|
|||||||
import checkin
|
import checkin
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from .my_vcr import custom_vcr
|
from .my_vcr import custom_vcr
|
||||||
from pytz import timezone, utc
|
from pytz import timezone
|
||||||
from tzlocal import get_localzone
|
|
||||||
|
|
||||||
my_vcr = custom_vcr()
|
my_vcr = custom_vcr()
|
||||||
r = southwest.Reservation('XXXXXX', 'John', 'Smith')
|
r = southwest.Reservation('XXXXXX', 'John', 'Smith')
|
||||||
@@ -19,7 +18,6 @@ def test_generate_headers():
|
|||||||
|
|
||||||
@my_vcr.use_cassette()
|
@my_vcr.use_cassette()
|
||||||
def test_reservation_lookup():
|
def test_reservation_lookup():
|
||||||
print(r.notifications)
|
|
||||||
try:
|
try:
|
||||||
r.lookup_existing_reservation()
|
r.lookup_existing_reservation()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user