Skip to main content

Original status code

Scraping Fish offers the ability to forward the original status code from the website. You can enable this feature by setting the forward_original_status query parameter to true.

When forward_original_status is enabled, the original status code of the website will be available in the Sf-Original-Status-Code header of the response.

info

When this feature is enabled, all requests are considered successful and will be deducted from your pack of API requests regardless of the status code.

Example​

The following example demonstrates how to access the original status code using the https://httpbin.org/status/202 endpoint which returns a 202 status code. By setting forward_original_status to true, the Sf-Original-Status-Code in the response headers will be 202.

import requests

payload = {
"api_key": "[your API key]",
"url": "https://httpbin.org/status/202",
"forward_original_status": True,
}

response = requests.get("https://scraping.narf.ai/api/v1/", params=payload)
print(response.headers)

Response headers:

Content-Type: text/html; charset=utf-8
...
Sf-Original-Status-Code: 202
...
Content-Length: 39