2004-12-28, 14:47
hi all
i'm trying to make a script to switch off my media server. so far it works quite well except for the fact the lan ips are hardcoded into the script but i would like to use server names rather than ips (they are dhcp assigned on my network so somtimes change)
why can't i use the (windows) server name as is possible on win32 python?
heres the script as it is now, works on xbmc and win32 python
but this is how i would like it be, this only works on win32 python
in my debugging i have tried importing httplib and using httplib.httpconnection(url) with the same effect
also tried importing socket and using socket.getfqdn(servername)/gethostbyname(servername) with some string concat to create the url but it never worked either
i've never scripted python before so any suggestions would be welcomed
tia
i'm trying to make a script to switch off my media server. so far it works quite well except for the fact the lan ips are hardcoded into the script but i would like to use server names rather than ips (they are dhcp assigned on my network so somtimes change)
why can't i use the (windows) server name as is possible on win32 python?
heres the script as it is now, works on xbmc and win32 python
Quote:import urllib
temp = urllib.urlopen('http://usernm:[email protected]:9000/action.htm?action=hibernate').read()
but this is how i would like it be, this only works on win32 python
Quote:import urllib
temp = urllib.urlopen('http://usernm:password@saturn:9000/action.htm?action=hibernate').read()
in my debugging i have tried importing httplib and using httplib.httpconnection(url) with the same effect
also tried importing socket and using socket.getfqdn(servername)/gethostbyname(servername) with some string concat to create the url but it never worked either
i've never scripted python before so any suggestions would be welcomed
tia