Merge pull request #301 from r0fls/cache-remote-ip

cache the remote IP property
This commit is contained in:
Eli Uriegas 2017-01-16 20:07:53 -06:00 committed by GitHub
commit 55b39a3f15

View File

@ -142,7 +142,9 @@ class Request(dict):
@property @property
def ip(self): def ip(self):
return self.transport.get_extra_info('peername') if not hasattr(self, '_ip'):
self._ip = self.transport.get_extra_info('peername')
return self._ip
File = namedtuple('File', ['type', 'body', 'name']) File = namedtuple('File', ['type', 'body', 'name'])