JavaScript & Python examples
Use standard HTTP clients from your own trusted server.
On this page
JavaScript / TypeScript
This is a server-side fetch example, not a browser integration. Keep WEEVEO_API_KEY in a secret environment variable. Use the tool page for exact arguments and result semantics.
javascript
async function weeveo(tool, args = {}) {
const response = await fetch(
"https://weeveo.com/api/v1/tools/" + encodeURIComponent(tool),
{
method: "POST",
headers: {
Authorization: "Bearer " + process.env.WEEVEO_API_KEY,
"Content-Type": "application/json"
},
body: JSON.stringify(args)
}
);
const body = await response.json();
if (!response.ok) throw new Error(body.error ?? "Weeveo request failed");
return body.result;
}
const summary = await weeveo("get_traffic_summary", { range: "7d" });Python standard library
python
import json
import os
import urllib.request
def weeveo(tool, args=None):
request = urllib.request.Request(
"https://weeveo.com/api/v1/tools/" + tool,
data=json.dumps(args or {}).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["WEEVEO_API_KEY"],
"Content-Type": "application/json",
},
method="POST",
)
with urllib.request.urlopen(request, timeout=30) as response:
return json.load(response)["result"]
summary = weeveo("get_traffic_summary", {"range": "7d"})urllib raises HTTPError for non-success statuses. Catch it in production and inspect its error body without logging secrets. These examples are ordinary HTTP clients; Weeveo's installed browser SDK is documented separately.
Export a CSV
Call export_report with kind="timeseries" and your chosen range. Save result.csv to a file using result.filename as a suggested name. Do not treat the entire JSON response as CSV.
Still looking for an answer? Try troubleshooting or get in touch.