Skip to content

Commit

Permalink
add method to retreive txt values
Browse files Browse the repository at this point in the history
  • Loading branch information
aliel committed Sep 5, 2023
1 parent 62f8e06 commit 08686a7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/aleph/sdk/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ async def get_dnslink(self, url: str):
if query is not None and len(query) > 0:
return query[0].text

async def get_txt_values(self, url: str, delimiter: Optional[str] = None):
domain = self.url_to_domain(url)
res = await alephdns.query(domain, "TXT")
values = []
if res is not None:
for _res in res:
if hasattr(_res, "text") and _res.text.startswith("0x"):
if delimiter is not None and delimiter in _res.text:
values = values + _res.text.split(delimiter)
else:
values.append(_res.text)
return values

async def check_domain_configured(self, domain, target, owner):
try:
print("Check...", target)
Expand Down

0 comments on commit 08686a7

Please sign in to comment.