def get_local_ip_address(): s = socket(AF_INET, SOCK_DGRAM) s.connect(("8.8.8.8", 80)) return s.getsockname()[0]