from requests import get ip = get('https://api.ipify.org').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 api.ipify.org 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.