Registry / http-networking / wolframalpha

wolframalpha

JSON →
library5.1.3pypypi✓ verified 83d ago

The `wolframalpha` library is a Python client for the Wolfram|Alpha 2.0 API, enabling Python programs to submit natural language queries to the Wolfram|Alpha computational knowledge engine and retrieve structured results. As of April 2026, the current version is 5.1.3, and the project maintains an active release cadence with regular minor and patch updates.

pip install wolframalpha
INSTALL
IMPORT
SIG · WOLFRAMALPHA
W
wolframalpha
http-networkingpythonv5.1.3
Install
2.8s avg
Import
381ms
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.397s · 23.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.8s · import 0.365s · 24MB
22MB installed
● package 22MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
from wolframalpha import Client
import wolframalpha client = wolframalpha.Client(APP_ID)

To get started, you need an App ID from the Wolfram|Alpha Developer Portal. This ID is used to authenticate your requests. The example demonstrates how to initialize the client, send a basic query, and extract the text result. It also shows how to retrieve an image URL if the result includes one. It's recommended to store your App ID in an environment variable for security.

import wolframalpha import os # Get your App ID from the Wolfram|Alpha Developer Portal # (developer.wolframalpha.com/portal/myapps) APP_ID = os.environ.get('WOLFRAM_ALPHA_APPID', 'YOUR_WOLFRAM_ALPHA_APP_ID') if APP_ID == 'YOUR_WOLFRAM_ALPHA_APP_ID' or not APP_ID: print("Error: WOLFRAM_ALPHA_APPID environment variable not set or placeholder used.") print("Please obtain an App ID from developer.wolframalpha.com/portal/myapps and set it.") else: try: client = wolframalpha.Client(APP_ID) # Send a query res = client.query('What is the capital of France?') # Print the plaintext result from the first pod # The API returns results in 'pods', often with multiple subpods # Iterating `res.results` is a common way to get answers. print(f"Wolfram|Alpha says: {next(res.results).text}") # Example of getting an image result (if available in a pod) res_img = client.query('Plot sin(x)') for pod in res_img.pods: for sub in pod.subpods: if sub.img: print(f"Image URL for '{pod.title}': {sub.img.src}") except Exception as e: print(f"An error occurred: {e}") print("Ensure your App ID is correct and you haven't exceeded query limits.")
Debug
Known issues
breakingThe underlying Wolfram|Alpha API has query limits for free accounts (e.g., 2000 calls per month). Exceeding these limits will result in API errors or empty responses.
fix
Monitor your usage in the Wolfram|Alpha Developer Portal. Upgrade to a paid plan for higher limits if necessary. Implement retry logic with exponential backoff for transient errors.
affects: All versions
gotchaWolfram|Alpha queries often return results in a complex structure of 'pods' and 'subpods'. Directly accessing `res.results` and `next(res.results).text` might miss relevant information or lead to `StopIteration` if no simple text result is available in the first pod.
fix
Always iterate through `res.pods` and `pod.subpods` to inspect all available data, including `pod.title`, `sub.title`, `sub.plaintext`, `sub.img.src`, and `sub.infos`. Implement robust parsing logic for different types of queries.
affects: All versions
gotchaUsing an invalid or expired App ID will lead to authentication failures or empty results from the Wolfram|Alpha API, even if the Python client code runs without syntax errors.
fix
Double-check your App ID in the Wolfram|Alpha Developer Portal (developer.wolframalpha.com/portal/myapps). Ensure it's correctly copied and passed to the `wolframalpha.Client` constructor or set in the `WOLFRAM_ALPHA_APPID` environment variable.
affects: All versions
Upgrade
Version history
5.1.3latest on PyPI · released Jun 1, 2024
Audit
Dependencies
requestsrequiredUsed for making HTTP requests to the Wolfram|Alpha API.
Agent activity
41 hits · last 30 days
node
36
OpenAI (training)
1
Resources
wolframalpha — pip install wolframalpha · libregistry