01-16-2018 02:10 PM
Hello,
I'm having an issue trying to get tags out of sample search in Autofocus API (using pan-python).
Below is a working piece of code I use. It get search results the way it shoud, but there's no "tags" field in the results.
Do you have any idea how to solve this issue?
def get_results_iterator(data): # used later in the code
try:
r = afapi.samples_search_results(data, False)
return r
except pan.afapi.PanAFapiError as e:
print('ERROR while trying to get results iterator:', e)
sys.exit(1)
try:
afapi = pan.afapi.PanAFapi(panrc_tag='autofocus')
except pan.afapi.PanAFapiError as e:
print('pan.afapi.PanAFapi:', e)
sys.exit(1)
url = "http://ascii.net"
data = """{
"query": {
"operator": "all",
"children": [{
"field": "alias.url",
"operator": "contains",
"value": "%s"
}]
},
"scope": "public",
"size": 10
}""" % url
results = get_results_iterator(data)
for r in results:
print r.json
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!