def download_weekly_bars(sourceCode, tableCode, year, csvFile, authToken=None):
 begin = (dt.get_first_monday(year) - datetime.timedelta(days=1))
 end = (dt.get_last_monday(year) - datetime.timedelta(days=1))
 bars = download_csv(sourceCode, tableCode, begin, end, 'weekly', authToken)
 f = open(csvFile, 'w')
 f.write(bars)
 f.close()

def download_weekly_bars ( sourceCode , tableCode , year , csvFile , authToken = None ) : begin = ( dt . get_first_monday ( year ) - datetime . timedelta ( days = 1 ) ) end = ( dt . get_last_monday ( year ) - datetime . timedelta ( days = 1 ) ) bars = download_csv ( sourceCode , tableCode , begin , end , 'weekly' , authToken ) f = open ( csvFile , 'w' ) f . write ( bars ) f . close ( )
download weekly bars from quandl for a given year .