File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 55api = Flask (__name__ )
66
77
8- @api .route (' /health' )
8+ @api .route (" /health" )
99def health ():
10- return jsonify (' Success' )
10+ return jsonify (" Success" )
1111
12- @api .route (' /api/v1/images' )
12+ @api .route (" /api/v1/images" )
1313def images ():
1414 with KeyValueStore () as kv :
1515 return api .response_class (
16- response = kv [' images' ],
16+ response = kv [" images" ],
1717 status = 200 ,
18- mimetype = ' application/json'
18+ mimetype = " application/json"
1919 )
2020
21- if __name__ == ' __main__' :
21+ if __name__ == " __main__" :
2222 api .run ()
Original file line number Diff line number Diff line change @@ -51,20 +51,20 @@ def get_state():
5151
5252def update_images ():
5353 with KeyValueStore (invalidate_hours = INVALIDATE_HOURS , readonly = False ) as kv :
54- if ' images' in kv :
55- print (f' { datetime .datetime .now ()} - skipped - already updated' )
54+ if " images" in kv :
55+ print (f" { datetime .datetime .now ()} - skipped - already updated" )
5656 return
57- print (f' { datetime .datetime .now ()} - updating images' )
57+ print (f" { datetime .datetime .now ()} - updating images" )
5858 current_state = get_state ()
59- kv [' images' ] = json .dumps (current_state )
60- print (f' { datetime .datetime .now ()} - updated images' )
59+ kv [" images" ] = json .dumps (current_state )
60+ print (f" { datetime .datetime .now ()} - updated images" )
6161
6262class UpdateImages (threading .Thread ):
6363 def run (self ,* args ,** kwargs ):
6464 while True :
6565 update_images ()
6666 time .sleep (INVALIDATE_HOURS * 60 * 60 )
6767
68- if __name__ == ' __main__' :
68+ if __name__ == " __main__" :
6969 update_images_thread = UpdateImages ()
7070 update_images_thread .start ()
You can’t perform that action at this time.
0 commit comments