/HS651_2.py Secret
Created
April 27, 2019 00:25
Star
You must be signed in to star a gist
Gist of REST-annotator code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PDF2bs4 import * | |
import requests as r | |
import pprint | |
def send_text(a): | |
txt = a | |
txt2annotate = txt[0:500] | |
#Link: http://docs.python-requests.org/en/master/user/quickstart/ | |
data = {'apikey': '25c05e76-1580-4f46-abea-dd60c0a0596a', 'text':txt2annotate} | |
req = 'https://bioportal.bioontology.org/annotator' | |
r1 = r.post(req, data) | |
#print(r1.content) | |
print(r1.status_code) | |
#print(r1.url) | |
pp = pprint.PrettyPrinter(indent=2) | |
pp.pprint(r1.text) | |
if __name__ == '__main__': | |
case = 'text' | |
filePDF = 'StdLabData.pdf' | |
if case == 'text' : | |
convertedPDF = convert('text', filePDF, pages=[0,1]) | |
#print(convertedPDF) | |
send_text(convertedPDF) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment