The BugoBot, Discord bot, is developed for all students of Bucheon High School. But if you change some dummy codes, you can create your own service!
You can get a school food menu as JSON via an HTTP GET request. So data can be called from any platform.
When a meal is requested more than once, the meal is saved on the server by the requested school, year, and month, greatly improving response speed. Also support elementary, middle, and high schools in Korea.
- Elementay School :
elementary
- Middle School :
middle
- High school :
high
You can get your school code here!
Then go to the lunch_api.py code and fix this one:
# get url
self.today_url = 'https://schoolmenukr.ml/api/your_school_type/your_school_code?year=2022&allergy=hidden' + today_month + today_date
self.tomorrow_url = 'https://schoolmenukr.ml/api/your_school_type/your_school_code?year=2022&allergy=hidden' + tomorrow_month + tomorrow_date
Fix your_school_type
type and your_school_code
!
https://schoolmenukr.ml/api/your_school_type/your_school_code
is the main address. And you can add more condition of address.
This part is optional.
https://schoolmenukr.ml/api/your_school_type/your_school_code?[variable_name1]=[value1]&[variable_name2]=[value2]
Variable Name | Explanation | Initial Value |
---|---|---|
year | By specifying a specific year, the menu corresponding to that year is loaded. | Year of current date |
month | By specifying a specific month, the menu for that month is called up. | Month of current date |
date | By specifying a specific day, the menu for that day is called up. | Day of current date |
allergy | When set to 'hidden', allergy information is not displayed, and when set to 'formed', information is displayed structured. | None |
Python
import requests
import json
url = 'https://schoolmenukr.ml/api/middle/X123456789?year=2018&month=5'
response = requests.get(url)
school_menu = json.loads(response.text)
print(school_menu)
{
menu: [
...,
{
date:"5",
breakfast:["찹쌀밥","홍합미역국5.6.","닭갈비5.6.13.","김구이13.","배추김치9.13.","방울토마토12."],
lunch:["흑미밥","콩나물국5.13.","돼지등뼈김치찜9.10.13.","도토리묵무침5.6.13.","총각김치9.13.","청포도"],
dinner:["찹쌀밥","오징어짬뽕국5.6.","배추겉절이13.","포도쥬스5.13.","만두오꼬노미야끼1.5.6.10.12.13."]
},
...
],
server_message: ["foo", "bar", ...]
}
© 2022, BugoBot. Released under GNU General Public License v3.0.
BugoBot is authored and maintained by @CharlesbrownK.