¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ
import urllib.request
def website(add):
page = urllib.request.urlopen(add)
text = page.read().decode('utf8')
print (text)
¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ
ÀϹÝÀû »çÀÌÆ®´Â Àß ±Ü¾î¿É´Ï´Ù.
±×·±µ¥
http://map.naver.com/local/siteview.nhn?code=11813800
ÀÌ·± ÁÖ¼Ò´Â ¾È±Ü¾îÁö³×¿ä.
ƯÁ¤ ÁÖ¼Ò¸¦ °¡Á®¿À°í ½Í¾î¼
http://map.naver.com/local/siteview.nhn?code= ¿Í 11813800¸¦ ºÐ¸®Çؼ µÚ ¼ýÀÚ ºÎºÐ¸¸ º¯°æÇÏ¸é¼ ÁÖ¼Ò¸¦ ±Ü¾î¿À·Á°í Çϴµ¥
ÀÌ ÁÖ¼Ò ÀÚü°¡ ¾È±Ü¾îÁö´Ï ½ÃµµÁ¶Â÷ ¸øÇÏ°í ÀÖ½À´Ï´Ù.
¿Ö ÀÌ ÆäÀÌÁö´Â
Traceback (most recent call last):
File "", line 1, in
website('http://map.naver.com/local/siteview.nhn?code=11813800')
File "C:/Users/2635/Desktop/site.py", line 4, in website
page = urllib.request.urlopen(add)
File "C:Python34liburllibrequest.py", line 161, in urlopen
return opener.open(url, data, timeout)
File "C:Python34liburllibrequest.py", line 469, in open
response = meth(req, response)
File "C:Python34liburllibrequest.py", line 579, in http_response
'http', request, response, code, msg, hdrs)
File "C:Python34liburllibrequest.py", line 507, in error
return self._call_chain(*args)
File "C:Python34liburllibrequest.py", line 441, in _call_chain
result = func(*args)
File "C:Python34liburllibrequest.py", line 587, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request
ÀÌ·± ¿À·ù¸¦ ¹ñ¾î³»´ÂÁö ±Ã±ÝÇÕ´Ï´Ù. | |
|
Çì´õ ¼³Á¤À» µû·Î ¾ÈÇØÁÖ¸é ÆÄÀ̽㠱⺻ Çì´õ·Î request°¡ ³¯¾Æ°¡´Âµ¥, ³×À̹öÃø¿¡¼ À̸¦ üũÇÏ´Â°Í °°³×¿ä.
Çì´õ¼³Á¤À» ¾ÈÇØÁÖ¸é ÆÄÀ̽ãÀº user-agent ºÎºÐ¿¡ python À̶ó´Â ¹®ÀÚ¿À» Æ÷ÇÔ½ÃÄѼ µé¾î°©´Ï´Ù.
³×À̹ö´Â ÀÌ Çì´õ¸¦ °Ë»çÇϴ°ű¸¿ä.
ÆÄÀ̽㵵 Çì´õ¸¦ ¼³Á¤ ÇØÁִ±º¿ä..!!
¾öû ½ßÃʺ¸¶ó ¤¾¤¾
Á¤¸» °¨»çÇÕ´Ï´Ù.
Çì´õ ¹®Á¦´Â ±¸±Û¸µÀ» Çصµ Àß ¾È³ª¿À´õ¶ó°í¿ä;; (Çѱ۹®¼ ÇÑÁ¤)
Çì´õ¸¦ ¾î¶»°Ô »ç¿ëÇÏ´ÂÁö¸¦ ¸ô¶ó°¡Áö°í
±¸±Û¸µ°ú ³×À̹ö¸¦ ¾öû µÚÁ³´õ´Ï. °á±¹ ³ª¿À³×¿ä!
ÈùÆ® Áּż Á¤¸» °¨»çÇÕ´Ï´Ù!!
ÀÌ·± ÈùÆ®°¡ ÇÊ¿äÇѵ¥.. ÆÄÀ̽ãÀº ÈùÆ® ÁÖ½Ç ¼ö ÀÖ´Â ºÐµéÀÌ Âü ÀûÀº°Ô ¾ÈŸ±õ½À´Ï´Ù.