Commit dcd8ff06 authored by Alessandro CERIONI's avatar Alessandro CERIONI
Browse files

Attempting to get the User-Agent within a try-except block so as to make the...

Attempting to get the User-Agent within a try-except block so as to make the service usable even without the User-Agent header
parent 0160caf1
Pipeline #3198 passed with stage
in 32 seconds
......@@ -23,10 +23,12 @@ def index():
if not os.path.isfile('cache/%s' % filename):
refresh_cache()
user_agent = request.headers.get('User-Agent')
if 'windows' in user_agent.lower():
filename = 'catalog-windows1252.csv'
try:
user_agent = request.headers.get('User-Agent')
if 'windows' in user_agent.lower():
filename = 'catalog-windows1252.csv'
except:
pass
return send_file('cache/%s' % filename,
mimetype='text/csv',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment