stages/identification: migrate from core to separate stage

This commit is contained in:
Jens Langhammer
2020-05-09 21:31:29 +02:00
parent 131c3fdb32
commit 0aad0604d8
16 changed files with 285 additions and 139 deletions

View File

@ -18,7 +18,9 @@ def _get_client_ip_from_meta(meta: Dict[str, Any]) -> Optional[str]:
return None
def get_client_ip(request: HttpRequest) -> Optional[str]:
def get_client_ip(request: Optional[HttpRequest]) -> Optional[str]:
"""Attempt to get the client's IP by checking common HTTP Headers.
Returns none if no IP Could be found"""
return _get_client_ip_from_meta(request.META)
if request:
return _get_client_ip_from_meta(request.META)
return ""