6.2일자 유튜브 강의 코드 질문

 

 

  • 과정명:  데이터 분석 릴레이 랜선특강
  • 강사명:  신동욱 선생님

 

안녕하세요?

2시간 동안 강의 유익하게 잘 들었습니다 :)

그런데, 코딩을 하던 중 계속 반복된 오류가 발생해 문의 드립니다. 

 시작부터 동일하게 입력하였구요.

 

이 부분에서 자꾸 401 에러가 발생합니다.

어떻게 하면 해결할 수 있을까요?

 

답변 기다리겠습니다. 

다시 한 번 좋은 강의 감사드립니다!

 

response = urllib.request.urlopen(request)
print(response.getcode())

 

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-19-8b0aa01bec06> in <module>()
----> 1 response = urllib.request.urlopen(request)
      2 print(response.getcode())

c:\users\dhrkd\appdata\local\programs\python\python36-32\lib\urllib\request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    221     else:
    222         opener = _opener
--> 223     return opener.open(url, data, timeout)
    224 
    225 def install_opener(opener):

c:\users\dhrkd\appdata\local\programs\python\python36-32\lib\urllib\request.py in open(self, fullurl, data, timeout)
    530         for processor in self.process_response.get(protocol, []):
    531             meth = getattr(processor, meth_name)
--> 532             response = meth(req, response)
    533 
    534         return response

c:\users\dhrkd\appdata\local\programs\python\python36-32\lib\urllib\request.py in http_response(self, request, response)
    640         if not (200 <= code < 300):
    641             response = self.parent.error(
--> 642                 'http', request, response, code, msg, hdrs)
    643 
    644         return response

c:\users\dhrkd\appdata\local\programs\python\python36-32\lib\urllib\request.py in error(self, proto, *args)
    568         if http_err:
    569             args = (dict, 'default', 'http_error_default') + orig_args
--> 570             return self._call_chain(*args)
    571 
    572 # XXX probably also want an abstract factory that knows when it makes

c:\users\dhrkd\appdata\local\programs\python\python36-32\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
    502         for handler in handlers:
    503             func = getattr(handler, meth_name)
--> 504             result = func(*args)
    505             if result is not None:
    506                 return result

c:\users\dhrkd\appdata\local\programs\python\python36-32\lib\urllib\request.py in http_error_default(self, req, fp, code, msg, hdrs)
    648 class HTTPDefaultErrorHandler(BaseHandler):
    649     def http_error_default(self, req, fp, code, msg, hdrs):
--> 650         raise HTTPError(req.full_url, code, msg, hdrs, fp)
    651 
    652 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 401: Unauthorized

 

0

댓글

댓글 2개
날짜 투표수
  • 저도 마찬가지로

    HTTPError: HTTP Error 401: Unauthorized

    에러가 뜨네요~
    -1
  • 안녕하세요.

     

    네이버 api 본인 계정의 아이디와 비밀번호를 입력하셔야 됩니다.

    네이버 api 개발자 본인 계정 등록 후 진행해보세요.

     

    감사합니다.

    0

댓글을 남기려면 로그인하세요.

 

원하는 것을 찾지 못하셨나요?

질문하기