The server actually sends a 301 response redirecting to http://download.finance.yahoo.com/d/quotes.csv?s=NAK&f=sl1c1vd1t1p2hg&e=.csv
. Your browser follows the redirect, but your code does not. If you directly use the final URL, your code works fine.