{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This is a test of Jupyter generating a cool blog post about a neat python project or something."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"b'test'\n",
"b'{00}iVBORw0KGgoAAAAN...sQo8aFRo0+M8YCYKGjiE'\n",
"b'{01}Q1CiALGgCAgINfud...ZGAkyJ9sDvO2DzNa4dZk'\n",
"b'{02}E+BTF9RgIePCSjO3...UX6911GGr69VMh/3eWDV'\n",
"b'{03}bE6tkPWUyTPRkqrY...bw8nGGgoCoYXopEPQ1Q7'\n"
]
}
],
"source": [
"import dns.resolver\n",
"import base64\n",
"from IPython.display import HTML\n",
"q = dns.resolver.query(\"logo.hosttel.com.au\",\"TXT\").response.answer[0]\n",
"for line in sorted(_.strings[0] for _ in q)[:5]:\n",
" print((line[:20] + b\"...\" + line[-20:]) if len(line) > 20 else line)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
"
],
"text/plain": [
""
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"out = b\"\"\n",
"for line in sorted(_.strings[0] for _ in q):\n",
" if chr(line[0]) == \"{\":\n",
" try:\n",
" out += line.split(b\"}\",1)[1]\n",
" except IndexError:\n",
" pass\n",
"HTML(\"
\".format(out.decode('utf-8')))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}