@@ -28,10 +28,9 @@ class IpUtil:
2828 _machine_ip = None
2929
3030 def __init__ (self ):
31- self .IPIFY_API_URI = 'https://api.ipify.org'
32- self .IFCONFIG_API_URI = 'https://ifconfig.me/ip'
31+ self .IPIFY_API_URI = 'https://api.ipify.org'
3332 self .IP_INFO_API_URI = 'https://ipinfo.io/ip'
34- self .IDENT_ME_API_URI = 'https://ident.me/'
33+ self .IDENT_ME_API_URI = 'https://4. ident.me/'
3534 self .USER_AGENT = 'nuvolaris-ip-resolver'
3635 # The maximum amount of tries to attempt when making API calls.
3736 self .MAX_TRIES = 3
@@ -53,17 +52,14 @@ def _get_ip_resp(self,api_uri: str):
5352 logging .debug (f"querying ip from { api_uri } " )
5453 return get (api_uri , headers = {'user-agent' : self .USER_AGENT })
5554
56- def handle_ip_request (self ,url ):
55+ def handle_ip_request (self ,url , extra = None ):
5756 """
58- Query a public api retuning the machine's public ip address
57+ Query a public api returning the machine's public ip address
5958 >>> from nuvolaris.ip_util import IpUtil
6059 >>> ip_util = IpUtil()
6160 >>> ipify_ip = ip_util.handle_ip_request('https://api.ipify.org')
62- >>> ifconfig_ip = ip_util.handle_ip_request('https://ifconfig.me/ip')
6361 >>> ifinfo_ip = ip_util.handle_ip_request('https://ipinfo.io/ip')
64- >>> identme_ip = ip_util.handle_ip_request('https://ident.me/')
65- >>> ipify_ip == ifconfig_ip
66- True
62+ >>> identme_ip = ip_util.handle_ip_request('https://4.ident.me/')
6763 >>> ipify_ip == ifinfo_ip
6864 True
6965 >>> ipify_ip == identme_ip
@@ -100,7 +96,6 @@ def get_public_ip(self):
10096 True
10197 """
10298 self .get_ip_chain (self .IPIFY_API_URI )
103- self .get_ip_chain (self .IFCONFIG_API_URI )
10499 self .get_ip_chain (self .IP_INFO_API_URI )
105100 self .get_ip_chain (self .IDENT_ME_API_URI )
106101
0 commit comments