This repository has been archived by the owner on Oct 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
198 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"식당" : [ | ||
{"0" : "이층집 뼈다귀"}, | ||
{"1" : "궁중 화로"}, | ||
{"2" : "미스터 짱닭 치킨"}, | ||
{"3" : "중국성"}, | ||
{"4" : "모던 팩토리"}, | ||
{"5" : "장충동할머니 족발보쌈"}, | ||
{"6" : "도스마스"}, | ||
{"7" : "행복한 돈가스"}, | ||
{"8" : "토마토 도시락"}, | ||
{"9" : "불스 떡볶이"}, | ||
{"10" : "천원국수"}, | ||
{"11" : "온양왕족발보쌈"}, | ||
{"12" : "은성식당"}, | ||
{"13" : "신창족발"}, | ||
{"14" : "북경탕수육"}, | ||
{"15" : "푸짐한밥상"}, | ||
{"16" : "영식당"}, | ||
{"17" : "돼지고기김치찌개"}, | ||
{"18" : "신창상회"}, | ||
{"19" : "한솥도시락"}, | ||
{"20" : "김밥나라"}, | ||
{"20" : } | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# views.py의 keyboard에서 사용할 버튼 모듈 | ||
|
||
basic_button = [ | ||
'학식', | ||
'종강', | ||
'학사 일정', | ||
'교내 Wi-Fi', | ||
'개발자 정보' | ||
] | ||
|
||
food_sel_process_button = [ | ||
'향설1 생활관', | ||
'향설2 생활관', | ||
'향설3 생활관', | ||
'학생회관', | ||
'교직원 식당', | ||
'처음으로' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 문자열에서 문자를 교환할 때 사용 할 딕셔너리 모듈 | ||
|
||
trans_dic = { | ||
'[': '' , | ||
']': '', | ||
'{' : '', | ||
'}': '' , | ||
"'": '', | ||
',' : '\n', | ||
':' : '\n', | ||
' ' : '', | ||
'\n' : '\n·', | ||
'-중식/석식-' : '\n[중식/석식]', | ||
'-조식-' : '\n[조식]', | ||
'-컵밥-' : '\n[컵밥]', | ||
'-중식-' : '\n[중식]', | ||
'-석식-' : '\n[석식]', | ||
'-한식-' : '\n[한식]', | ||
'-덮밥-' : '\n[덮밥]', | ||
'-양식-' : '\n[양식]', | ||
'-도시락-' : '\n[도시락]', | ||
'-스페셜메뉴-' : '\n[스페셜메뉴]', | ||
'-돈까스-' : '\n[돈까스]', | ||
'-라면-' : '\n[라면]', | ||
'-메뉴-' : '\n[메뉴]', | ||
'-부대라면-' : '\n[부대라면]', | ||
'-한정메뉴-' : '\n[한정메뉴]', | ||
'-샐러드바-' : '\n[샐러드바]', | ||
'\n·\n' : '\n\n', | ||
'·' : '· ' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# 학사 일정 파싱 모듈 | ||
|
||
from pytz import timezone | ||
from bs4 import BeautifulSoup | ||
import requests, os, re | ||
import json | ||
|
||
def parser() : | ||
|
||
# Location of parser.py | ||
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
# HTTP GET Request | ||
request = requests.get('https://homepage.sch.ac.kr/sch/05/05010000.jsp') | ||
|
||
# GET HTML Source | ||
html = request.text | ||
|
||
# Use BeautifulSoup, From HTML Source to Python Object | ||
# First Parameter is HTML Source, Second Parameter is the parser to be used | ||
soup = BeautifulSoup(html, 'html.parser') | ||
|
||
# HTML element using CSS Selector | ||
schedules = soup.find_all('a', {'class' : 'schedule'}) | ||
|
||
schedule_day = [] | ||
schedule_list = [] | ||
|
||
for schedule in schedules: | ||
# 날짜 가져오기 | ||
schedule_day.append(schedule.text) | ||
# 세부 내용 가져오기 | ||
schedule_list.append(schedule.get('title')) | ||
|
||
idx = 0 | ||
|
||
result_message = '의 학사일정\n' | ||
|
||
for schedule in schedule_day : | ||
schedule_message = '\n[' + str(schedule) + '일 일정]\n' + '· ' + schedule_list[idx] | ||
result_message = str(result_message) + schedule_message | ||
idx += 1 | ||
|
||
# GET HTTP Header | ||
header = request.headers | ||
|
||
# GET HTTP Status ( 200 : normal ) | ||
status = request.status_code | ||
|
||
# Check HTTP ( TRUE / FALSE ) | ||
is_HTTP_OK = request.ok | ||
|
||
return result_message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# 선택한 버튼이 학식 메뉴일 경우 메세지 포매팅 | ||
select_button = '[*] 선택한 버튼 : {0}\n[*] {1}의\n[*] {0} 메뉴입니다.\n' | ||
|
||
# 선택한 버튼이 학식이 아닐 경우 | ||
select_else_button = '[*] 선택한 버튼 : {0}\n' | ||
|
||
# 종강 버튼 선택 시 | ||
end_day = '[*] 오늘 : {0}\n[*] 종강 : {1}\n[*] 종강까지 {2}일 남았습니다.' | ||
|
||
# json 파일 오픈 예외 문자 | ||
json_open_error = '\n에러메세지가 보이면 관리자에게 알려주세요.' | ||
|
||
# 일요일 예외 | ||
sun_except = '\n일요일에 {0} 식당은\n운영하지 않습니다.' | ||
|
||
# 주말 예외 | ||
weekend_except = '\n주말에 {0} 식당은\n운영하지 않습니다.' | ||
|
||
# Wi-Fi 정보 | ||
wifi_info = '[*] ID : H(대문자)+학번(8자리)\n[*] 비밀번호 : 생년월일\n[*] 예시 : H20171234\n[*] 예시 : 980101' | ||
|
||
# 심각한 오류 | ||
fatal_error = '[*] 심각한 오류입니다.\n[*] 개발자에게 알려주세요' |
Oops, something went wrong.