alternatives to urllib2

I am using a mysql database on a remote server to store data which is collected from a bunch of remote devices by an X4 gateway. The server is already set up to run a php script periodically which uses the rci presentation to pole my X4 gateway and store the results. There are a couple of circumstances where I would like to activate that script manually. In python this is as easy as

import urllib2

urllib2.urlopen(“http://remotehost.com/myscript.php”)

However the urllib2 module is not included on my X4. Does anyone have any good alternatives? Thanks.

Hi,

You can actually try grabbing urllib2 from the lib directory from installation of python and uploading it to the gateway. I’m not sure offhand if urllib2 will bring in a bunch of other dependencies, and if so, you’d have to upload those as well. (And then hopefully there aren’t any incompabilities, but they could be worked through.)

Alternatively, it may be a little unsightly, but you could just open up a socket to port 80 on the remote host and send the small amount of HTTP contents it takes to do the GET. Probably not the best approach if you decide to do something beyond a simple request.

Chris