From 336c51e6fcc1ecee5080e5b3324772f78bdccef2 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Thu, 18 Oct 2018 15:10:46 -0400 Subject: [PATCH] add zipped_debugging_info --- aioupnp/__init__.py | 2 +- aioupnp/upnp.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/aioupnp/__init__.py b/aioupnp/__init__.py index fab2141..335075f 100644 --- a/aioupnp/__init__.py +++ b/aioupnp/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.0.2a8" +__version__ = "0.0.2a9" __name__ = "aioupnp" __author__ = "Jack Robison" __maintainer__ = "Jack Robison" diff --git a/aioupnp/upnp.py b/aioupnp/upnp.py index 0ee8ea7..6f0c114 100644 --- a/aioupnp/upnp.py +++ b/aioupnp/upnp.py @@ -3,6 +3,8 @@ import socket import logging import json import asyncio +import zlib +import base64 from collections import OrderedDict from typing import Tuple, Dict, List, Union from aioupnp.fault import UPnPError @@ -187,6 +189,15 @@ class UPnP: "client_address": self.lan_address, }, default=_encode, indent=2) + @property + def zipped_debugging_info(self) -> str: + return base64.b64encode(zlib.compress( + json.dumps({ + "gateway": self.gateway.debug_gateway(), + "client_address": self.lan_address, + }, default=_encode, indent=2).encode() + )).decode() + @cli async def generate_test_data(self): print("found gateway via M-SEARCH")