FAQ
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
morfeokmg at 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?..."
"???????, ???????, ????????, ??????, ????, ????????, ????, ??????, ??????,
????, ???????, ???????, ????????????, ???????????, ?????????????, ?????????,
?????????, ???????, ??????, ?????????, ?????????, ????, ???????, ????"???",
?????? ??, ????? ?????? ?????? ???????? ??"???" ????????
??????????"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100909/2a3a3658/attachment.html>

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedSep 9, '10 at 11:25a
activeSep 9, '10 at 11:25a
posts1
users1
websitepython.org

1 user in discussion

Mauricio Martinez Garcia: 1 post

People

Translate

site design / logo © 2022 Grokbase