Prepare a coming scrape
Warms what a scrape of `url` will need, so it is off the scrape's critical path: the destination resolved and checked by the egress guard, and a keep-alive connection to the origin that the scrape's HTTP fetch reuses (opened with a `HEAD` of the URL, whose answer is not used, carrying the request headers the scrape's navigation sends: Chrome's for that URL). Routines call it for the next step while the current one runs. Bills nothing. With `respect_robots: true` it fetches and caches the origin's robots.txt instead of the `HEAD`, and `robots` says whether robots.txt allows the URL (`unreachable`: a scrape still proceeds, a crawl does not); otherwise `robots` is `not_checked`. It sends the target at most one `HEAD` per origin per 60 seconds for your organization: a prepare of an origin you prepared within the last 60 seconds finds the connection pooled and sends nothing (its `timing` then has no `connect_ms`). Each request a prepare does send (the `HEAD`, or a robots.txt this node does not hold yet) counts against `vision.scrape.rpm` like a scrape: `429 rate_limited` when it is used up.
/v1/vision/prepare
Authentication
Request Body required
application/jsonurl
string (uri)
REQUIRED
respect_robots
boolean
Responses
application/jsonobject
string
REQUIRED
prepareurl
string (uri)
REQUIRED
robots
string
REQUIRED
allowed, disallowed, unreachable, not_checkedtiming
object
REQUIRED
total_ms
number
REQUIRED
curl -X POST 'https://beta-api.b3os.org/v1/vision/prepare' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "url": "https://docs.example.com/guides/auth"}'
const response = await fetch('https://beta-api.b3os.org/v1/vision/prepare', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify({ "url": "https://docs.example.com/guides/auth" })});const data = await response.json();console.log(data);
import requestsheaders = { 'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://beta-api.b3os.org/v1/vision/prepare', headers=headers, json={ "url": "https://docs.example.com/guides/auth"})print(response.json())
{ "object": "prepare", "url": "https://docs.example.com/guides/auth", "robots": "not_checked", "timing": { "admit_ms": 0.1, "resolve_ms": 3.1, "connect_ms": 41.7, "total_ms": 44.9 }}
Try this endpoint
/v1/vision/prepare