Add salary detection configuration and payloads

Updated config.py to include the salary detection endpoint, headers, and sample payloads. Enhanced salary_detect.py to utilize the new configuration for making POST requests to the endpoint with random salary data. Improved error handling during the request process.
This commit is contained in:
2025-07-08 16:43:37 +01:00
parent 99e1b82ea8
commit 332b743fa5
2 changed files with 28 additions and 3 deletions
+9 -2
View File
@@ -1,6 +1,8 @@
import time
import logging
import threading
import requests
from .config import SALARY_DETECT_URL, SALARY_DETECT_HEADERS, get_random_salary_payload
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
@@ -13,9 +15,14 @@ class SalaryDetect:
def _run(self):
while self._running:
logger.info(f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] Detecting salary...")
time.sleep(1)
try:
payload = get_random_salary_payload()
response = requests.post(SALARY_DETECT_URL, headers=SALARY_DETECT_HEADERS, json=payload)
logger.info(f"POST {SALARY_DETECT_URL} status: {response.status_code}, response: {response.text}")
except Exception as e:
logger.error(f"Error during POST: {e}")
logger.info(f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] Salary detection complete")
time.sleep(1)
time.sleep(120)
def start(self):
if not self._running: