def get_http_headers(url):
"""
Get HTTP headers for given url
"""
if not url:
raise BadRequest('Missing url')
url = _get_deobfuscate_item(url)
try:
validate = URLValidator(schemes=('http', 'https', 'ftp', 'ftps', 'rtsp', 'rtmp'))
validate(url)
except ValidationError:
raise BadRequest('Not a valid URL')
try:
response = ImplementationFactory.instance.get_singleton_of(
'PhishingServiceBase'
).get_http_headers(url)
schema.valid_adapter_response('PhishingServiceBase', 'get_http_headers', response)
return response
except (PhishingServiceException, schema.InvalidFormatError, schema.SchemaNotFound) as ex:
raise InternalServerError(str(ex))
评论列表
文章目录