Python (parreq)
from parreq import Parreq
client = Parreq("pr_ВАШКЛЮЧ")
print(client.crawl_cancel(job_id))import { Parreq } from "parreq-client";
const client = new Parreq({ apiKey: "pr_ВАШКЛЮЧ" });
console.log(await client.crawlCancel(jobId));curl --request POST \
--url https://parreq.com/v1/crawl/{job_id}/cancel \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://parreq.com/v1/crawl/{job_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://parreq.com/v1/crawl/{job_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://parreq.com/v1/crawl/{job_id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://parreq.com/v1/crawl/{job_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"error": {
"code": "invalid_request",
"message": "неверные или отсутствующие параметры: engine",
"request_id": "a83987d3c8a640d1"
}
}{
"error": {
"code": "missing_api_key",
"message": "нужен ключ: заголовок Authorization: Bearer <ключ>",
"request_id": "a83987d3c8a640d1"
}
}{
"error": {
"code": "key_revoked",
"message": "ключ отозван",
"request_id": "a83987d3c8a640d1"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"error": {
"code": "rate_limited",
"message": "частота выше 30 запросов в минуту",
"request_id": "a83987d3c8a640d1"
}
}{
"error": {
"code": "search_blocked",
"message": "источник не отдал выдачу на этой попытке",
"request_id": "a83987d3c8a640d1"
}
}{
"error": {
"code": "timeout",
"message": "поисковик не ответил за 180 с",
"request_id": "a83987d3c8a640d1"
}
}Crawler
Отмена обхода
Остановить задание на границе страницы
POST
/
v1
/
crawl
/
{job_id}
/
cancel
Python (parreq)
from parreq import Parreq
client = Parreq("pr_ВАШКЛЮЧ")
print(client.crawl_cancel(job_id))import { Parreq } from "parreq-client";
const client = new Parreq({ apiKey: "pr_ВАШКЛЮЧ" });
console.log(await client.crawlCancel(jobId));curl --request POST \
--url https://parreq.com/v1/crawl/{job_id}/cancel \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://parreq.com/v1/crawl/{job_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://parreq.com/v1/crawl/{job_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://parreq.com/v1/crawl/{job_id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://parreq.com/v1/crawl/{job_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"error": {
"code": "invalid_request",
"message": "неверные или отсутствующие параметры: engine",
"request_id": "a83987d3c8a640d1"
}
}{
"error": {
"code": "missing_api_key",
"message": "нужен ключ: заголовок Authorization: Bearer <ключ>",
"request_id": "a83987d3c8a640d1"
}
}{
"error": {
"code": "key_revoked",
"message": "ключ отозван",
"request_id": "a83987d3c8a640d1"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"error": {
"code": "rate_limited",
"message": "частота выше 30 запросов в минуту",
"request_id": "a83987d3c8a640d1"
}
}{
"error": {
"code": "search_blocked",
"message": "источник не отдал выдачу на этой попытке",
"request_id": "a83987d3c8a640d1"
}
}{
"error": {
"code": "timeout",
"message": "поисковик не ответил за 180 с",
"request_id": "a83987d3c8a640d1"
}
}
