import datetime import json import urllib.parse from flask import render_template from domainLookup import punycode_to_emoji def domains(domains, mobile=False): html = '' for domain in domains: expires = domain['stats'] if 'daysUntilExpire' in expires: expires = expires['daysUntilExpire'] else: expires = "No expiration date" paid = domain['value'] paid = paid / 1000000 # Handle punycodes name = domain['name'] emoji = punycode_to_emoji(name) if emoji != name: name = f'{emoji} ({name})' if not mobile: html += f'
Returns: {returns}
' html += f'Returns: {returns}
' html += f'' html += f'' return html def plugin_output(outputs, returns): html = '' for returnOutput in returns: if returnOutput not in outputs: continue html += f'{output}
' elif returns[returnOutput]["type"] == "tx": html += render_template('components/tx.html', tx=output) elif returns[returnOutput]["type"] == "dns": output = json.loads(output) html += render_template('components/dns-output.html', dns=dns(output)) html += f'