From bd32b8205e4af4c731e044a684c9d6d2e18283f4 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sat, 26 Jun 2021 21:57:12 +0800 Subject: [PATCH] bugfix --- ahserver/configuredServer.py | 7 +++++-- requirements.txt | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ahserver/configuredServer.py b/ahserver/configuredServer.py index cc7285a..0fa98ed 100644 --- a/ahserver/configuredServer.py +++ b/ahserver/configuredServer.py @@ -14,7 +14,10 @@ from .processorResource import ProcessorResource from .auth_api import AuthAPI from .myTE import setupTemplateEngine from .globalEnv import initEnv -from natpmp import NATPMP as pmp +try: + from natpmp import NATPMP as pmp +except: + pmp = None class ConfiguredServer: def __init__(self,auth_klass=AuthAPI): @@ -69,7 +72,7 @@ class ConfiguredServer: ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) ssl_context.load_cert_chain(config.website.ssl.crtfile, config.website.ssl.keyfile) - if config.natpmp: + if pmp and config.natpmp: self.nat_heartbeat = True b = Background(self.natpmp_heartbeat) b.start() diff --git a/requirements.txt b/requirements.txt index 0df2ab1..ec6462c 100755 --- a/requirements.txt +++ b/requirements.txt @@ -12,3 +12,4 @@ jinja2 ujson openpyxl pillow +py-natpmp