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.
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
.
- Python
- NodeJS
- cURL
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)
const axios = require("axios");
const payload = {
api_key: "[your API key]",
url: "https://httpbin.org/status/202",
forward_original_status: true,
};
const response = await axios.get("https://scraping.narf.ai/api/v1/", { params: payload });
console.log(response.headers);
curl -G --head --data-urlencode 'url=https://httpbin.org/status/202' \
'https://scraping.narf.ai/api/v1/?api_key=[your API key]&forward_original_status=true'
Response headers:
Content-Type: text/html; charset=utf-8
...
Sf-Original-Status-Code: 202
...
Content-Length: 39