I am trying to pull responses via API using Python. My attempts have gone pretty well, except I only want previous days data. For some reason is pulling all data. I know I can manually put in yesterday date, however, I need this to be automated. I am using the below code...Thank you in advance.
# Python 3
import requests
import zipfile
import json
import io
import urllib3
import urllib
import shutil
from datetime import datetime, timedelta, date
current_full_date = date.today()
d = current_full_date - timedelta(1)
d = str(d)
d = datetime.strptime(d, '%Y-%m-%d').strftime('%Y-%m-%dT00:00:00-05:00')
e = current_full_date - timedelta(1)
e = str(e)
e = datetime.strptime(e, '%Y-%m-%d').strftime('%Y-%m-%dT23:59:59-05:00')
dt = date.today() - timedelta(1)
dt = str(dt)
dt = datetime.strptime(dt, '%Y-%m-%d').strftime('%m-%d-%Y')
oldname = ""
newname = ""
oldname2 = ""
Setting user Parameters
apiToken = ""
surveyId = ""
fileFormat = "csv"
startDate = d
endDate = e