Created
October 31, 2017 07:19
-
-
Save binary-signal/f9226142d06af71a23907f38ba71b8e1 to your computer and use it in GitHub Desktop.
get-ip-addr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_ip_address(): | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.connect(("8.8.8.8", 80)) | |
return s.getsockname()[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment