开云体育

Re: Controlling Alexa (Amazon) via JMRI


 

This is what ChatGPT suggested, I do not know if this is accurate or if it will work. It is supposedly Python, not Jython, so not sure if it would run within JMRI.
?
import java.net.HttpURLConnection
import java.net.URL
def trigger_url(url):
? ? try:
? ? ? ? connection = java.net.URL(url).openConnection()
? ? ? ? connection.setRequestMethod("GET")
? ? ? ? connection.setDoOutput(False)
? ? ? ? connection.connect()
? ? ? ? response_code = connection.getResponseCode()
? ? ? ? connection.disconnect()
? ? ? ? return response_code
? ? except Exception as e:
? ? ? ? print("Error triggering URL:", e)
? ? ? ? return None
# URL to be triggered in the background
url = "https://api-v2.voicemonkey.io/trigger(url)
--

Heath @ Human[c]ity


Join [email protected] to automatically receive all group messages.