Hi all, in order to download an image. In order to correctly retrieve the image I need to set the referer and handle cookies.
opener = urllib.request.build_opener(urllib.request.HTTPRedirectHandler (), urllib.request.HTTPCookieProcessor()) urllib.request.install_opener(opener) req = urllib.request.Request("http://myurl/image.jpg") req.add_header("Referer", "http://myulr/referer.jsp") r = urllib.request.urlopen(req) with open("image.jpg", "w" ) as fd: print(r.read(), file=fd) I'm not able to correctly save the image. In fact it seems that it it saved in hex format. Any suggestion? -- http://mail.python.org/mailman/listinfo/python-list