jaraco / wolframalpha

MIT License
148 stars 26 forks source link

Restructuring #7

Closed Zenohm closed 8 years ago

Zenohm commented 8 years ago

A few changes:

The main reason why I'm pushing (or rather pulling) for this change is because I'd like to have full access to the responses given by the Wolfram Alpha 2.0 API without having to parse XML. By initially converting to Python dictionaries the information has the benefit of all the tools that exist for dictionaries, and this makes interacting with the data more natural. If I changed any names I tried to make them as consistent and easy to remember as possible, though I may not have always succeeded. I tried to make the data types consistent across answers. For example, if it is possible that a query could result in more than one answer, I made sure that the answers were always returned as a list. The code as it is would fail one of the tests, as said test relied on getting the text from just one subpod, the main one. My version of the method used attempts to get the text from all subpods and organize them in a list, with the zero index being the desired result. In short, my version of the method assumes that there could be more than one subpod in the primary pod and makes sure the result is consistent (as I said I'd do above). All of the other tests pass. Due to this however, I made sure the version number was changed to 3.0 so it was understood that the new version can be incompatible with the old code.

Tell me if there's anything that needs changed or cannot be done. I would like to see this grow into an interface that would allow full, easy access to all that the Wolfram Alpha API v2.0 has to offer. :)

Zenohm commented 8 years ago

Also, this does add one extra dependency: xmltodict. This shouldn't be a problem, however, as the library is available for both Python 2 and Python 3.

jaraco commented 8 years ago

Thanks for this. The overall gist looks good. I would like to dive a bit deeper in understanding the changes and following the commit history as you suggest. I'll do my best to get to it soonish, but if you don't hear from me in a few weeks, feel free to bug me.

chdsbd commented 8 years ago

:beetle: Any update on merging this pull request?

jaraco commented 8 years ago

Overall this is great. I like it a lot and I'd like to get it merged so I can make some tweaks before releasing it. If you would disregard my critiques, but answer the questions I made there, I'll work on the next iteration.

jaraco commented 8 years ago

Thanks again for this work. It was foundational in the implementation of the upcoming 3.0 release. Would you please take a look at the master and see that it suits your expectations?