Вопрос

After looking, I have been unable to find a python3 module or method of pulling exchange rate data from the internet into my program.

Any ideas?

Thanks

Это было полезно?

Решение

Well, I'm not sure what's the location of your data source and in what format you need the data, but from your description I can make the following recomandation:

Use a service like:

https://openexchangerates.org/

and afterwards parse the response with a JSON parser (like the official one):

http://docs.python.org/3.3/library/json.html

and Voila you have the currency.

UPDATE

If you really have time and as the time passes patience to modify it, you can take whatever site you want with a visible exchange rate and write a HTML parser:

http://www.diveintopython.net/html_processing/extracting_data.html

This solution gives you freedom (basically you can query whatever you want) but if a site changes... well you have to update your code

UPDATE 2

You can use a very simple trick and a very simple html from google. Try to call the following link:

http://www.google.com/finance/converter?a=1&from=BGN&to=AED

and you will get a response for free, without any key, but be aware that this is not fair play especially when you are polling the service many times a minute!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top