Timeout
View as MarkdownSet request timeout
You can set the timeout value for the request you will send to the target website.
The value it can take must be between 5000 ms and 120000 ms. If the time is exceeded, system will return you that the request failed.
curl --location --request GET 'https://api.scrape.do/?token=YOUR_TOKEN&url=https://httpbin.co/sse?delay=1s&timeout=10000'import requests
import urllib.parse
token = "YOUR_TOKEN"
targetUrl = urllib.parse.quote("https://httpbin.co/sse?delay=1s")
timeout = "10000"
url = "https://api.scrape.do/?token={}&url={}&timeout={}".format(token, targetUrl,timeout)
response = requests.request("GET", url)
print(response.text)const axios = require('axios');
const token = "YOUR_TOKEN";
const targetUrl = encodeURIComponent("https://httpbin.co/sse?delay=1s");
const timeout = "10000";
const config = {
'method': 'GET',
'url': `https://api.scrape.do/?token=${token}&url=${targetUrl}&timeout=${timeout}`,
'headers': {}
};
axios(config)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
func main() {
token := "YOUR_TOKEN"
encoded_url := url.QueryEscape("https://httpbin.co/sse?delay=1s")
url := fmt.Sprintf("https://api.scrape.do/?token=%s&url=%s&timeout=10000", token, encoded_url)
method := "GET"
client := &http.Client{}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}require "uri"
require "net/http"
require 'cgi'
str = CGI.escape "https://httpbin.co/sse?delay=1s"
url = URI("https://api.scrape.do/?url=" + str + "&token=YOUR_TOKEN&timeout=10000")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_bodyimport java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
public class TestRequest {
public static void main(String[] args) throws Exception {
String token = "YOUR_TOKEN";
String targetUrl = URLEncoder.encode("https://httpbin.co/sse?delay=1s", StandardCharsets.UTF_8);
String url = "https://api.scrape.do/?token=" + token + "&url=" + targetUrl + "&timeout=10000";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}using System.Net;
string token = "YOUR_TOKEN";
string url = WebUtility.UrlEncode("https://httpbin.co/sse?delay=1s");
var client = new HttpClient();
var requestURL = $"https://api.scrape.do/?token={token}&url={url}&timeout=10000";
var request = new HttpRequestMessage(HttpMethod.Get, requestURL);
var respponse = client.SendAsync(request).Result;
var content = respponse.Content.ReadAsStringAsync().Result;
Console.WriteLine(content);<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = [
"url" => "https://httpbin.co/sse?delay=1s",
"token" => "YOUR_TOKEN",
"timeout" => "10000"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_URL, "https://api.scrape.do/?".http_build_query($data));
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"Accept: */*",
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
