remove useless comment

This commit is contained in:
monoid 2023-07-22 16:10:53 +09:00
parent c394dc1780
commit 6fb97ac894

View File

@ -7,10 +7,8 @@ import sqlite3
import datetime import datetime
def get_naver_finance_price(code,page=1): def get_naver_finance_price(code,page=1):
#url = (f'https://finance.naver.com/item/sise_day.nhn?code={code}&page={page}')
url = 'https://finance.naver.com/item/sise_day.nhn' url = 'https://finance.naver.com/item/sise_day.nhn'
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"} headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"}
# print(url)
html = requests.get(url,params={'code':code,'page':page},headers=headers) html = requests.get(url,params={'code':code,'page':page},headers=headers)
if html.status_code != 200: if html.status_code != 200:
raise UserWarning(html.status_code) raise UserWarning(html.status_code)
@ -52,7 +50,6 @@ def croll_naver_page(code,page,date):
def croll_naver_page_all(code,date) -> pd.DataFrame: def croll_naver_page_all(code,date) -> pd.DataFrame:
html_text = get_naver_finance_price(code) html_text = get_naver_finance_price(code)
#print(html_text)
s = bs4.BeautifulSoup(html_text,'html.parser') s = bs4.BeautifulSoup(html_text,'html.parser')
last = int(get_last_page(s)) last = int(get_last_page(s))
r = [(code,i) for i in range(1,last+1)] r = [(code,i) for i in range(1,last+1)]
@ -66,9 +63,6 @@ def croll_naver_page_all(code,date) -> pd.DataFrame:
if len(retdata) == 0: if len(retdata) == 0:
return [] return []
return pd.concat(retdata,ignore_index=True) return pd.concat(retdata,ignore_index=True)
#with mp.Pool(CPU_COUNT) as pl:
# dl = pl.starmap(croll_naver_page,r)
# return pd.concat(dl,ignore_index=True)
def toSqlPos(x,code): def toSqlPos(x,code):
return (code,x["날짜"],x["종가"],x["전일비"],x["시가"],x["고가"],x["저가"],x["거래량"]) return (code,x["날짜"],x["종가"],x["전일비"],x["시가"],x["고가"],x["저가"],x["거래량"])