record-assessment-backend
Backend SDK for SmartAI Assessment Portal — create sessions and manage assessments from your server.
Install
pip install record-assessment-backend
Usage
from record_assessment_backend import AssessmentClient
client = AssessmentClient(
api_key="VFN_LIVE_...",
secret_key="VFN_SK_LIVE_...",
base_url="https://your-api.com/api/v1", # optional
webhook_base_url="https://your-webhook-api.com", # optional
timeout=60.0, # optional — create_campaign calls OpenAI server-side
)
Create a session
result = client.create_session(
candidate_id="mongo_candidate_id",
name="Jane Doe",
email="jane@example.com",
)
token = result["token"]
Create a campaign
Generates the assessment immediately. method must be "programming" or
"knowledge" and the workflow must have that verification method enabled —
"programming" generates a programming-only assessment, "knowledge"
generates a mix of mcq/true-false/short-answer/long-answer per the workflow's
configured counts. workflow_id, method, and name+email are required —
everything else falls back to the workflow's own defaults:
campaign = client.create_campaign(
workflow_id="wf_...",
method="knowledge",
name="Jane Doe",
email="jane@example.com",
job_title="Backend Engineer", # optional
experience="3", # optional
level="2-5", # optional
)
assessment_link = campaign["assessmentLink"]
List assessments
assessments = client.list_assessments()
Poll for assessment links
Fired by create_campaign — send these to your candidates:
links = client.get_assessment_links()
for event in links["events"]:
print("send to candidates:", event["assessmentLink"])
if links["events"]:
client.acknowledge_assessment_links([e["eventId"] for e in links["events"]])
Poll for assessment results
Fired once a candidate submits or is disqualified. Carries score, passed,
totalMarks, passMarks, candidateName, candidateEmail, submittedAt,
durationMinutes, questionAnswers, proctoring, recording,
aiFeedback — plus reportUrl, the shareable link to the candidate's full
result report page:
results = client.get_assessment_results()
for event in results["events"]:
print(event["candidateEmail"], event["score"], "passed" if event["passed"] else "failed")
print("full report:", event["reportUrl"])
if results["events"]:
client.acknowledge_assessment_results([e["eventId"] for e in results["events"]])
get_webhook_events / acknowledge_webhook_events still work if you'd
rather handle both event types yourself in one poll — the link/result
methods above are just filtered, labeled wrappers around the same
Redis-backed queue.
Headers sent on every request
x-api-key: VFN_LIVE_...
x-signature: hmac-sha256(secret_key, "METHOD:/api/v1/path:timestamp:sorted_body")
x-timestamp: 1234567890123
Notes
secret_keyis HMAC-sign-only for signed requests (list_assessments);create_sessionandcreate_campaignsend it directly asx-secret-keyinstead, since those endpoints authenticate withx-api-key+x-secret-keyrather than a signature.- There's a single deployed backend for this integration — no separate
test/live URLs.
base_urlandwebhook_base_urlboth default to it, and can each be overridden independently via the constructor params (e.g. for local testing). Webhook events do use a different response envelope though:{status, code, data}on success,{status, code, message}on error — not{success, data}like the rest of this client.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file record_assessment_backend-2.0.4.tar.gz.
File metadata
- Download URL: record_assessment_backend-2.0.4.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df5c806cee76210e5ff19aff1728440286ee1b7116634d57be609582574f8b70
|
|
| MD5 |
dde603f4c3322c8ce0c7f3371deda48d
|
|
| BLAKE2b-256 |
648a0bd5e341fc3c8211d09273ac62133f79f21b103eb09c54b9ac22efaedd66
|
File details
Details for the file record_assessment_backend-2.0.4-py3-none-any.whl.
File metadata
- Download URL: record_assessment_backend-2.0.4-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
484b5cd10195a3503fbdcd33e29d445143bbdb7c35f0a57bbc881e398f7dbb48
|
|
| MD5 |
45d4eecbc19cb866a815448bfc52d05d
|
|
| BLAKE2b-256 |
b45db32809537d0614b04114b408a6fb8cb064254c84d354c262cd780bf3c947
|