Management Command¶
About¶
This command is designed for use on regular busis with shedule management like cron.
Basicly it goes to Bank open api, parse rates (defined in settings) and stores result in database.
Command takes no external arguments.
Helper functions¶
-
multi_currency.management.commands.update_currency_rates.
fix_float_repr
(tag)[source]¶ Replaces ”,” with ”.” so we can convert value to float.
Parameters: tag ( xml.etree.ElementTree.Element
) – xml tag that contains rate as stringReturns str: Fixed string
-
multi_currency.management.commands.update_currency_rates.
get_rates
(command)[source]¶ Main function that make call to external xml api.
Parameters: command ( django.core.management.base.BaseCommand
) – instance of current commandParser makes 3 steps:
- Gets response from bank open api with
urllib
from standart library - Uses
xml.etree.ElementTree
to parse this xml response. - Stores result in
multi_currency.models.Currency
- Gets response from bank open api with