Python2018/labs04/examples/myip.py

12 lines
273 B
Python

#!/usr/bin/env python
"""
This simple script fetches your IP as seen by web pages, and displays it.
Execute this script locally like that:
$ curl -s https://raw.github.com/gist/3389407/myip.py | python
"""
import requests
print(requests.get('http://ip.42.pl/raw').text)