Hi!. I have a problem with httplib and timeout. (I use python 2.6.5 and httplib)
I have the next code for the http connection (its a WebService Client). =================================================================== def ejecutaComandos(self,opcion, URL, commandString, conn, id): #pdb.set_trace() #fechatransacciones = conciliatorTime() #status = conn.status #date_transacc = fechatransacciones.getCompleteDate() try: try: enviaCommand = conn.request("POST", str(URL), commandString) respuestaCommand = conn.getresponse() except Exception as e: print 'Error de conexion: ',e #intentar=raw_input("Desea intentar nuevamente (S/N) : ") exit(1) respuestaWSDL = respuestaCommand.read() #print respuestaCommand nom_rand = str(random.choice('lmnopqrstuvwxyzABCDEFGHIJ'))+str(random.choice('abcdefghijk')) FileRand = nom_rand+'_tmp.xml' newFile = creaArchivos(FileRand,self.output) a = newFile.creaFile('w') #a = open('../output/responseXML.tmp', 'w') a.write(respuestaWSDL) a.close() #print XP_LOG+'respuesta de HLAPI recibida...'+str(date_transacc) #return respuestaWSDL return a.name #except httplib.HTTPException as he: except Exception as he: print "Error de ejecucion ...: %s " % (he) else: print "Error inesperado..." =================================================================== I need resend the command when a timeout error present, my idea its use a "while". =================================================================== while (intentar=='S'): try: enviaCommand = conn.request("POST", str(URL), commandString) respuestaCommand = conn.getresponse() raise Exception except Exception as e: print 'Error de conexion: ',e intentar=raw_input("Desea intentar nuevamente (S/N) : ") if (intentar=='N'): exit(1) =================================================================== But the information of "enviaCommand" it is lost, and it been only "None", then fail resend. As I can resend the information without the command loses itself. Greetings and tanks!. -- Mauricio Martinez Garcia morfeo...@gmail.com "Si encuentras un trébol de cuatro hojas..., hallaras la felicidad. Pero ¿Sabes?, seguramente no la encontrarás, porque la felicidad se encuentra en silencio guardada en una jaula. EL trebol de Cuatro hojas nunca será de nadie... ¿Que te parece si te adueñas de un trébol de tres hojas?..." "我渴望得到幸福, 我渴望得到幸福, 和你一起得到幸福, 成为你的幸福, 带我离开, 带我远离这个地方, 笼中之鸟, 不能飞翔的鸟, 不会哭泣的鸟, 孤单的鸟, 因此请带我离开, 我渴望得到幸福, 只要在你身边我便感到幸福, 只要你微笑我便感到幸福, 初次的心愿成为了最后的愿望, 这里是妖精等待着的, 我们两人的约定地点, 因此请代我离开, 为了忘却现实, 为了停留在梦幻之中, 为了永远能够思念你, 带我离开, 我渴望得到幸福, 找到四叶"三叶草", 就能得到幸福 不过, 请保守秘密 三叶草的白花 在哪里开放? 它的叶有多少瓣? 四叶"三叶草" 我想令你得到幸福 可是我不能成为你的人"
-- http://mail.python.org/mailman/listinfo/python-list