I tried multiple options for Python 3 given in the following thread to get the machine's external IP:
Getting a machine's external IP address with Python
import urllib.request
from socket import timeout
import os
import json
external_ip = urllib.request.urlopen('https://ident.me', timeout=10).read().decode('utf-8')
print(external_ip)
externalIP = os.popen('curl -s ifconfig.me').readline()
print(externalIP)
data = json.loads(urllib.request.urlopen("http://ip.jsontest.com/").read())
print (data["ip"])
When I open the links in browser - https://ident.me, http://ipconfig.me and http://ip.jsontest.com they are giving different IP (same for the 3 external services) than what is showing up on the screen (my internal IP). What could be causing this issue? I am using a proxy app which changes the external IP and wanted to use it for proxy in script.