change ubuntu ip code example
Example 1: check ip json
$ curl 'https://api.ipify.org?format=json'
{"ip":"51.159.59.56"}
Example 2: get ip python
import socket
host = socket.getfqdn()
addr = socket.gethostbyname(host)
print(f"Your ip is {addr}")
# On Linux, it may give you the localhost address