Compare commits

...

3 Commits

3 changed files with 28 additions and 19 deletions

View File

@ -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

5
tests/context.py Normal file
View File

@ -0,0 +1,5 @@
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import fritzab2matrix

View File

@ -0,0 +1 @@
from .context import fritzab2matrix