bugfix
This commit is contained in:
parent
c02cc1b4a8
commit
a451a976e1
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
from natpmp import NATPMP as pmp
|
from natpmp import NATPMP as pmp
|
||||||
import upnpy
|
import upnpclient
|
||||||
from requests import get
|
from requests import get
|
||||||
from .background import Background
|
from .background import Background
|
||||||
|
|
||||||
@ -16,10 +16,9 @@ class AcrossNat(object):
|
|||||||
|
|
||||||
def init_upnp(self):
|
def init_upnp(self):
|
||||||
try:
|
try:
|
||||||
upnp = upnpy.UPnP()
|
igd = upnpclient.discover()[0]
|
||||||
igd = upnp.discover()[0]
|
s_names = [ n for n in igd.service_map.keys() if 'WAN' in n and 'Conn' in n]
|
||||||
s_names = [ n for n in igd.services.keys() if n.startswith('WANPPPConn') ]
|
self.upnp = igd.service_map[s_names[0]]
|
||||||
self.upnp = igd.services[s_names[0]]
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
print_exc()
|
print_exc()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import os,sys
|
import os,sys
|
||||||
import json
|
import json
|
||||||
|
from pathlib import Path
|
||||||
from appPublic.dictObject import DictObject
|
from appPublic.dictObject import DictObject
|
||||||
from appPublic.Singleton import SingletonDecorator
|
from appPublic.Singleton import SingletonDecorator
|
||||||
from appPublic.folderUtils import ProgramPath
|
from appPublic.folderUtils import ProgramPath
|
||||||
@ -46,12 +47,21 @@ class JsonObject(DictObject):
|
|||||||
@SingletonDecorator
|
@SingletonDecorator
|
||||||
class JsonConfig(JsonObject):
|
class JsonConfig(JsonObject):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def getConfig(path=None,NS=None):
|
def getConfig(path=None,NS=None):
|
||||||
|
pp = ProgramPath()
|
||||||
if path==None:
|
if path==None:
|
||||||
path = ProgramPath()
|
path = pp
|
||||||
cfname = os.path.abspath(os.path.join(path,"conf","config.json"))
|
cfname = os.path.abspath(os.path.join(path,"conf","config.json"))
|
||||||
# print __name__,cfname
|
# print __name__,cfname
|
||||||
a = JsonConfig(cfname,NS=NS)
|
ns = {
|
||||||
|
'home':str(Path.home()),
|
||||||
|
'workdir':path,
|
||||||
|
'ProgramPath':pp
|
||||||
|
}
|
||||||
|
if NS is not None:
|
||||||
|
ns.update(NS)
|
||||||
|
a = JsonConfig(cfname,NS=ns)
|
||||||
return a
|
return a
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -7,7 +7,7 @@ numpy
|
|||||||
cryptography
|
cryptography
|
||||||
brotli
|
brotli
|
||||||
aiohttp
|
aiohttp
|
||||||
aioupnp
|
upnpclient
|
||||||
py-natpmp
|
py-natpmp
|
||||||
asyncio
|
asyncio
|
||||||
requests
|
requests
|
||||||
|
Loading…
Reference in New Issue
Block a user