python3 기준으로 작성하였습니다.

 

import urllib.request

opener=urllib.request.build_opener()
opener.addheaders=[(
	'User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64) 
	AppleWebKit/537.36 (KHTML, like Gecko) 
	Chrome/36.0.1941.0 Safari/537.36')]

urllib.request.install_opener(opener)

url = 'test.jpg'
urllib.request.urlretrieve(url , 'file.jpg')

 

+ Recent posts