Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ st.markdown(
|
|
| 7 |
"""
|
| 8 |
<style>
|
| 9 |
.reportview-container .main .block-container{
|
| 10 |
-
max-width:
|
| 11 |
padding-top: 1rem;
|
| 12 |
padding-right: 1rem;
|
| 13 |
padding-left: 1rem;
|
|
@@ -22,9 +22,11 @@ st.markdown(
|
|
| 22 |
api_key = "Z2FNKPFTMDSTHHR60KS4"
|
| 23 |
base_url = "https://ecos.bok.or.kr/api/"
|
| 24 |
|
| 25 |
-
# API ํธ์ถ
|
| 26 |
-
def get_service_statistics():
|
| 27 |
-
url = f"{base_url}StatisticTableList/{api_key}/json/kr/
|
|
|
|
|
|
|
| 28 |
response = requests.get(url)
|
| 29 |
if response.status_code == 200:
|
| 30 |
return response.json()
|
|
@@ -33,8 +35,9 @@ def get_service_statistics():
|
|
| 33 |
st.write(response.text)
|
| 34 |
return None
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
|
|
|
| 38 |
response = requests.get(url)
|
| 39 |
if response.status_code == 200:
|
| 40 |
return response.json()
|
|
@@ -43,8 +46,9 @@ def get_statistical_glossary():
|
|
| 43 |
st.write(response.text)
|
| 44 |
return None
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
|
|
|
| 48 |
response = requests.get(url)
|
| 49 |
if response.status_code == 200:
|
| 50 |
return response.json()
|
|
@@ -53,8 +57,9 @@ def get_statistic_detail_items(stat_code):
|
|
| 53 |
st.write(response.text)
|
| 54 |
return None
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
|
|
|
| 58 |
response = requests.get(url)
|
| 59 |
if response.status_code == 200:
|
| 60 |
return response.json()
|
|
@@ -63,8 +68,9 @@ def get_statistic_search_conditions(stat_code):
|
|
| 63 |
st.write(response.text)
|
| 64 |
return None
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
|
|
|
| 68 |
response = requests.get(url)
|
| 69 |
if response.status_code == 200:
|
| 70 |
return response.json()
|
|
@@ -73,8 +79,9 @@ def get_top_100_statistics():
|
|
| 73 |
st.write(response.text)
|
| 74 |
return None
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
|
|
|
| 78 |
response = requests.get(url)
|
| 79 |
if response.status_code == 200:
|
| 80 |
return response.json()
|
|
|
|
| 7 |
"""
|
| 8 |
<style>
|
| 9 |
.reportview-container .main .block-container{
|
| 10 |
+
max-width: 90%; /* ํ๋ฉด ํฌ๊ธฐ๋ฅผ 90%๋ก ์ค์ */
|
| 11 |
padding-top: 1rem;
|
| 12 |
padding-right: 1rem;
|
| 13 |
padding-left: 1rem;
|
|
|
|
| 22 |
api_key = "Z2FNKPFTMDSTHHR60KS4"
|
| 23 |
base_url = "https://ecos.bok.or.kr/api/"
|
| 24 |
|
| 25 |
+
# ์๋น์ค ํต๊ณ ๋ชฉ๋ก API ํธ์ถ ํจ์
|
| 26 |
+
def get_service_statistics(start=1, end=10, stat_code=None):
|
| 27 |
+
url = f"{base_url}StatisticTableList/{api_key}/json/kr/{start}/{end}"
|
| 28 |
+
if stat_code:
|
| 29 |
+
url += f"/{stat_code}"
|
| 30 |
response = requests.get(url)
|
| 31 |
if response.status_code == 200:
|
| 32 |
return response.json()
|
|
|
|
| 35 |
st.write(response.text)
|
| 36 |
return None
|
| 37 |
|
| 38 |
+
# ํต๊ณ์ฉ์ด์ฌ์ API ํธ์ถ ํจ์
|
| 39 |
+
def get_statistical_glossary(term, start=1, end=10):
|
| 40 |
+
url = f"{base_url}StatisticWord/{api_key}/json/kr/{start}/{end}/{term}"
|
| 41 |
response = requests.get(url)
|
| 42 |
if response.status_code == 200:
|
| 43 |
return response.json()
|
|
|
|
| 46 |
st.write(response.text)
|
| 47 |
return None
|
| 48 |
|
| 49 |
+
# ํต๊ณ ์ธ๋ถํญ๋ชฉ ๋ชฉ๋ก API ํธ์ถ ํจ์
|
| 50 |
+
def get_statistic_detail_items(stat_code, start=1, end=10):
|
| 51 |
+
url = f"{base_url}StatisticItemList/{api_key}/json/kr/{start}/{end}/{stat_code}"
|
| 52 |
response = requests.get(url)
|
| 53 |
if response.status_code == 200:
|
| 54 |
return response.json()
|
|
|
|
| 57 |
st.write(response.text)
|
| 58 |
return None
|
| 59 |
|
| 60 |
+
# ํต๊ณ ์กฐํ ์กฐ๊ฑด ์ค์ API ํธ์ถ ํจ์
|
| 61 |
+
def get_statistic_search_conditions(stat_code, period, start_date, end_date, start=1, end=10):
|
| 62 |
+
url = f"{base_url}StatisticSearch/{api_key}/json/kr/{start}/{end}/{stat_code}/{period}/{start_date}/{end_date}"
|
| 63 |
response = requests.get(url)
|
| 64 |
if response.status_code == 200:
|
| 65 |
return response.json()
|
|
|
|
| 68 |
st.write(response.text)
|
| 69 |
return None
|
| 70 |
|
| 71 |
+
# 100๋ ํต๊ณ์งํ API ํธ์ถ ํจ์
|
| 72 |
+
def get_top_100_statistics(start=1, end=10):
|
| 73 |
+
url = f"{base_url}KeyStatisticList/{api_key}/json/kr/{start}/{end}"
|
| 74 |
response = requests.get(url)
|
| 75 |
if response.status_code == 200:
|
| 76 |
return response.json()
|
|
|
|
| 79 |
st.write(response.text)
|
| 80 |
return None
|
| 81 |
|
| 82 |
+
# ํต๊ณ ๋ฉํ ๋ฐ์ดํฐ๋ฒ ์ด์ค API ํธ์ถ ํจ์
|
| 83 |
+
def get_statistical_metadata(data_name, start=1, end=10):
|
| 84 |
+
url = f"{base_url}StatisticMeta/{api_key}/json/kr/{start}/{end}/{data_name}"
|
| 85 |
response = requests.get(url)
|
| 86 |
if response.status_code == 200:
|
| 87 |
return response.json()
|