Why does my Python script only run correctly from command line but not via Triggerhappy?

I have script on a Raspberry Pi that is supposed to run when I press the blue button on my remote via Triggerhappy (URLs shortened for clarity):

#! /usr/bin/python
# Imports
import RPi.GPIO as GPIO
import time
import requests
# url for URL Routine Trigger - TV Speakers off
r = requests.post('https://www.virtualsmarthome.xyz/url~~html')

#Wait 2 seconds before second request
#print("Waiting 2 seconds")
time.sleep(3)
# url for URL Routine Trigger - TV Speakers on
r = requests.post('https://www.virtualsmarthome.xyz/url~~html')

If I press the BLUE button on my remote I can activate this trigger:

KEY_BLUE 1 /usr/bin/logger "Triggerhappy works"

But apparently not this:

KEY_BLUE 1 /opt/scripts/reboot-tv-speakers.sh

However, if I run the script from the command line it does what it’s supposed to.