Skip to content

Commit

Permalink
Fixed HTTP timeout & Error catching
Browse files Browse the repository at this point in the history
  • Loading branch information
deckerego committed Sep 12, 2020
1 parent ab9fc22 commit 5494088
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/obs_tally_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ def call_tally_light(source, color, brightness):
url = 'http://%s:7413/set?color=%s&brightness=%f' % (addr, hexColor, pctBright)

try:
with urllib.request.urlopen(url, http_timeout_seconds) as response:
with urllib.request.urlopen(url, None, http_timeout_seconds) as response:
data = response.read()
text = data.decode('utf-8')
obs.script_log(obs.LOG_INFO, 'Set %s tally light: %s' % (source, text))

except urllib.error.URLError as err:
obs.script_log(obs.LOG_WARNING, 'Error connecting to tally light URL %s: %s' + (url, err.reason))
obs.script_log(obs.LOG_WARNING, 'Error connecting to tally light URL %s: %s' % (url, err.reason))
obs.remove_current_callback()

def set_scene_light(source, color, brightness) :
Expand Down

0 comments on commit 5494088

Please sign in to comment.