wenmeng zhou commited on
Commit
c8cac1b
1 Parent(s): c66e342

remove cookie from user_id generation if cookies does not exists in header

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -741,7 +741,11 @@ with demo:
741
  ip_address = request_headers['host']
742
  user_agent = request_headers['user-agent']
743
  accept_language = request_headers['accept-language']
744
- cookie = request_headers['cookie']
 
 
 
 
745
 
746
  # 将信息组合成一个字符串
747
  combined_info = f"{ip_address}-{user_agent}-{accept_language}-{cookie}"
 
741
  ip_address = request_headers['host']
742
  user_agent = request_headers['user-agent']
743
  accept_language = request_headers['accept-language']
744
+ if 'cookie' in request_headers:
745
+ cookie = request_headers['cookie']
746
+ else:
747
+ cookie = 'empty'
748
+ print(f'cookie not in request_headers: {request_headers}')
749
 
750
  # 将信息组合成一个字符串
751
  combined_info = f"{ip_address}-{user_agent}-{accept_language}-{cookie}"