python - how do I clear last query from cache -
i have python script running on bottle , returns json data when called. problem if call url on browser , keep refreshing (hitting f5), result seems adding instead of getting fresh data database each refresh. e.g. if 1 result on query one, refresh browser, i'll 2 results instead of 1 result. first result of second refesh data initial query meaning "script/browser" hasn't forgotten initial query.
the way fetches new data when stop , start script via $python3.2 myscript.py
is there way make fetching of fresh data default behaviour whereby won't cache last result?
here script:
@route('/get_member', method = "get") def get_member(): key = request.query.key search = request.query.search if search == none: return "blank search parameter" elif search == "": return "blank search parameter" elif len(str(search)) < 2: return "search variable short" hmn = none result = [] params ={} try: if key == 'id': if valid_integer(search) == false: return "search should numbers only" mbr = member() hmn = mbr.get_id(search) else: return "wrong key provided" if hmn != none: result.append(hmn) hmn = none #save query file file_name = get_day() f = open(file_name + ".log", "a") print ("name of file: ", f.name) f.write(get_time_now() + str(result) + "\n") #return jason file json import dumps response.content_type = 'application/json' return dumps(result) result = none except: return "oops, error occured" finally: result = none
Comments
Post a Comment