简体   繁体   English

如何在Python中设置urllib2.urlopen的最大重定向数?

[英]How to set the maximum number of redirects for urllib2.urlopen in Python?

I would like to allow maximum of 3 redirects for urllib2.urlopen() . 我想为urllib2.urlopen()最多允许3个重定向。 How do I specify that in urllib2.urlopen ? 如何在urllib2.urlopen指定urllib2.urlopen

您定义自己的HTTPRedirectHandler ,它计算重定向的数量,然后安装它以供urllib2使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM