This isn't possible without help from an external server, because there could be any number of network address translators (NATs) between you and another computer. I suppose that if you were working with some kind of custom protocol you could ask a client to assert the address to which it is connected.
With this in mind (many would consider this a hack), but it is arguably the only way- you could do something like:
import urllib.request
external_ip = urllib.request.urlopen('http://ifconfig.me/ip').read()