Skip to content

Instantly share code, notes, and snippets.

@LeoSaucedo
Last active June 3, 2019 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeoSaucedo/d1f1d95e9e2f21d265719d511b9bc911 to your computer and use it in GitHub Desktop.
Save LeoSaucedo/d1f1d95e9e2f21d265719d511b9bc911 to your computer and use it in GitHub Desktop.
Wolfram API for Python
"""
Wolfram API implementation for Python.
Returns queries as a text file.
Carlos Saucedo, 2019
"""
import wolframalpha
class Client(object):
def __init__(self, key):
self.key = key
self.client = wolframalpha.Client(key)
# Processes a user query.
def ask(self, queryText):
res = self.client.query(queryText)
return next(res.results).text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment