-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.py
45 lines (36 loc) · 1.34 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import os
import ssl
from datetime import datetime
import requests
from dotenv import load_dotenv
from util.sudoku import get_sudoku
from util.trends import get_trends
from util.weather import get_weather
load_dotenv()
def letter(subject: str, content: str):
data = {
"boardDiv": "sympathyLetter",
"tempSaveYn": "N",
"traineeMgrSeq": os.getenv("TRAINEE"),
"sympathyLetterContent": content,
"trainUnitCd": os.getenv("CD"),
"trainUnitEduSeq": os.getenv("EDUSEQ"),
"sympathyLetterSubject": subject,
"sympathyLetterEditorFileGroupSeq": "",
"fileGroupMgrSeq": "",
"fileMgrSeq": "",
"sympathyLetterMgrSeq": "",
}
url = "https://www.thecamp.or.kr/consolLetter/insertConsolLetterA.do"
cookie = os.getenv("COOKIE")
response = requests.post(url=url, data=data, headers={"cookie": cookie}, verify=False, timeout=5)
print(response.text)
if response.status_code != 200:
raise
def today():
return datetime.now().strftime("%Y-%m-%d")
if __name__ == "__main__":
ssl._create_default_https_context = ssl._create_unverified_context
letter(f"[{today()}] 일기예보", f"<p>{get_weather()}</p>")
letter(f"[{today()}] 인기 검색어", f"<p>{get_trends()}</p>")
letter(f"[{today()}] 도전! 숫자 퍼즐", f'<img src="{get_sudoku()}"/>')