logging of API usage
This commit is contained in:
@@ -816,7 +816,7 @@ def new_workout_from_df(r,df,
|
||||
|
||||
timestr = strftime("%Y%m%d-%H%M%S")
|
||||
|
||||
csvfilename ='media/Fusion_'+timestr+'.csv'
|
||||
csvfilename ='media/df_'+timestr+'.csv'
|
||||
|
||||
|
||||
df.rename(columns = columndict,inplace=True)
|
||||
|
||||
@@ -146,7 +146,7 @@ USER_LANGUAGE = 'en-US'
|
||||
from interactiveplots import *
|
||||
|
||||
# Define the API documentation
|
||||
schema_view = get_swagger_view(title='Rowsandall API (Unstable)')
|
||||
schema_view = get_swagger_view(title='Rowsandall API')
|
||||
|
||||
# Custom error pages with Rowsandall headers
|
||||
def error500_view(request):
|
||||
@@ -7985,6 +7985,9 @@ def strokedatajson(request,id):
|
||||
# currently only returns a subset.
|
||||
columns = ['spm','time','hr','pace','power','distance']
|
||||
datadf = dataprep.getsmallrowdata_db(columns,ids=[id])
|
||||
with open('media/apilog.log','a') as logfile:
|
||||
logfile.write(str(timezone.now())+": ")
|
||||
logfile.write(request.user.username+"(GET) \n")
|
||||
return JSONResponse(datadf)
|
||||
|
||||
if request.method == 'POST':
|
||||
@@ -8033,6 +8036,10 @@ def strokedatajson(request,id):
|
||||
starttime = totimestamp(row.startdatetime)+time
|
||||
unixtime = starttime+time
|
||||
|
||||
with open('media/apilog.log','a') as logfile:
|
||||
logfile.write(starttime+": ")
|
||||
logfile.write(request.user.username+"(POST) \r\n")
|
||||
|
||||
data = pd.DataFrame({'TimeStamp (sec)':unixtime,
|
||||
' Horizontal (meters)': distance,
|
||||
' Cadence (stokes/min)':spm,
|
||||
@@ -8049,6 +8056,7 @@ def strokedatajson(request,id):
|
||||
' ElapsedTime (sec)':time,
|
||||
})
|
||||
|
||||
# Following part should be replaced with dataprep.new_workout_from_df
|
||||
|
||||
timestr = row.startdatetime.strftime("%Y%m%d-%H%M%S")
|
||||
csvfilename ='media/Import_'+timestr+'.csv'
|
||||
|
||||
BIN
rowsanda_107501
BIN
rowsanda_107501
Binary file not shown.
Reference in New Issue
Block a user