web. fetch
Fetch a web page and return its text and a short summary.
2 credits. Per page with text (or raw HTML when asked). 0 when the page has neither.
Example prompt
Send this to your AI app when Heelo is connected:
Fetch https://openai.com/blog/gpt-4
Input fields
| Field | Type | Description |
|---|---|---|
query | string | URL to fetch (optionally in a natural-language request) |
url | string | The URL to fetch (http or https); use this or query |
include_raw | boolean | Also return the HTTP status, the final URL after redirects, each redirect hop (url, status), the last response's headers plus every hop's Set-Cookie (cookie values hidden), the names of the cookies every hop sets (redirects included), the <head> meta tags (canonical, og:*, twitter:*, description), each form (action, method, fields), a count of script tags, on* event attributes and javascript: URLs over the whole page, and the raw HTML (capped at 12,000 characters; html_truncated says when) — to check what a page declares and sends. |
Output fields
The fields in data when status is success.
| Field | Type |
|---|---|
url | string |
title | string |
text | string |
summary | string |
truncated | boolean |
content_type | string |
fetched_at | string |
status | integer |
final_url | string |
response_headers | object |
cookies | array of string |
redirects | array of object |
meta | object |
forms | array of object |
markup | object |
html | string |
html_truncated | boolean |
Code
The call with the input fields that the tool needs. Set HEELO_API_KEY to your API key.
import os
import requests
response = requests.post(
"https://toolsprimitives.uk/v1/tools/web.fetch/invoke",
headers={"Authorization": f"Bearer {os.environ['HEELO_API_KEY']}"},
json={"input": {
"url": "https://example.com",
}},
timeout=120,
)
response.raise_for_status()
print(response.json())// Node.js 18 or newer, in an ES module.
const response = await fetch("https://toolsprimitives.uk/v1/tools/web.fetch/invoke", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HEELO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
input: {
"url": "https://example.com"
},
}),
signal: AbortSignal.timeout(120_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());