Spaces:
Sleeping
Sleeping
Download test_api2.py from badarfaisa1/recruto: direct link, hf CLI and curl.
- Browser
- Download file 576 Bytes
-
https://huggingface.co/spaces/badarfaisa1/recruto/resolve/main/test_api2.py
- Command line
-
hf download hf://spaces/badarfaisa1/recruto/test_api2.py
-
curl -L -o test_api2.py https://huggingface.co/spaces/badarfaisa1/recruto/resolve/main/test_api2.py
576 Bytes
| import requests | |
| import jwt | |
| from datetime import datetime, timedelta | |
| # Create valid token | |
| JWT_SECRET = "recruto-local-dev-only-change-me" | |
| payload = {"uid": 1, "role": "candidate", "exp": datetime.utcnow() + timedelta(days=1)} | |
| token = jwt.encode(payload, JWT_SECRET, algorithm="HS256") | |
| url = "http://127.0.0.1:8000/api/candidate/apply-with-cv" | |
| data = {"job_id": "job_123", "name": "Fake Name", "email": "fake@me.com"} | |
| headers = {"Authorization": f"Bearer {token}"} | |
| r = requests.post(url, data=data, headers=headers) | |
| print("Status:", r.status_code) | |
| print("Response:", r.text) | |