I'm using the Webserver plug-in to receive an event using a simple python command as below:
import urllib; urllib.urlopen('http://192.168.0.103:8092/?Sleep')
it seems to hang Eventghost running this command though. I thought I got around the problem by pinging the receiving computers first, and and only sending to the ones that were on, to avoid the eventual timeout, but with two computers up and running, it seems to wait an inordinate amount of time before the second command is sent.
Is there a way to set a time out to avoid this?
Cheers
HTTP timeout
- kgschlosser
- Site Admin
- Posts: 5508
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: HTTP timeout
don't use urllib.
use requests
use requests
Code: Select all
import requests; requests.get('http://192.168.0.103:8092/?Sleep', timeout=2);
Re: HTTP timeout
Thanks again. That works well.
- kgschlosser
- Site Admin
- Posts: 5508
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA