Created
January 2, 2020 06:47
-
-
Save ettorerizza/32fb2a97ced1ff25672a0bc642dc918a to your computer and use it in GitHub Desktop.
How to use a POST APi with Jython in OpenRefine
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
import urllib | |
import urllib2 | |
import json | |
url = 'https://api.monkeylearn.com/v3/classifiers/cl_pi3C7JiL/classify/' | |
headers = { | |
'Authorization': 'Token 669523fYOUR OWN TOKEN200828427c17c28a7', | |
'Content-Type': 'application/json', | |
} | |
data = '{"data": ["%s"]}' % value | |
req = urllib2.Request(url, data, headers) | |
response = urllib2.urlopen(req) | |
result = json.loads(response.read()) | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment