[python]リクエストロールバックホットスポット


Timeout


解決策


timeoutパラメータを次のように追加します.
response = requests.get(url, timeout=3)

SSLError

HTTPSConnectionPool(host='www.gov.kr', port=443): Max retries exceeded with url: /portal/service/serviceInfo/PTR000050203 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))

解決策

response = requests.get(url, verify=False)

ハングルエンコーディング割り込みの問題


解決策


utf-8で符号化すればハングルは割れないと思っていたが、そうではなかった.
  • 参考:https://dev-jacob.tistory.com/entry/Python-Requests-%ED%95%9C%EA%B8%80-%EA%B9%A8%EC%A7%90-%EB%AC%B8%EC%A0%9C-%ED%95%B4%EA%B2%B0%ED%95%98%EA%B8%B0
  • response = requests.get(url)
    content_type = response.headers['content-type']
        if not 'charset' in content_type:
            response.encoding = response.apparent_encoding
    リクエストで解決できない問題については、Seleniumなどを使用してください.