示例#1
0
def get_pharmacy_data(lat, lng, radius, page, row_num, isFirst):
    pharmacy = pharm_list(lat, lng, page, row_num, radius)

    for j in range(row_num):
        print(j)
        input = []
        # i 번째 page 에서 j 번째 병원의 data
        jth_pharm = pharmacy['response']['body']['items']['item'][j]
        # 병원 정보 api 에서 받아 올 수 있는 데이터를 먼저 받아온다.
        input.append(('lng', jth_pharm['XPos']))
        input.append(('lat', jth_pharm['YPos']))
        name = '\'' + jth_pharm['yadmNm'] + '\''
        input.append(('name', name))
        input.append(('addr', '\'' + jth_pharm['addr'] + '\''))
        input.append(('kind', 1))

        if isFirst is True:
            helper.insert('store', input)
        else:
            sto = helper.search('store', ['sid'], input[0:3], 1)
            print(sto)
            if sto != []:
                continue
            else:
                helper.insert('store', input)
示例#2
0
def get_subject(ykiho, hid, isFirst):
    if isFirst is False:
        check = helper.search('h_subject', ['hid'], [('hid', hid)], 1)
        if check != []:
            return

    # 병원 진료과목 받아오기 (병원의 데이터가 데이터 베이스에 먼저 저장이 되어 있어야 함)
    jth_hos_subject = hosp_subject(ykiho)
    while jth_hos_subject is None:
        jth_hos_subject = hosp_subject(ykiho)
    sub_total = jth_hos_subject['response']['body']['totalCount']
    jth_hos_subject = jth_hos_subject['response']['body']['items']

    if jth_hos_subject != '':
        #hid = helper.search('hospital', ['hid'], [('name',name)], 1)[0]['hid']
        if (sub_total != 1):
            for p in range(sub_total):
                subject_input = []
                subject_input.append(('hid', hid))
                subject = '\'' + jth_hos_subject['item'][p]['dgsbjtCdNm'] + '\''
                #print(subject)
                subject_input.append(('subject', subject))
                helper.insert('h_subject', subject_input)
        else:
            subject_input = []
            subject_input.append(('hid', hid))
            subject = '\'' + jth_hos_subject['item']['dgsbjtCdNm'] + '\''
            #print(subject)
            subject_input.append(('subject', subject))
            helper.insert('h_subject', subject_input)
示例#3
0
def get_hospital_data(lat, lng, radius, page, row_num, isFirst):

    print("page" + str(page))
    # page number 에 해당하는 page 를 읽어온다.
    hospital = hosp_list(lat, lng, page, row_num, radius)
    th = []
    for j in range(row_num):
        print(j)
        input = []
        # i 번째 page 에서 j 번째 병원의 data
        jth_hos = hospital['response']['body']['items']['item'][j]
        # 병원 정보 api 에서 받아 올 수 있는 데이터를 먼저 받아온다.
        input.append(('lng', jth_hos['XPos']))
        input.append(('lat', jth_hos['YPos']))
        name = '\'' + jth_hos['yadmNm'] + '\''
        input.append(('name', name))
        input.append(('dnum', jth_hos['drTotCnt']))
        input.append(('addr', '\'' + jth_hos['addr'] + '\''))
        input.append(('ykiho', '\'' + jth_hos['ykiho'] + '\''))

        # When getting data is not first, check the data exist.
        if isFirst is True:
            helper.insert('hospital', input)
        else:
            hos = helper.search('hospital', ['hid'], input, 1)
            if hos != []:
                continue
            else:
                helper.insert('hospital', input)
        '''
示例#4
0
文件: app.py 项目: nesllewr/web
def register_rest():
    sid = request.form.get("id")
    name = request.form.get('name')
    email = request.form.get("email")

    print(f"{name}이 {email}로 가입함, {sid}")
    helper.insert("student", sid, name, email)

    return "OK"
示例#5
0
文件: app.py 项目: nesllewr/web
def register():
    sid = request.form.get("id")
    name = request.form.get('name')
    email = request.form.get("email")

    print(f"{name}이 {email}로 가입함, {sid}")
    helper.insert("student", sid, name, email)

    return redirect("/")  #다시 원래페이지로 redirect
示例#6
0
def register():
    name = request.form.get("name")
    phone = request.form.get("phone")

    print(f"{name}이 {phone}로 가입")
    print(helper.insert("student", name, phone))

    return render_template("index.html")
示例#7
0
driver.switch_to_default_content()
driver.switch_to_frame('com_list_frame')

datas = []
for k in range(32):
    for j in range(1,11):
        for i in range(1,11):
            if k == 31 and j == 6 and i == 9:
                break

            print(100*k + 10*(j-1) + (i-1))
            data = driver.find_element_by_xpath("/html/body/div[1]/div/div[" + str(i) + "]").get_attribute('innerHTML')
            data = data.split('<div>')

            data.append({'name' :data[1].strip()[:-6], 'addr' : data[2].strip()[:-6]})
            helper.insert('store', [('kind', 2,), ('addr', '\'' + data[2].strip()[:-6] + '\''), \
                                                 ('name', '\'' + data[1].strip()[:-6] + '\'')])

        if k == 31 and j == 6:
            break

        if j != 10:
            button = driver.find_element_by_xpath("/html/body/div[2]/div[1]/a[" + str(j) + "]")
            button.click()
            time.sleep(1.5)

    if k == 0:
        button = driver.find_element_by_xpath("/html/body/div[2]/div[2]/a[3]/img")
        button.click()
        time.sleep(1.5)
    elif k != 31:
        button = driver.find_element_by_xpath("/html/body/div[2]/div[2]/a[4]/img")
示例#8
0
def h_insert_subject_thread(input, ykiho, name):
    helper.insert('hospital', input)
    get_subject(ykiho, name)