1

I would like to get the Public Ip address of my computer.

Many solutions I have seen require requests/urllib2, such as:

import requests
requests.get('http://ip.42.pl/raw').text
import requests

public_IP = requests.get("https://www.wikipedia.org").headers["X-Client-IP"]
print(public_IP)
from json import load
from urllib2 import urlopen

my_ip = load(urlopen('http://httpbin.org/ip'))['origin']

Reference link: How can I get the public IP using python2.7? (Python version doesn't really matter at the moment)

Is there any way to get the public IP without using requests or similar libraries?

some_user_3
  • 403
  • 1
  • 5
  • 17

0 Answers0