mirror of
https://github.com/pyro2927/SouthwestCheckin.git
synced 2025-12-06 01:13:19 +00:00
Merge pull request #41 from pyro2927/remove_tzlocal_dep
Removing dependancy on tz_local
This commit is contained in:
@@ -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 = []
|
||||
|
||||
@@ -9,6 +9,5 @@ python-dateutil
|
||||
pytz
|
||||
requests
|
||||
requests_mock
|
||||
tzlocal
|
||||
uuid
|
||||
vcrpy
|
||||
|
||||
@@ -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')
|
||||
@@ -14,12 +13,13 @@ r = southwest.Reservation('XXXXXX', 'John', 'Smith')
|
||||
|
||||
@my_vcr.use_cassette()
|
||||
def test_generate_headers():
|
||||
print(southwest.Reservation.generate_headers())
|
||||
headers = southwest.Reservation.generate_headers()
|
||||
assert(headers['Content-Type'] == 'application/json')
|
||||
assert(headers['X-API-Key'] == 'l7xx0a43088fe6254712b10787646d1b298e')
|
||||
|
||||
|
||||
@my_vcr.use_cassette()
|
||||
def test_reservation_lookup():
|
||||
print(r.notifications)
|
||||
try:
|
||||
r.lookup_existing_reservation()
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user