INTEGRATIONS / HTTP RECIPE

Vera, meet Python.

Use Python requests with the Vera API. Read a public page, inspect the response and save the fields your project needs.

← All integrations

Your first connection.

  1. 01

    Install requests in your project's virtual environment: python -m pip install requests.

  2. 02

    Set VERA_BASE_URL to your Vera origin, without a trailing slash. Set VERA_API_KEY in your server environment.

  3. 03

    Run the Python example below. The response is JSON; title, text, links and metadata belong to the selected public page.

Build the request.

Set the environment variables in your terminal for these code examples. In automation tools, enter the URL and credentials in the tool’s own fields.

import json
import os
import urllib.request
import urllib.error

base_url = os.environ["VERA_BASE_URL"].rstrip("/")
headers = {"Authorization": "Bearer " + os.environ["VERA_API_KEY"]}
headers["Content-Type"] = "application/json"
payload = json.loads("{\n  \"url\": \"https://example.com\"\n}")
request = urllib.request.Request(
    base_url + "/api/vera/v1/scrape",
    data=json.dumps(payload).encode("utf-8"),
    headers=headers,
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=45) as response:
        print("Credits this call:", response.headers.get("X-Vera-Credits-Used"))
        print(json.load(response))
except urllib.error.HTTPError as error:
    print("HTTP", error.code)
    print("Request ID:", error.headers.get("X-Vera-Request-Id"))
    print(error.read().decode())
    raise

This edits a code example. It does not send a request or use credits.

Run a request in your workspace
YOUR PRIVACY

Choose what works for you. You can reopen these settings from the footer at any time.

Essential

Always active

Sign-in, security and preferences you ask us to remember. These keep the service working.

Analytics

Optional Vera visitor reporting counts visits and active browsers; Google Analytics may also measure selected clicks. We don’t send form contents, requested URLs, search queries, passwords, API keys or account emails. Turn it off here at any time.

Advertising

Not in use

No advertising cookies or remarketing tags.

Your choice is stored on this browser for 180 days. Read the cookie policy ↗