Python function to retrieve the public client IP address of the localhost (via jsonip.com's API).
#!/usr/bin/env python
import requests
def get_public_ip():
try:
json = requests.get("http://jsonip.com/").json()
return json["ip"]
except:
return None
if __name__ == "__main__":
print(get_public_ip())