0

I'm trying to download and iterate over csv file but I'm only reading the headers but no more lines after it tried using this answer but with no luck this is my code:

from datetime import datetime
import requests
import csv


def main():
    print("python main function")
    datetime_object = datetime.now().date()
    url = f'https://markets.cboe.com/us/equities/market_statistics/volume_reports/day/{datetime_object}/csv/?mkt=bzx'
    print(url)
    response = requests.get(url, stream=True)
    csv_content = response.content.decode('utf-8')
    print(csv_content)
    cr = csv.reader(csv_content.splitlines(), delimiter='~')
    my_list = list(cr)
    for row in my_list:
        print(row)


if __name__ == '__main__':
    main()
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
yaodav
  • 1,126
  • 12
  • 34

1 Answers1

0
cr = csv.reader(csv_content.splitlines(), delimiter='~')

change to

cr = csv.reader(csv_content.splitlines(), delimiter=',')

And check if You download full file or file with header only use URL in browser ;)

Wondercricket
  • 7,651
  • 2
  • 39
  • 58
PawelU
  • 11
  • 2