python get public ip address

from requests import get

ip = get('').text
print(f'My public IP address is: {ip}')

Here is what the above code is Doing:
1. We’re using the get function from the requests library to make a GET request to the website.
2. The text property of the response object contains the data we’re interested in.
3. We’re printing the data to the console.