Sitelet https://github.com/kindly-ai/external-scraper-example-python
Skip to content

About

external-scraper-example-python

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

External Scraper Example

Written in python

Running the server

uv run uvicorn main:app --port 8000 --reload

Testing your server locally

You can simulate a pull trigger from Kindly using curl. The Kindly-HMAC header must be a valid HMAC-SHA256 (base64) signature of the exact request body, signed with your signing_key_from_kindly_platform.

The example below uses the hardcoded demo key (1234567890abcdef1234567890abcdef) and a sample body — replace all placeholder values and recompute the HMAC when using your own key.

curl -X POST http://localhost:8000/ \
  -H "Content-Type: application/json" \
  -H "Kindly-HMAC: MSH5annPK7Ho6F15nz0K/uGqqhQtnATkgtGoVUBBCxU=" \
  -H "Kindly-HMAC-algorithm: HMAC-SHA-256 (base64 encoded)" \
  -H "Kindly-Bot-Id: YOUR_BOT_ID" \
  -H "Kindly-Config-Id: YOUR_CONFIG_ID" \
  -d '{"bot_id": "YOUR_BOT_ID", "config_id": "YOUR_CONFIG_ID"}'

Expected response: {"message": "ok"} with HTTP 200.

Recomputing the HMAC for your own key

import hmac, hashlib, base64, json

key = b"YOUR_SIGNING_KEY"
body = json.dumps({"bot_id": "YOUR_BOT_ID", "config_id": "YOUR_CONFIG_ID"}).encode()
signature = base64.b64encode(hmac.new(key, body, hashlib.sha256).digest()).decode()
print(signature)

Important: the body passed to curl -d must be byte-for-byte identical to the body used when computing the HMAC. Do not reformat or pretty-print it.

About

external-scraper-example-python

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages