how to handle 302 redirect in scrapy

后端 未结 6 496
时光说笑
时光说笑 2020-11-29 09:32

I am receiving a 302 response from a server while scrapping a website:

2014-04-01 21:31:51+0200 [ahrefs-h] DEBUG: Redirecting (302) to 

        
6条回答
  •  时光说笑
    2020-11-29 10:03

    I added this redirect code to my middleware.py file and I added this into settings.py:

    DOWNLOADER_MIDDLEWARES_BASE says that RedirectMiddleware is already enabled by default, so what you did didn't matter.

    I want to send request to GET urls instead of being redirected.

    How? The server responds with 302 on your GET request. If you do GET on the same URL again you will be redirected again.

    What are you trying to achieve?

    If you want to not be redirected, see these questions:

    • Avoiding redirection
    • Facebook url returning an mobile version url response in scrapy
    • How to avoid redirection of the webcrawler to the mobile edition?

提交回复
热议问题