HTTP timeout

If you have a question or need help, this is the place to be.
Post Reply
blaher
Experienced User
Posts: 494
Joined: Thu Nov 17, 2011 1:27 am

HTTP timeout

Post by blaher » Sun May 10, 2020 4:27 am

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

User avatar
kgschlosser
Site Admin
Posts: 5495
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: HTTP timeout

Post by kgschlosser » Sun May 10, 2020 6:51 am

don't use urllib.

use requests

Code: Select all

import requests; requests.get('http://192.168.0.103:8092/?Sleep', timeout=2);
If you like the work I have been doing then feel free to Image

blaher
Experienced User
Posts: 494
Joined: Thu Nov 17, 2011 1:27 am

Re: HTTP timeout

Post by blaher » Thu May 14, 2020 2:31 am

Thanks again. That works well.

User avatar
kgschlosser
Site Admin
Posts: 5495
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: HTTP timeout

Post by kgschlosser » Thu May 14, 2020 6:20 am

no worries m8
If you like the work I have been doing then feel free to Image

Post Reply