LowCool
LowCool

Reputation: 1411

how to extract zip data from response in django

I want to retrieve data from below url for my django project. city bike trip, I am trying to something like this.

data = requests.get('https://s3.amazonaws.com/tripdata/JC-201708%20citibike-tripdata.csv.zip')

what I am getting zipped data with some info, my task is to unzip that data and convert it into django model object I saw people using gzip middleware in this answer but not sure if this solves purpose here,

Upvotes: 0

Views: 228

Answers (1)

Mark Adler
Mark Adler

Reputation: 112374

gzip is not zip. zip is not gzip. That's why there are two different names.

The Python zipfile module can be used to extract the contents of a .zip file.

Upvotes: 1

Related Questions