def grab_token(host, email, password):
    """Grab token from gateway. Press sync button before running."""
    urllib3.disable_warnings()
    url = ('https://' + host + '/gwr/gop.php?cmd=GWRLogin&data=<gip><version>1</version><email>' + str(email) + '</email><password>' + str(password) + '</password></gip>&fmt=xml')
    response = requests.get(url, verify=False)
    if '<rc>404</rc>' in response.text:
        raise PermissionError('Not In Pairing Mode')
    parsed = xmltodict.parse(response.content)
    parsed = parsed['gip']['token']
    return parsed
Grab token from gateway. Press sync button before running.