Skip to content

Instantly share code, notes, and snippets.

@xhimanshuz
Forked from anhldbk/get_public_ip.py
Created April 5, 2018 00:54
Show Gist options
  • Save xhimanshuz/16d6b18ca2c2eaaca9693d54720f0e91 to your computer and use it in GitHub Desktop.
Save xhimanshuz/16d6b18ca2c2eaaca9693d54720f0e91 to your computer and use it in GitHub Desktop.
Get public IP with Python & Requests
import requests
r = requests.get(r'http://jsonip.com')
ip= r.json()['ip']
print 'Your IP is', ip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment