import requests
BASE_URL = "https://api.chessplay.io/api"
# Login
response = requests.post(f"{BASE_URL}/token/", json={
"username": "admin_user",
"password": "your_password"
})
token = response.json()["access"]
# Create student
headers = {"Authorization": f"Bearer {token}"}
student = requests.post(
f"{BASE_URL}/v1/students/",
headers=headers,
json={
"username": "FastMalamute",
"email": "student@example.com",
"first_name": "John",
"last_name": "Doe",
"password": "secure_password"
}
).json()
print(f"Created: {student['username']}")