import pymysql
import requests
import configparser
from bs4 import BeautifulSoup
from datetime import datetime
from google.colab import drive
from xml.etree import ElementTree as et
...(중략)
area = {
1:['경기',31],
2:['강원',17],
3:['충북',11],
4:['서울',25],
5:['부산',16],
6:['대구',10],
7:['인천',9],
8:['광주',5],
9:['대전',5],
10:['울산',5],
11:['충남',15],
12:['전북',14],
13:['전남',21],
14:['경북',14],
15:['경남',18],
16:['제주',2],
17:['세종',1]
}
numOfRows = area.get(15)[1] #지역 수
sidoName = area.get(15)[0] #경남
params = {'pageNo': 1, 'numOfRows': numOfRows, 'sidoName': sidoName, 'searchCondition': 'HOUR'}
resp = requests.get(URL+'?serviceKey='+change_keyword(SERVICEKEY), params=params)
# print(resp.text)
with open(RST_URI,'w') as file:
file.write(resp.text)
data_collection(sidoName, RST_URI)
(자세한 소스는 아래의 사이트에서 참고하세요)