예제 #1
0
 def _request(self, request):
     self.monitor.count('requests', 1)
     if net.is_local_address(request.remote_ip):
         self.monitor.count('localhost_requests', 1)
     if net.is_private_address(request.remote_ip):
         self.monitor.count('private_requests', 1)
     return NullTransform()
예제 #2
0
 def _request(self, request):
     self.monitor.count('requests', 1)
     if net.is_local_address(request.remote_ip):
         self.monitor.count('localhost_requests', 1)
     if net.is_private_address(request.remote_ip):
         self.monitor.count('private_requests', 1)
     return NullTransform()
예제 #3
0
 def test_is_private_address_works_with_python3(self, is_python2_mock):
     """Test is_private_address method works for python3."""
     is_python2_mock.return_value = False
     self.assertTrue(is_private_address(u'127.0.0.1'))
     self.assertTrue(is_private_address('127.0.0.1'))
     self.assertFalse(is_private_address('126.0.0.10'))
예제 #4
0
 def test_is_private_address_works_with_python3(self, is_python2_mock):
     """Test is_private_address method works for python3."""
     is_python2_mock.return_value = False
     self.assertTrue(is_private_address(u'127.0.0.1'))
     self.assertTrue(is_private_address('127.0.0.1'))
     self.assertFalse(is_private_address('126.0.0.10'))