Example #1
0
def _create_api(args):
    api_version = "APIv{}".format(args.api_version)
    api_key, subscriber = _read_api_key_and_subscriber_status(args.config_file)
    subscriber = False
    return AbuseIpDb(api_key=api_key,
                     api_version=api_version,
                     subscriber=subscriber)
Example #2
0
 def test_instantiate__empty_key_provided(self, request):
     with self.assertRaises(ValueError):
         AbuseIpDb('')
     request.assert_not_called()
Example #3
0
 def get_api(self):
     return AbuseIpDb('some_API_key', 'APIv2')
Example #4
0
 def test_instantiate__invalid_api_version_provided(self, request):
     with self.assertRaises(ValueError):
         AbuseIpDb('some_API_key', api_version='InvalidAPIversion')
     request.assert_not_called()