wolframalpha/README

47 lines
1.1 KiB
Plaintext
Raw Normal View History

2012-10-04 00:36:35 +00:00
wolframalpha
============
Python Client built against the `Wolfram|Alpha <http://wolframalpha.com>`_
2012-10-04 12:49:31 +00:00
v2.0 API. This project is hosted on `bitbucket
2012-10-04 12:52:33 +00:00
<http://bitbucket.org/jaraco/wolframalpha>`_.
2012-10-04 12:49:31 +00:00
Installation
============
This library is released to PyPI, so the easiest way to install it is to use
2012-10-04 12:52:33 +00:00
easy_install::
2012-10-04 12:49:31 +00:00
easy_install wolframalpha
2012-10-04 12:52:33 +00:00
or pip::
2012-10-04 12:49:31 +00:00
pip install wolframalpha
If you don't have these tools or you prefer not to use setuptools, you may
also simply extract the 'wolframalpha' directory an appropriate location in
your Python path.
2012-10-04 00:36:35 +00:00
Usage
=====
Basic usage is pretty simple. Create the client with your App ID (request from
Wolfram Alpha)::
import wolframalpha
client = wolframalpha.Client(app_id)
Then, you can send queries, which return Result objects::
res = client.query('temperature in Washington, DC on October 3, 2012')
2012-10-04 12:49:31 +00:00
Result objects have `pods` attribute (a Pod is an answer from Wolfram Alpha)::
for pod in res.pods:
do_something_with(pod)
You may also query for simply the pods which have 'Result' titles::
2012-10-04 00:36:35 +00:00
2012-10-04 12:49:31 +00:00
print(next(res.results).text)
2012-10-04 00:36:35 +00:00
For more information, read the source.