File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
scan_explorer_service/views Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -31,20 +31,23 @@ def article_extra(bibcode: str):
3131 response = requests .get (ads_search_service , params , headers = headers ).json ()
3232 current_app .logger .debug (f'Response: { response } ' )
3333
34-
3534 if response .status_code == 429 :
35+ current_app .logger .error (f'Rate limit exceeded' )
3636 return jsonify (message = 'Rate limit exceeded' , error = response ), 429
3737
3838 docs = response .get ('response' ).get ('docs' )
3939 current_app .logger .debug (f'Docs: { docs } ' )
4040 if docs :
41+ current_app .logger .debug (f'Doc found: { docs [0 ]} ' )
4142 return docs [0 ]
4243 else :
44+ current_app .logger .error (f'No article found' )
4345 return jsonify (message = 'No article found' ), 404
44- except :
46+ except Exception as e :
47+ current_app .logger .error (f'500 error: { e } ' )
4548 return jsonify (message = 'Failed to retrieve external ADS article metadata' ), 500
4649
47-
50+ current_app . logger . debug ( f'Empty response block' )
4851 return {}
4952
5053@advertise (scopes = ['api' ], rate_limit = [300 , 3600 * 24 ])
You can’t perform that action at this time.
0 commit comments