tags: python net ip-address title: Get My Ip Address Source: [stackoverflow](https://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib) ```py import socket s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("8.8.8.8", 80)) print(s.getsockname()[0]) s.close() ```