Skip to content

Instantly share code, notes, and snippets.

@ddarkr
Created June 2, 2025 05:49
Show Gist options
  • Save ddarkr/37c605f89613187d6bcdc6bc254bdf63 to your computer and use it in GitHub Desktop.
Save ddarkr/37c605f89613187d6bcdc6bc254bdf63 to your computer and use it in GitHub Desktop.
연구실안전관리시스템 trick
import requests
import time
# === 설정 ===
schedule_member_progress_no = 123456 # 변경 가능
start_offset = 1 # 시작 currentTime
total_time = 2041 # 전체 시간 (초 단위)
cookie_value = '[INSERT_HERE]' # 쿠키
interval = 5 # 5초마다 요청
# === 고정 값 ===
url = 'https://safety.sch.ac.kr/Edu/AviProcessCheck'
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
'Content-Type': 'application/x-www-form-urlencoded',
}
cookies = {
'ASP.NET_SessionId': cookie_value,
}
# === 예외처리 ===
if start_offset >= total_time:
print(f"[ERROR] 시작 시간({start_offset})이 전체 시간({total_time})보다 크거나 같습니다.")
print("start_offset을 total_time보다 작게 설정해주세요.")
exit(1)
if start_offset < 0:
print(f"[ERROR] 시작 시간({start_offset})이 음수입니다.")
print("start_offset을 0 이상으로 설정해주세요.")
exit(1)
current_time = start_offset
print(f"[INFO] 진행 시작: {start_offset}초부터 {total_time}초까지 ({interval}초 간격)")
while True:
# total_time을 넘어서면 current_time을 total_time으로 조정하고 마지막 요청으로 설정
if current_time >= total_time:
current_time = total_time
is_end = True
else:
is_end = False
data = {
'scheduleMemberProgressNo': str(schedule_member_progress_no),
'currentTime': str(current_time),
'isEnd': str(is_end).lower(),
}
try:
response = requests.post(url, headers=headers, cookies=cookies, data=data, timeout=10)
response.raise_for_status()
print(f"[SUCCESS] currentTime={current_time}, isEnd={is_end}")
if is_end:
print("[INFO] 진행 완료!")
break
current_time += interval
time.sleep(interval)
except requests.RequestException as e:
print(f"[ERROR] 요청 실패 (currentTime={current_time}): {e}. 재시도 대기 중...")
time.sleep(5) # 실패 시 5초 후 재시도
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment