<filename>src/client/urllib_ex/auth35.py
import urllib.request


URL = "http://www.example.com/login.html"


# 설명을 위한 코드라고 함
auth_handler = urllib.request.HTTPBasicAuthHandler()
auth_handler.add_password(realm='PDQ Application',
                          uri='https://mahler:8092/site-updates.py',
                          user='klem',
                          passwd='<PASSWORD>')
opener = urllib.request.build_opener(auth_handler)
urllib.request.install_opener(opener)
response = urllib.request.urlopen(URL)
print(response)


<filename>src/client/urllib_ex/auth35.py
import urllib.request


URL = "http://www.example.com/login.html"


# 설명을 위한 코드라고 함
auth_handler = urllib.request.HTTPBasicAuthHandler()
auth_handler.add_password(realm='PDQ Application',
                          uri='https://mahler:8092/site-updates.py',
                          user='klem',
                          passwd='<PASSWORD>')
opener = urllib.request.build_opener(auth_handler)
urllib.request.install_opener(opener)
response = urllib.request.urlopen(URL)
print(response)


# 설명을 위한 코드라고 함