add wtfismyip source
This commit is contained in:
parent
8a1ba06c88
commit
3e9142cd54
20
pddnsc/sources/wtfismyip.py
Normal file
20
pddnsc/sources/wtfismyip.py
Normal file
@ -0,0 +1,20 @@
|
||||
import httpx
|
||||
|
||||
from pddnsc.base import BaseSourceProvider
|
||||
|
||||
# https://wtfismyip.com/
|
||||
# https://gitlab.com/wtfismyip/wtfismyip
|
||||
class WTFIsMyIP(BaseSourceProvider):
|
||||
async def fetch_v4(self) -> str:
|
||||
async with httpx.AsyncClient(transport=self.ipv4t) as client:
|
||||
response = await client.get("https://text.ipv4.myip.wtf")
|
||||
if response.is_success:
|
||||
result = response.text.strip() or None
|
||||
return result
|
||||
|
||||
async def fetch_v6(self) -> str:
|
||||
async with httpx.AsyncClient(transport=self.ipv6t) as client:
|
||||
response = await client.get("https://text.ipv6.myip.wtf")
|
||||
if response.is_success:
|
||||
result = response.text.strip() or None
|
||||
return result
|
Loading…
Reference in New Issue
Block a user