0

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,

Mark Adler
  • 101,978
  • 13
  • 118
  • 158
LowCool
  • 1,187
  • 5
  • 25
  • 51

1 Answers1

1

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.

Mark Adler
  • 101,978
  • 13
  • 118
  • 158
  • Can you please point me to any snippet I can refer? – LowCool Mar 13 '21 at 05:37
  • What do you mean snippet? @Mark is probably the smartest person in the world (literally) when it comes to zip. He suggested the Python zipfile module. I'd suggest reading the documentation on it and seeing how it can help your use case. – Hayden Mar 14 '21 at 17:54