def socket_auth(cls, password=None): """Authenticate to Steam Server Args: If password is None it will use password supplied in connect Returns: bool, error message """ if password is None: password = cls.password packet = SteamPacket.pack(password, 3) cls.socket_send( packet ) # Important to use _socket_send_packet. Do not want this queued or you might end up with endless reconnects result = cls._socket_read(True) if result is None: return False, 'No reply' for response in cls.incoming_packets: if response.packet_id == packet.packet_id: cls.incoming_packets.remove(response) cls.is_connected = True return True, None if response.packet_id == -1: return False, 'Failed. Wrong password?' return False, 'No response to auth packet'
def socket_auth(cls, password=None): """Authenticate to Steam Server Args: If password is None it will use password supplied in connect Returns: bool, error message """ if password is None: password = cls.password packet = SteamPacket.pack(password, 3) cls.socket_send(packet) # Important to use _socket_send_packet. Do not want this queued or you might end up with endless reconnects result = cls._socket_read(True) if result is None: return False, 'No reply' for response in cls.incoming_packets: if response.packet_id == packet.packet_id: cls.incoming_packets.remove(response) cls.is_connected = True return True, None if response.packet_id == -1: return False, 'Failed. Wrong password?' return False, 'No response to auth packet'
def send(cls, data, response_callback=None, priority=False): packet = SteamPacket.pack(data, 2) packet.response_callback = response_callback if priority: cls.outgoing_queue.appendleft(packet) else: cls.outgoing_queue.append(packet)