Add lease_time as parameter #25

Merged
PhilippHomann merged 2 commits from master into master 2020-12-21 20:54:52 +01:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit 2b4295b336 - Show all commits

View file

@ -122,7 +122,7 @@ class UPnP:
await self.gateway.commands.AddPortMapping(
NewRemoteHost='', NewExternalPort=external_port, NewProtocol=protocol,
NewInternalPort=internal_port, NewInternalClient=lan_address,
NewEnabled=1, NewPortMappingDescription=description, NewLeaseDuration=lease_time
NewEnabled=1, NewPortMappingDescription=description, NewLeaseDuration=str(lease_time)
)
return None

View file

@ -62,7 +62,7 @@ Get the external ip address from the gateway
"""
expected_add_port_mapping_usage = """aioupnp [-h] [--debug_logging] add_port_mapping [--external_port=<int>] [--protocol=<str>]
[--internal_port=<int>] [--lan_address=<str>] [--description=<str>]
[--internal_port=<int>] [--lan_address=<str>] [--description=<str>] [--lease_time=<int>]
Add a new port mapping
@ -71,12 +71,13 @@ Add a new port mapping
:param internal_port: (int) internal port
:param lan_address: (str) internal lan address
:param description: (str) mapping description
:param lease_time: (int) lease time in seconds
:return: None
"""
expected_get_next_mapping_usage = """aioupnp [-h] [--debug_logging] get_next_mapping [--port=<int>] [--protocol=<str>]
[--description=<str>] [--internal_port=<typing.Union[int, NoneType]>]
[--description=<str>] [--internal_port=<typing.Union[int, NoneType]>] [--lease_time=<int>]
Get a new port mapping. If the requested port is not available, increment until the next free port is mapped
@ -84,6 +85,7 @@ Get a new port mapping. If the requested port is not available, increment until
:param protocol: (str) UDP | TCP
:param description: (str) mapping description
:param internal_port: (int) internal port
:param lease_time: (int) lease time in seconds
:return: (int) mapped port