def refresh_station(self, station): self.left_station = station.get('left') self.arrive_station = station.get('arrive') self.left_station_code = Station.get_station_key_by_name( self.left_station) self.arrive_station_code = Station.get_station_key_by_name( self.arrive_station)
def __init__(self, info, query): self.left_dates = info.get('left_dates') self.left_station = info.get('stations').get('left') self.arrive_station = info.get('stations').get('arrive') self.left_station_code = Station.get_station_key_by_name(self.left_station) self.arrive_station_code = Station.get_station_key_by_name(self.arrive_station) self.account_key = info.get('account_key') self.allow_seats = info.get('seats') self.allow_train_numbers = info.get('train_numbers') self.members = info.get('members') self.member_num = len(self.members) self.member_num_take = self.member_num self.allow_less_member = bool(info.get('allow_less_member')) self.interval = query.interval self.query = query
def get_info_of_arrive_station(self): return Station.get_station_name_by_key( self.ticket_info[self.INDEX_ARRIVE_STATION])
def get_info_of_left_station(self): return Station.get_station_name_by_key( self.ticket_info[self.INDEX_LEFT_STATION])
def did_start(cls): self = cls() from py12306.helpers.station import Station Station() # 防止多线程时初始化出现问题