requests geting status_code is error

Created on 12 Apr 2019  路  2Comments  路  Source: psf/requests

use requests.get('https://test.xiubi.com').status_code report web status_code '200'.
use 'wget' and 'curl' report web status_code '302'.

why requests report error status_code?

Most helpful comment

The site has a redirect header and "requests" will redirect automatically by default. If you use curl, you need to use the -L flag, then you'll get a 200 status code.
E.g. curl -L https://test.xiubi.com

All 2 comments

The site has a redirect header and "requests" will redirect automatically by default. If you use curl, you need to use the -L flag, then you'll get a 200 status code.
E.g. curl -L https://test.xiubi.com

Can this be closed?

Was this page helpful?
0 / 5 - 0 ratings