@@ -66,17 +66,18 @@ async def insertPlayerRank(
6666 style ,
6767 )
6868 xquery = insertQuery (sql )
69-
69+
70+ content_data = {"inserted" : xquery , "xtime" : time .perf_counter () - tic }
7071 if xquery < 1 :
71- response .body = { "inserted" : xquery , "xtime" : time . perf_counter () - tic }
72+ response .body = json . dumps ( content_data ). encode ( 'utf-8' )
7273 response .status_code = status .HTTP_304_NOT_MODIFIED
7374 return response
7475
7576 # Prepare the response
7677 toc = time .perf_counter ()
7778 print (f"Execution time { toc - tic :0.4f} " )
7879
79- response .body = { "inserted" : xquery , "xtime" : time . perf_counter () - tic }
80+ response .body = json . dumps ( content_data ). encode ( 'utf-8' )
8081 response .status_code = status .HTTP_201_CREATED
8182 return response
8283
@@ -115,16 +116,17 @@ async def updatePlayerRankPoints(
115116 )
116117 xquery = insertQuery (sql )
117118
119+ content_data = {"updated" : xquery , "xtime" : time .perf_counter () - tic }
118120 if xquery < 1 :
119- response .body = { "updated" : xquery , "xtime" : time . perf_counter () - tic }
121+ response .body = json . dumps ( content_data ). encode ( 'utf-8' )
120122 response .status_code = status .HTTP_304_NOT_MODIFIED
121123 return response
122124
123125 # Prepare the response
124126 toc = time .perf_counter ()
125127 print (f"Execution time { toc - tic :0.4f} " )
126128
127- response .body = { "updated" : xquery , "xtime" : time . perf_counter () - tic }
129+ response .body = json . dumps ( content_data ). encode ( 'utf-8' )
128130 response .status_code = status .HTTP_200_OK
129131 return response
130132
@@ -166,16 +168,17 @@ async def updatePlayerRankPoints2(
166168 )
167169 xquery = insertQuery (sql )
168170
171+ content_data = {"updated" : xquery , "xtime" : time .perf_counter () - tic }
169172 if xquery < 1 :
170- response .body = { "updated" : xquery , "xtime" : time . perf_counter () - tic }
173+ response .body = json . dumps ( content_data ). encode ( 'utf-8' )
171174 response .status_code = status .HTTP_304_NOT_MODIFIED
172175 return response
173176
174177 # Prepare the response
175178 toc = time .perf_counter ()
176179 print (f"Execution time { toc - tic :0.4f} " )
177180
178- response .body = { "updated" : xquery , "xtime" : time . perf_counter () - tic }
181+ response .body = json . dumps ( content_data ). encode ( 'utf-8' )
179182 response .status_code = status .HTTP_200_OK
180183 return response
181184
@@ -202,16 +205,17 @@ async def updatePlayerRank(
202205 )
203206 xquery = insertQuery (sql )
204207
208+ content_data = {"updated" : xquery , "xtime" : time .perf_counter () - tic }
205209 if xquery < 1 :
206- response .body = { "updated" : xquery , "xtime" : time . perf_counter () - tic }
210+ response .body = json . dumps ( content_data ). encode ( 'utf-8' )
207211 response .status_code = status .HTTP_304_NOT_MODIFIED
208212 return response
209213
210214 # Prepare the response
211215 toc = time .perf_counter ()
212216 print (f"Execution time { toc - tic :0.4f} " )
213217
214- response .body = { "updated" : xquery , "xtime" : time . perf_counter () - tic }
218+ response .body = json . dumps ( content_data ). encode ( 'utf-8' )
215219 response .status_code = status .HTTP_200_OK
216220 return response
217221
@@ -271,16 +275,17 @@ async def updateLastSeen(
271275 sql = surftimer .queries .sql_UpdateLastSeenMySQL .format (steamid32 )
272276 xquery = insertQuery (sql )
273277
278+ content_data = {"updated" : xquery , "xtime" : time .perf_counter () - tic }
274279 if xquery < 1 :
275- response .body = { "updated" : xquery , "xtime" : time . perf_counter () - tic }
280+ response .body = json . dumps ( content_data ). encode ( 'utf-8' )
276281 response .status_code = status .HTTP_304_NOT_MODIFIED
277282 return response
278283
279284 # Prepare the response
280285 toc = time .perf_counter ()
281286 print (f"Execution time { toc - tic :0.4f} " )
282287
283- response .body = { "updated" : xquery , "xtime" : time . perf_counter () - tic }
288+ response .body = json . dumps ( content_data ). encode ( 'utf-8' )
284289 response .status_code = status .HTTP_200_OK
285290 return response
286291
0 commit comments