-
-
Save anonymous/76d9f9f058045d092701 to your computer and use it in GitHub Desktop.
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 urllib2 | |
import json | |
""" | |
Send API call to metanumber server (designated via the URL variable). The equation is appended (per the parameters of the API call), and the result is returned / parsed. | |
""" | |
def makeAPICall(equation): | |
url = 'http://tyson.rci.sc.edu/metanumber/api/v1.0/engine/' #MN server address | |
equation = equation.replace("/", "|") #parse equation for division | |
requestURL = url + equation #concatenate URL and equation for full API call | |
returnValue = json.loads(urllib2.urlopen(requestURL).read()) #get return value | |
return returnValue['result'] #parse and print | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment