Home  »  CodeProgrammingSnippetsTechnologyTools   »   Python get Public IP Address

Python get Public IP Address

Posted: March 16, 2022 | by Site Host

Python get public ip address example. This example requires the requests library to be installed.

from requests import get

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

More about the Requests library here: http://docs.python-requests.org/en/latest/

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Share it!

See also  UFW Allow PostgreSQL Database Service