Created
November 3, 2017 17:06
-
-
Save michaeltcoelho/da22d28ac9217fba0c5214dc583652aa to your computer and use it in GitHub Desktop.
Reading a csv from an url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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