today.isangjeong/app/library/vts.py
2025-03-02 23:23:45 +09:00

37 lines
1.1 KiB
Python

import requests, datetime
from bs4 import BeautifulSoup
import openpyxl, os, json
with open('./config.json') as json_file:
json_data = json.load(json_file)
KEY = json_data['KEY']
ROOT = json_data['ROOT']
font = f"{ROOT}/library/Pretendard-Bold.ttf"
WEBHOOK_URL = json_data['WEBHOOK_URL']
path = f'{ROOT}temp/downloaded_file.xlsx'
def download():
response = requests.get("https://f.imnya.ng/.today.isangjeong/vts.xlsx")
with open(path, "wb") as file:
file.write(response.content)
def detect_vts_day():
# 엑셀 파일 로드
ws = openpyxl.load_workbook(path, data_only=True).active
# 노란색 색상 코드
yellow_color = "FFFFFF00"
# 색상이 있는 셀 확인
vts_days = []
for row in ws.iter_rows(min_row=5, max_row=5):
for cell in row:
if cell.fill and cell.fill.start_color.index == yellow_color:
vts_days.append(cell.value.split(" ")[1].replace("", "").replace("(", "").replace(")", "")[:-1])
return vts_days
def VTS임(MSLV_YMD:str):
return str(MSLV_YMD)[-2:] in detect_vts_day()