Skip to content

Commit

Permalink
Use api_port instead of portal when accesing api to get zones
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Connor committed Aug 30, 2022
1 parent 43a130d commit 0d925fe
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions hook/zmes_hook_helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,22 @@ def import_zm_zones(mid, reason):
match_reason = True if g.config['only_triggered_zm_zones']=='yes' else False
g.logger.Debug(2,'import_zm_zones: match_reason={} and reason={}'.format(match_reason, reason))

url = g.config['portal'] + '/api/zones/forMonitor/' + mid + '.json'
url = g.config['api_portal'] + '/zones/forMonitor/' + mid + '.json'
g.logger.Debug(2,'Getting ZM zones using {}?username=xxx&password=yyy&user=xxx&pass=yyy'.format(url))
url = url + '?username=' + g.config['user']
url = url + '&password=' + urllib.parse.quote(g.config['password'], safe='')
url = url + '&user=' + g.config['user']
url = url + '&pass=' + urllib.parse.quote(g.config['password'], safe='')

if g.config['portal'].lower().startswith('https://'):
if g.config['api_portal'].lower().startswith('https://'):
main_handler = urllib.request.HTTPSHandler(context=g.ctx)
else:
main_handler = urllib.request.HTTPHandler()

if g.config['basic_user']:
g.logger.Debug(2,'Basic auth config found, associating handlers')
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
top_level_url = g.config['portal']
top_level_url = g.config['api_portal']
password_mgr.add_password(None, top_level_url, g.config['basic_user'],
g.config['basic_password'])
handler = urllib.request.HTTPBasicAuthHandler(password_mgr)
Expand All @@ -211,7 +211,6 @@ def import_zm_zones(mid, reason):
# Now lets look at reason to see if we need to
# honor ZM motion zones


#reason_zones = [x.strip() for x in rz.split(',')]
#g.logger.Debug(1,'Found motion zones provided in alarm cause: {}'.format(reason_zones))

Expand Down

0 comments on commit 0d925fe

Please sign in to comment.