Python (parreq)
from parreq import Parreq
client = Parreq("pr_ВАШКЛЮЧ")
job = client.crawl("https://shop.example/catalog", pages=50,
follow=".product-card a", next="a.next",
extract={"name": "название товара",
"price": "цена числом, без валюты"})
print(job.id, job.status)import { Parreq } from "parreq-client";
const client = new Parreq({ apiKey: "pr_ВАШКЛЮЧ" });
const job = await client.crawl({ url: "https://shop.example/catalog",
pages: 50, follow: ".product-card a", next: "a.next",
extract: { name: "название товара", price: "цена числом, без валюты" } });
console.log(job.id, job.status);curl --request POST \
--url https://parreq.com/v1/crawl \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://parreq.com/v1/crawl",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://parreq.com/v1/crawl"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://parreq.com/v1/crawl")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"
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)
Поставить обход: начальный адрес, правило движения и потолок страниц
POST
/
v1
/
crawl
Python (parreq)
from parreq import Parreq
client = Parreq("pr_ВАШКЛЮЧ")
job = client.crawl("https://shop.example/catalog", pages=50,
follow=".product-card a", next="a.next",
extract={"name": "название товара",
"price": "цена числом, без валюты"})
print(job.id, job.status)import { Parreq } from "parreq-client";
const client = new Parreq({ apiKey: "pr_ВАШКЛЮЧ" });
const job = await client.crawl({ url: "https://shop.example/catalog",
pages: 50, follow: ".product-card a", next: "a.next",
extract: { name: "название товара", price: "цена числом, без валюты" } });
console.log(job.id, job.status);curl --request POST \
--url https://parreq.com/v1/crawl \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://parreq.com/v1/crawl",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://parreq.com/v1/crawl"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://parreq.com/v1/crawl")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"
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"
}
}Authorizations
Ключ клиента: Authorization: Bearer so_…. Равнозначен заголовку X-API-Key.
Body
application/json
The body is of type Body · object.
Response
Successful Response

