Snapjobs Python SDK Reference
Python Integration
Enterprise-grade Python SDK for AI-powered talent matching
Installation
pip install sjm
1
Quick Setup
from sjm import SJM
import os
# Initialize client with your API key
client = SJM(
api_key=os.getenv("SJM_API_KEY")
)
1
2
3
4
5
6
7
Core Features
Freelancer Matching
# Match freelancers to a project
matches = client.match(
description="Build a modern web application with React and Node.js",
required_skills=["React.js", "Node.js", "TypeScript"],
budget_range=(5000, 10000),
complexity="medium",
timeline=30
)
# Display top matches
for match in matches["matches"][:3]:
freelancer = match["freelancer"]
print(f"Match: {freelancer['name']} ({freelancer['job_title']})")
print(f"Score: {match['score']:.2f}")
print(f"Matching Skills: {match['matching_skills']}")
print(f"Hourly Rate: 85/hr")
print("---")
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Skills Verification
# Verify a specific skill
result = client.verify_skill("React.js")
# Check if the skill exists
if result["data"]["exists"]:
print(f"✅ The skill 'React.js' is verified in the database")
if "skills" in result["data"]:
print(f"Matching skills: {', '.join(result['data']['skills'])}")
else:
print(f"❌ The skill 'React.js' is not verified")
if result["data"]["similar_terms"]:
print(f"Did you mean: {', '.join(result['data']['similar_terms'])}")
1
2
3
4
5
6
7
8
9
10
11
12
AI Interviews
# Step 1: Generate interview questions
interview = client.interview(
freelancer_id="f123",
project_description="Build a modern web application with React",
required_skills=["React.js", "Node.js", "TypeScript"],
job_title="Full Stack Developer",
mode="ai_questions"
)
# Get session ID and questions
session_id = interview["data"]["session_id"]
questions = interview["data"]["interview_data"]["questions"]
# Display questions
for i, q in enumerate(questions, 1):
print(f"Q{i}: {q['text']}")
print(f"Scoring Criteria: {q['scoring_criteria']}")
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Resume Parsing
# Parse a resume file
resume_data = client.parse_resume("resume.pdf")
# Extract skills and other information
if resume_data["status"] == "success":
skills = resume_data["data"]["skills"]
print(f"Extracted Skills: {', '.join(skills)}")
# Check education and experience if available
if resume_data["data"]["education"]:
print(f"Education: {resume_data['data']['education']}")
if resume_data["data"]["experience"]:
print(f"Experience: {resume_data['data']['experience']}")
# Check contact information
if resume_data["data"]["contact"]:
contact = resume_data["data"]["contact"]
print(f"Email: {contact.get('email')}")
print(f"Phone: {contact.get('phone')}")
print(f"Location: {contact.get('location')}")
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Command Line Interface
The Snapjobs package includes a convenient command line interface for quick access to the API functions:
# Set your API key as an environment variable (recommended)
export SJM_API_KEY="your_api_key"
# Check API health
sjm health
# Match freelancers to a project
sjm match --description "Web development project" --skills "React.js,Node.js,TypeScript"
# Verify if a skill exists in the database
sjm verify "React.js"
# Generate test data
sjm generate --count 10
# Display help
sjm --help
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Error Handling
from sjm import SJM, SJMAuthenticationError, SJMRateLimitError, SJMAPIError
client = SJM(api_key="your_api_key")
try:
result = client.match(
description="Project description",
required_skills=["React.js", "Node.js"]
)
except SJMAuthenticationError as e:
print(f"Authentication failed: {e}")
except SJMRateLimitError as e:
print(f"Rate limit exceeded. Reset in {e.reset_at} seconds")
except SJMAPIError as e:
print(f"API error: {e}")
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
API Reference
Client Initialization
from sjm import SJM
# Basic initialization
client = SJM(api_key="your_api_key")
1
2
3
4
Health Check
# Check the health of the SJM API
health = client.health()
print(f"API Status: {health['status']}")
if "components" in health:
for component, status in health["components"].items():
print(f"{component}: {status['status']}")
1
2
3
4
5
6
7