๊ณต๊ณต๋ฐ์ดํฐํฌํธ์์ ํ๊ตญ์ฅ์ ์ธ๊ณ ์ฉ๊ณต๋จ ์ฅ์ ์ธ ๊ตฌ์ธ ์ค์๊ฐ ํํฉ api๋ฅผ ํธ์ถํด ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ค๋ ๊ณผ์ ์์ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ค.
๊ณต๊ณต๋ฐ์ดํฐ ํฌํธ์์ api๋ฅผ ํธ์ถํ์ ๋๋ ์ฑ๊ณต์ ์ผ๋ก ํธ์ถํ๋ค.
import requests
import pprint
import json
PAGE_NO = '1'
NUM_OF_ROWS= '1000'
API_KEY = '' # Decoding ์ธ์ฆํค
url = 'https://apis.data.go.kr/B552583/job/job_list_env'
params = {
'serviceKey': API_KEY,
'pageNo': PAGE_NO,
'numOfRows': NUM_OF_ROWS
}
response = requests.get(url, params=params)
contents = response.text
pprint.pprint(contents)
์ง์ ์ฃผํผํฐ๋ ธํธ๋ถ์์ ํธ์ถํ๋ ค๊ณ ํ๋ ๊ณ์ ์๋์ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฌ๋ค.
SSLError: HTTPSConnectionPool(host='apis.data.go.kr', port=443)
์๋ฌ ๋ฉ์ธ์ง
---------------------------------------------------------------------------
SSLError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)
467 try:
--> 468 self._validate_conn(conn)
469 except (SocketTimeout, BaseSSLError) as e:
18 frames
SSLError: [SSL: SSLV3_ALERT_ILLEGAL_PARAMETER] sslv3 alert illegal parameter (_ssl.c:1007)
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last)
SSLError: [SSL: SSLV3_ALERT_ILLEGAL_PARAMETER] sslv3 alert illegal parameter (_ssl.c:1007)
The above exception was the direct cause of the following exception:
MaxRetryError Traceback (most recent call last)
MaxRetryError: HTTPSConnectionPool(host='apis.data.go.kr', port=443): Max retries exceeded with url: /B552583/job/job_list_env?serviceKey= xx &pageNo=1&numOfRows=1000 (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_ILLEGAL_PARAMETER] sslv3 alert illegal parameter (_ssl.c:1007)')))
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
515 if isinstance(e.reason, _SSLError):
516 # This branch is for urllib3 v1.22 and later.
--> 517 raise SSLError(e, request=request)
518
519 raise ConnectionError(e, request=request)
SSLError: HTTPSConnectionPool(host='apis.data.go.kr', port=443): Max retries exceeded with url: /B552583/job/job_list_env?serviceKey= xx &pageNo=1&numOfRows=1000 (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_ILLEGAL_PARAMETER] sslv3 alert illegal parameter (_ssl.c:1007)')))
https์์ s๋ฅผ ๋นผ๊ณ http๋ก ํธ์ถํ๋ ์ฑ๊ณต์ ์ผ๋ก ์คํ๋์๋ค.
url = 'http://apis.data.go.kr/B552583/job/job_list_env'