From 7bf562c98aeeb2dee1e30aef062fc983eea11428 Mon Sep 17 00:00:00 2001 From: Rae Woong Park Date: Fri, 21 Feb 2020 22:08:13 +0900 Subject: [PATCH 1/4] debug CERTIFICATE_VERIFY_FAILED , verify=False) added --- ch19/day06/05.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch19/day06/05.py b/ch19/day06/05.py index 2a0c0af..2cdd22c 100644 --- a/ch19/day06/05.py +++ b/ch19/day06/05.py @@ -1,6 +1,6 @@ import requests -response = requests.get("https://companyinfo.stock.naver.com/v1/company/c1010001.aspx?cmp_cd=035720") +response = requests.get("https://companyinfo.stock.naver.com/v1/company/c1010001.aspx?cmp_cd=035720", verify=False) print(response.text) From 7f5db366f859c2bb75381869ee02f9bf8ec9f183 Mon Sep 17 00:00:00 2001 From: Rae Woong Park Date: Fri, 21 Feb 2020 22:16:55 +0900 Subject: [PATCH 2/4] Update 06.py , verify=False added --- ch19/day06/06.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ch19/day06/06.py b/ch19/day06/06.py index 68afa9f..efdfd5f 100644 --- a/ch19/day06/06.py +++ b/ch19/day06/06.py @@ -6,12 +6,12 @@ re_id = re.compile("id: '([a-zA-Z0-9]*)' ?", re.IGNORECASE) url = "https://companyinfo.stock.naver.com/v1/company/c1010001.aspx?cmp_cd={}".format(code) -html = requests.get(url).text +html = requests.get(url, verify=False).text encparam = re_enc.search(html).group(1) encid = re_id.search(html).group(1) url = "https://companyinfo.stock.naver.com/v1/company/ajax/cF1001.aspx?cmp_cd={}&fin_typ=0&freq_typ=A&encparam={}&id={}".format( code, encparam, encid) headers = {"Referer": "HACK"} -html = requests.get(url, headers=headers).text +html = requests.get(url, , verify=False, headers=headers).text print(html) From 1a43cfdd2415c124142207c35d0c013c5f97cc1a Mon Sep 17 00:00:00 2001 From: Rae Woong Park Date: Fri, 21 Feb 2020 22:33:05 +0900 Subject: [PATCH 3/4] Update 08.py , verify = False --- ch19/day06/08.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ch19/day06/08.py b/ch19/day06/08.py index a90f796..7a20494 100644 --- a/ch19/day06/08.py +++ b/ch19/day06/08.py @@ -8,14 +8,14 @@ def get_financial_statements(code): re_id = re.compile("id: '([a-zA-Z0-9]*)' ?", re.IGNORECASE) url = "https://companyinfo.stock.naver.com/v1/company/c1010001.aspx?cmp_cd={}".format(code) - html = requests.get(url).text + html = requests.get(url, verify = False).text encparam = re_enc.search(html).group(1) encid = re_id.search(html).group(1) url = "https://companyinfo.stock.naver.com/v1/company/ajax/cF1001.aspx?cmp_cd={}&fin_typ=0&freq_typ=A&encparam={}&id={}".format( code, encparam, encid) headers = {"Referer": "HACK"} - html = requests.get(url, headers=headers).text + html = requests.get(url, , verify = False, headers=headers).text soup = BeautifulSoup(html, "html5lib") dividend = soup.select("table:nth-of-type(2) tr:nth-of-type(33) td span") @@ -30,4 +30,4 @@ def get_financial_statements(code): if __name__ == "__main__": dividend_dict = get_financial_statements("035720") - print(dividend_dict) \ No newline at end of file + print(dividend_dict) From 7800551f16253d41aa87447d5084b145cf150e67 Mon Sep 17 00:00:00 2001 From: Rae Woong Park Date: Fri, 21 Feb 2020 22:43:06 +0900 Subject: [PATCH 4/4] Update 08.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 네이버에서 배당율 위치가 33 --> 31로 바뀜 --- ch19/day06/08.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch19/day06/08.py b/ch19/day06/08.py index 7a20494..9f0faa7 100644 --- a/ch19/day06/08.py +++ b/ch19/day06/08.py @@ -18,7 +18,7 @@ def get_financial_statements(code): html = requests.get(url, , verify = False, headers=headers).text soup = BeautifulSoup(html, "html5lib") - dividend = soup.select("table:nth-of-type(2) tr:nth-of-type(33) td span") + dividend = soup.select("table:nth-of-type(2) tr:nth-of-type(31) td span") years = soup.select("table:nth-of-type(2) th") dividend_dict = {}