File tree Expand file tree Collapse file tree 4 files changed +13
-10
lines changed
Expand file tree Collapse file tree 4 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 1- 0.2.6
1+ 0.2.7
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ def from_http_request(request):
4949
5050 try :
5151 headers = request .headers
52- except AttributeError :
52+ except Exception :
5353 headers = None
5454
5555 if Utils .is_null_or_empty (client_token ):
Original file line number Diff line number Diff line change @@ -10,16 +10,19 @@ def get_secure_header_from_request(headers):
1010
1111 @staticmethod
1212 def get_client_ip_from_request (request ):
13- x_forwarded_for = request .META .get ('HTTP_X_FORWARDED_FOR' )
14- if x_forwarded_for :
15- ip = x_forwarded_for .split (',' )[- 1 ].strip ()
16- else :
17- ip = request .META .get ('REMOTE_ADDR' )
18- return ip
13+ try :
14+ x_forwarded_for = request .META .get ('HTTP_X_FORWARDED_FOR' )
15+ if x_forwarded_for :
16+ ip = x_forwarded_for .split (',' )[- 1 ].strip ()
17+ else :
18+ ip = request .META .get ('REMOTE_ADDR' )
19+ return ip
20+ except Exception :
21+ return ""
1922
2023 @staticmethod
2124 def get_remote_ip_from_request (request ):
2225 try :
2326 return request .raw ._original_response .fp .raw ._sock .getpeername ()[0 ]
24- except AttributeError :
27+ except Exception :
2528 return ""
Original file line number Diff line number Diff line change @@ -2,4 +2,4 @@ class VersionUtils(object):
22
33 @staticmethod
44 def get_version ():
5- return "0.2.6 "
5+ return "0.2.7 "
You can’t perform that action at this time.
0 commit comments