jaraco / wolframalpha

MIT License
148 stars 25 forks source link

plaintext instead of plainText #28

Closed furas closed 3 years ago

furas commented 3 years ago

Your examples show code with planText but it doesn't works for me

And for some person which asks for it on Stackoverflow: How do I capture the plaintext of a result in wolfram alpha?

After digging I found that it has to be lower case plaintext - at least in this example from your documentation

for pod in res.pods:
    for sub in pod.subpods:
        print(sub.plaintext)   # <-- plaintext instead of plainText

Minimal working example

import os
import wolframalpha

APP_ID = "your-app-id"
#APP_ID = os.getenv("WOLFRAMALPHA_TOKEN")
#print(APP_ID)

#query = "temperature in Washington, DC on October 3, 2012"
query = "what is the temperature in georgia"

client = wolframalpha.Client(APP_ID)

res = client.query(query)

for pod in res.pods:
    print('title:', pod.title)
    for sub in pod.subpods:
        print()
        print(sub.plaintext)   # <-- plaintext instead of plainText
    print('\n---\n')

Tested on: Python 3.8, wolframalpha 4.1.1, Linux Mint 20

Thierryonre commented 3 years ago

Interesting... In issue #21, they had changed it from text to plainText but I guess they changed it again to plaintext.