Moved helper functions out of the main function.
This commit is contained in:
parent
9e6e294491
commit
25aeeb5c9b
|
@ -26,22 +26,6 @@ if env_voicebox is None:
|
||||||
if env_tmp is None:
|
if env_tmp is None:
|
||||||
env_tmp = "/tmp"
|
env_tmp = "/tmp"
|
||||||
|
|
||||||
def fritzab2matrix():
|
|
||||||
|
|
||||||
### CHECK AND GET MESSAGES FROM FRITZBOX ###
|
|
||||||
############################################
|
|
||||||
|
|
||||||
## Connect to the FritzBox in the LAN
|
|
||||||
# We don't use tls because the self-signed cert of the box leads to a malfunction in urllib later on.
|
|
||||||
fc = FritzConnection(address=env_ip, user=env_user, password=env_pass, use_tls=False)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Get info about messages from the main answering machine
|
|
||||||
message_list = fc.call_action("X_AVM-DE_TAM1", "GetMessageList", NewIndex=0)
|
|
||||||
message_list_url = message_list['NewURL']
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Build the url to download the message via smb
|
# Build the url to download the message via smb
|
||||||
def build_download_url(mid, tam=0):
|
def build_download_url(mid, tam=0):
|
||||||
|
@ -63,6 +47,25 @@ def fritzab2matrix():
|
||||||
messages = xmltodict.parse(doc)
|
messages = xmltodict.parse(doc)
|
||||||
return messages
|
return messages
|
||||||
|
|
||||||
|
|
||||||
|
def fritzab2matrix():
|
||||||
|
|
||||||
|
### CHECK AND GET MESSAGES FROM FRITZBOX ###
|
||||||
|
############################################
|
||||||
|
|
||||||
|
## Connect to the FritzBox in the LAN
|
||||||
|
# We don't use tls because the self-signed cert of the box leads to a malfunction in urllib later on.
|
||||||
|
fc = FritzConnection(address=env_ip, user=env_user, password=env_pass, use_tls=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Get info about messages from the main answering machine
|
||||||
|
message_list = fc.call_action("X_AVM-DE_TAM1", "GetMessageList", NewIndex=0)
|
||||||
|
message_list_url = message_list['NewURL']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
l = get_message_list(message_list_url)
|
l = get_message_list(message_list_url)
|
||||||
if l['Root'] == None or l['Root']['Message'] == None:
|
if l['Root'] == None or l['Root']['Message'] == None:
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue