Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setup_class(self):
self.patcher = patch('passivetotal.api.Client._get', fake_request)
self.patcher.start()
self.client = SslRequest('--No-User--', '--No-Key--')
def get_ssl(self, **kwargs):
client = SslRequest(self.username, self.apikey)
keys = ['query', 'compact', 'field', 'type']
params = self._cleanup_params(keys, **kwargs)
if not params.get('type'):
return client.get_ssl_certificate_details(**params)
elif params.get('type') == 'history':
return client.get_ssl_certificate_history(**params)
elif params.get('type') == 'search' and params.get('field'):
return client.search_ssl_certificate_by_field(**params)
else:
self.log.error("No SSL field provided.")
return None
def __init__(self, *args, **kwargs):
"""Setup the primary client instance."""
super(SslRequest, self).__init__(*args, **kwargs)
def call_ssl(args):
"""Abstract call to SSL-based queries."""
client = SslRequest.from_config()
pruned = prune_args(
query=args.query,
compact_record=args.compact,
field=args.field,
type=args.type
)
valid_types = ['search', 'history']
if args.type and args.type not in valid_types:
raise ValueError("Invalid type specified.")
if not args.type:
data = client.get_ssl_certificate_details(**pruned)
elif args.type == 'history':
data = client.get_ssl_certificate_history(**pruned)
elif args.type == 'search' and args.field: