I've just released an alpha version of PyCurrency. The code is embarrassingly horrible, the doctests pass and most importantly it works for me. The idea is to create a wrapper around Google's currency conversion features.
To get started install it using easy_install or pip:
easy_install pycurrencyUsage is pretty straight forward. Below is an example of how you would convert 1 US Dollar to Jamaican Dollars:
u'85.2878465'
Once instantiated, a converter object can be loaded with new currencies and amounts and the result recalculated. For more information visit: http://readthedocs.org/docs/pycurrency
The source is managed using mercurial and housed at bitbucket.org: https://bitbucket.org/alteroo/pycurrency
5 comments:
Thanks for this, at the end of converter.py you could add:
def convert(amount,from_cur,to_cur):
return Converter(amount,from_cur,to_cur).result()
It would then be natural to do conversions on the fly from Ipython:
In [2]: from pycurrency.converter import convert
In [3]: convert(125,'EUR','GBP')
Out[3]: 109.50426400000001
@Yannig,
I've implemented the convert method, so now you can do your 'on the fly' conversions.
@David That's brilliant, thanks.
Due to the shutdown of iGoogle, pycurrency version 1.x no longer works. I'm busy assessing an appropriate way to make a 2.0 version based on openexchangerates.org
Thank you, I stil use it from time to time.
Post a Comment