Connect with Python requests
Create trusted submissions from a Python backend.
Requirements
Install the requests HTTP library, create a form and issue a workspace API token with submissions:create scope.
Protected ingestion uses POST /api/v1/forms/:formId/submissions with Authorization: Bearer and submissions:create scope.
Configure and test
Step 1: Copy credentials or form key
Create a scoped workspace token in API Tokens and store it in the server or hosting platform secret store.
Step 2: Add the request
Store PANTHER_HOOK_TOKEN outside source control. Include test: true during acceptance tests. Python scripts should use a bounded network timeout and handle non-2xx errors.
Step 3: Send a test
Use test: true in the JSON request or run the form setup test tool.
Step 4: Verify and launch
Open Submissions and filter by Test to verify captured field values. Configure enabled destinations and inspect Deliveries separately.
Example
This Python requests example uses standard HTTP. Panther Hook does not require a framework-specific SDK; replace all placeholder identifiers with real form values.
import os
import requests
response = requests.post(
'https://pantherhook.com/api/v1/forms/YOUR_FORM_ID/submissions',
headers={'Authorization': f"Bearer {os.environ['PANTHER_HOOK_TOKEN']}"},
json={'email': 'test@example.com', 'test': True},
timeout=10,
)
response.raise_for_status()
print(response.json())Troubleshoot
- Unexpected 4xx: check endpoint, scope or allowed origin and required fields.
- 429: respect rate limits and avoid unbounded retries.
- Accepted lead but missing notification: inspect the relevant destination and spam classification separately.
