<div dir="ltr"><div>Incríble!.<br></div>Gracias!!<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">Saludos,<br>Gonzalo</div></div>
<br><div class="gmail_quote">2015-08-26 11:42 GMT-04:00 Miguel González Álvarez <span dir="ltr"><<a href="mailto:migonzalvar@gmail.com" target="_blank">migonzalvar@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-08-26 17:19 GMT+02:00 Gonzalo V <span dir="ltr"><<a href="mailto:gvm2121@gmail.com" target="_blank">gvm2121@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div>...</div></div><span class="">¿Sabes tu cómo simular un error 504 en python?<br></span></div><div class="gmail_extra"><br></div>
<br></blockquote></div><br>Para simular respuestas HTTP es muy útil el servicio <a href="http://httpbin.org/" target="_blank">http://httpbin.org/</a> (por cierto escrito en Python).</div><div class="gmail_extra"><br></div><div class="gmail_extra">En tu caso, se haría poniendo como URL <a href="http://httpbin.org/status/504" target="_blank">http://httpbin.org/status/504</a>:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">>>> import urllib.request</div><div class="gmail_extra">>>> req = urllib.request.urlopen('<a href="http://httpbin.org/status/504" target="_blank">http://httpbin.org/status/504</a>')</div><div class="gmail_extra">Traceback (most recent call last):</div><div class="gmail_extra">  File "<stdin>", line 1, in <module></div><div class="gmail_extra">  File "/usr/local/lib/python3.4/urllib/request.py", line 153, in urlopen</div><div class="gmail_extra">    return opener.open(url, data, timeout)</div><div class="gmail_extra">  File "/usr/local/lib/python3.4/urllib/request.py", line 461, in open</div><div class="gmail_extra">    response = meth(req, response)</div><div class="gmail_extra">  File "/usr/local/lib/python3.4/urllib/request.py", line 571, in http_response</div><div class="gmail_extra">    'http', request, response, code, msg, hdrs)</div><div class="gmail_extra">  File "/usr/local/lib/python3.4/urllib/request.py", line 499, in error</div><div class="gmail_extra">    return self._call_chain(*args)</div><div class="gmail_extra">  File "/usr/local/lib/python3.4/urllib/request.py", line 433, in _call_chain</div><div class="gmail_extra">    result = func(*args)</div><div class="gmail_extra">  File "/usr/local/lib/python3.4/urllib/request.py", line 579, in http_error_default</div><div class="gmail_extra">    raise HTTPError(req.full_url, code, msg, hdrs, fp)</div><div class="gmail_extra">urllib.error.HTTPError: HTTP Error 504: GATEWAY TIMEOUT</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div>-- <br><div><div dir="ltr">Miguel González<div><a href="mailto:migonzalvar@gmail.com" target="_blank">migonzalvar@gmail.com</a><br><div>PGP ID: 0C63761BEEBD05D3</div></div></div></div>
</font></span></div></div>
<br>_______________________________________________<br>
Python-es mailing list<br>
<a href="mailto:Python-es@python.org">Python-es@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-es" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-es</a><br>
FAQ: <a href="http://python-es-faq.wikidot.com/" rel="noreferrer" target="_blank">http://python-es-faq.wikidot.com/</a><br>
<br></blockquote></div><br></div>