def get_from_web(self,url): setdefaulttimeout(4.0) url = urlparse.urlparse(url) HOST = url.netloc PORT = 80 try: s = socket(AF_INET, SOCK_STREAM) except error as msg: s = None s.settimeout(4.0) s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) try: s.connect((HOST, PORT)) except error as msg: s.close() s = None if s!=None: s.send("GET http://www.opvdm.com/update.php?ver_core="+ver_core()+"&ver_gui="+ver_gui()+"&ver_mat="+ver_mat()+"&os="+platform.platform()+"&"+" HTTP/1.0" +CRLF) data = (s.recv(1000000)) s.shutdown(1) s.close() self.text=data.split('charset=UTF-8\r\n\r\n', 1)[-1] gobject.idle_add(gobject.GObject.emit,self,"got-data")
def get_from_web(self,url): page="http://www.gpvdm.com/download_windows/update.php?ver_core="+ver_core()+"&ver_mat="+ver_mat()+"&os="+platform.platform()+"&opengl="+is_open_gl_working() message=get_data_from_web(page) message=message.split("\n") print(message) self.text="" if message[0].startswith("update"): token,ver=message[0].split("#") self.text="Version "+ver+" of opvdm is now available." self.got_data.emit(self.text)