如何检查重定向是否会导致不同的域

时间:2015-06-08 16:00:43

标签: python url redirect web dns

我有大量的网址或域名,我想确定他们是否执行重定向到其他域名。

当我检查状态代码302时,我可以找出哪些进行重定向。但是,其中一些只是执行从somedomain.comsomedomain.com/somename.php的重定向,而我需要的是从somedomain.com重定向到otherdomain.com的那些。

我正在使用Python和请求库,在编程语言方面我的知识有限。如果你有一个想法,特别要求我使用不同的语言,我想我可以搞清楚。

1 个答案:

答案 0 :(得分:1)

如果您使用的是PointF PointF::operator=(const PointI& point) { x = point.x; y = point.y; return *this; } PointI PointI::operator=(const PointF& point) { x = point.x; y = point.y; return *this; } ,则可以使用operator=获取除最终跳转之外的所有重定向,而最终跳转又会在python-requests中提供。例如:

request.history

如果没有重定向,那么request.url将是一个空列表。