Revert "Added IPware algorithm"

This reverts commit bdf66cb

WTF HOW DO I GIT
This commit is contained in:
David Tan 2017-10-19 19:20:44 -04:00
parent ca10e67d64
commit f4f6cc15c2

View File

@ -169,14 +169,8 @@ class Request(dict):
@property @property
def ip(self): def ip(self):
if not hasattr(self, '_ip'): if not hasattr(self, '_ip'):
self._ip = None self._ip = (self.transport.get_extra_info('peername') or
for key in HEADER_PRECEDENCE_ORDER: (None, None))
value = self.headers.get(key, self.headers.get(key.replace('_', '-'), '')).strip()
if value is not None and value != '':
for ip_str in [ip.strip().lower() for ip in value.split(',')]:
if ip_str and is_valid_ip(ip_str):
if not ip_str.startswith(NON_PUBLIC_IP_PREFIX):
self._ip = ip_str
return self._ip return self._ip
@property @property