0

basically I am trying to grab stock tickers in python from yahoo.

I figured out through research that you can't use & in a url without using the url escape sequence, but every time the script runs it downloads the desired files, but then hangs indefinitely

import os
import subprocess

urlStart = 'http://download.finance.yahoo.com/d/quotes.csv?s=';
urlEnd = '%26f=b2';

fileStart = 'quotes.csv?s=';
stockList = "goog:t:msft:fb:orcl:csco:dell:hpq:intc:amd:qcom";
stockArray = stockList.split(":");
i=0
while(i < len(stockArray)):
    downloadLink = urlStart + stockArray[i] + urlEnd;
    subprocess.Popen(["wget", downloadLink]); 
    fileName = fileStart + stockArray[i];
    i += 1;

and I am unsure where to go. I had the same exact problem in c so I jumped over to python thinking it was c related, but ran in to the same error. any tips?

jball
  • 24,791
  • 9
  • 70
  • 92
j.gooch
  • 305
  • 1
  • 4
  • 21
  • 1
    Check out these links http://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python and https://pypi.python.org/pypi/wget – iChux Oct 09 '13 at 08:42
  • that helped and was exactly what I needed, I ended up going over to google finance because frankly the yahoo api is lacking in simplicity. – j.gooch Oct 09 '13 at 10:18

0 Answers0