-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
26 lines (20 loc) · 859 Bytes
/
main.py
File metadata and controls
26 lines (20 loc) · 859 Bytes
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
import os
from datetime import datetime
from pytz import timezone
from menu_crawl import parse_soup, extract_menu
from github_utils import get_github_repo, upload_github_issue
if __name__ == "__main__":
access_token = os.environ['MY_GITHUB_TOKEN']
repository_name = "menu_302"
seoul_timezone = timezone('Asia/Seoul')
today = datetime.now(seoul_timezone)
today_date = today.strftime("%Y년 %m월 %d일")
menu_url = "https://snuco.snu.ac.kr/foodmenu"
soup = parse_soup(menu_url)
issue_title = f"302동 메뉴({today_date})"
if soup == -1:
upload_contents = "Error: 302동 메뉴가 없습니다.\nContact Sangwoo Jung"
else:
upload_contents = extract_menu(soup)
repo = get_github_repo(access_token, repository_name)
upload_github_issue(repo, issue_title, upload_contents)