Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
url = params.get('url', None)
type_ = params.get('type', None)
indicator_type = params.get('indicator_type', None)
if type_:
del params['type']
if indicator_type is not None:
# can probably do better validation here against the attribute
# of the pytx "Types" enum.
if indicator_type.strip() != "":
params['type_'] = params.get('indicator_type')
del params['indicator_type']
results = handlers.submit_query(request, url, type_, params=params)
return HttpResponse(json.dumps(results),
content_type="application/json")
else:
return render_to_response('error.html',
{'error': "Must be AJAX."},
RequestContext(request))