Export Knack data via python and knackpy

Using the groundwork of knackpy to combine the fields and the headers, I have added some sorting and date formatting ability in the below script.

(I'm very new to python so any suggestions are gratefully accepted)

## https://github.com/cityofaustin/knackpy
from knackpy import Knack
import json
import pandas as pd
from pandas.io.json import json_normalize

# download data from Knack
# will fetch records in chunks of 1000 until all records have been downloaded
# optionally pass a rows_per_page and/or page_limit parameter to limit record count
kn
= Knack(
obj
=‘object_XX’,
app_id
=‘REDACTED’,
api_key
=‘REDACTED’,
tzinfo
=‘Europe/London’,
page_limit
=10, # this is the default
rows_per_page
=1000 # this is the default
)

#Set file paths
offline_filepath
= ‘C:/Directory Name/Folder Name/Save Location/’
filename
= ‘KNACK_filename here with no ext’

#Save the raw JSON file to Drive Backup
with open(offline_filepath+filename+’.json’, ‘w’) as outfile:
json
.dump(kn.data, outfile)

#Flatten the data
data_df
= json_normalize(kn.data,sep="_")

#Order the columns
#data_df = data_df[[‘Field ID’,‘Employee’,‘Department’,‘Date of Birth’,‘id’]]
#data_df.sort_values(by=[‘Field ID’], inplace=True)

#Convert the date formats from UNIX to Date
#data_df[‘Date of Birth’] = pd.to_datetime(data_df[‘Date of Birth’],unit=‘ms’)

#Convert and export to CSV
#Save to Drive Backup
data_df
.to_csv(offline_filepath+filename+’.csv’,index=False,date_format="%Y-%m-%d")