Files
Liti-agent-Development/판례모음/lawnb_crawler/law_api.ipynb
T

98 lines
2.9 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import requests"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"query = \"민법 제425조\""
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"response = requests.get(f\"http://www.law.go.kr/DRF/lawSearch.do?target=prec&type=HTML&search=2&query={query}&display=100\")"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n",
"<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ko\" xml:lang=\"ko\">\n",
"<head>\n",
"<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"> \n",
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> \n",
"<link rel=\"stylesheet\" type=\"text/css\" href=\"/DRF/css/common.css\">\n",
"<script type=\"text/javascript\" src=\"/DRF/js/common/jquery/jquery.js\"></script>\n",
"\t<script type=\"text/javascript\" src=\"/DRF/js/common/jquery/jquery.form.js\"></script>\n",
"\t<script type=\"text/javascript\" src=\"/DRF/js/ext/adapter/ext/ext-base.js\"></script>\n",
"\t<script type=\"text/javascript\" src=\"/DRF/js/ext/ext-all.js\"></script>\n",
"\t<script type=\"text/javascript\" src=\"/DRF/js/common.js\"></script>\n",
"\t<script type=\"text/javascript\" src=\"/DRF/js/common-ex.js\"></script>\n",
"\t<script type=\"text/javascript\" src=\"/DRF/js/CookieUtil.js\"></script>\n",
"<title>국가법령정보 공동활용</title>\n",
"</head> \n",
"<body> \n",
"<!-- //error500 -->\n",
"<div id=\"error500\">\n",
"\t<h1><a href=\"#\"><img src=\"/DRF/images/topmenu/LSO_top_logo.gif\" alt=\"국가법령정보 공동활용\"></a></h1>\n",
"\t<div class=\"error_txt\">\n",
"\t\t<h2>사용자인증에 실패하였습니다</h2>\n",
"\t\t<p>OpenAPI 사용자 인증에 실패하였습니다. 접속하신 해당 기관에 문의 바랍니다.</p>\n",
"\t\t<em></em>\n",
"\t</div>\n",
"</div>\n",
"<!-- error500// -->\n",
" \n",
"</body>\n",
"</html>\n"
]
}
],
"source": [
"print(response.content.decode('utf-8'))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}