Skip to content

Instantly share code, notes, and snippets.

@michaeltcoelho
Created November 3, 2017 17:06
Show Gist options
  • Save michaeltcoelho/da22d28ac9217fba0c5214dc583652aa to your computer and use it in GitHub Desktop.
Save michaeltcoelho/da22d28ac9217fba0c5214dc583652aa to your computer and use it in GitHub Desktop.
Reading a csv from an url
"""Reading a csv file from an url."""
import csv
import codecs
import requests
url = ''
response = requests.get(url, stream=True, timeout=300)
csv_reader = csv.reader(
codecs.iterdecode(response.iter_lines(), 'ISO-8859-1'),
delimiter=';', quotechar='"',
)
headers = next(csv_reader)
for row in csv_reader:
print(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment