You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#https://gist.github.com/mjlavin80/186a6395c5819dbe25a8a0e001d5acfd
|
|
|
|
import requests
|
|
|
|
import json
|
|
|
|
|
|
|
|
def get_annotations():
|
|
|
|
KEY = "6879-rwfbfodYqhBn2OK2ODnNGkzlWUa4bPCoJi2U8pgTYHg"
|
|
|
|
|
|
|
|
headers = {
|
|
|
|
"Host": "xppl",
|
|
|
|
"Accept": "application/json",
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
"Authorization": "Bearer %s" % KEY
|
|
|
|
}
|
|
|
|
|
|
|
|
search_url = "".join("http://localhost:5000/api/search")
|
|
|
|
|
|
|
|
r = requests.get(search_url, headers=headers)
|
|
|
|
data = json.loads(r.text)
|
|
|
|
return data
|
|
|
|
|
|
|
|
# extract=[]
|
|
|
|
# for item in data['rows']:
|
|
|
|
# # if 'exact' in item['target'][0]['selector'][2]:
|
|
|
|
# if 'selector' in item['target'][0]:
|
|
|
|
# if len(item['target'][0]['selector']) > 2:
|
|
|
|
# extract.append('extract:' + (item['target'][0]['selector'][2]['exact']))
|
|
|
|
# extract.append('annotation:' + item['text'])
|
|
|
|
# extract.append ('-----------')
|
|
|
|
# else:
|
|
|
|
# extract.append('annotation:' + item['text'])
|
|
|
|
# extract.append ('-----------')
|
|
|
|
# return extract
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|