Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Wrapper for The Central Bank of the Russian Federation site API

Project description


Обертка для работы с API Центробанка

Wrapper for The Central Bank of the Russian Federation site API

Build Status PyPI version

Site and API of The Central Bank of the Russian Federation.


Stable version:

    pip install cbrf

Dev version:

    git clone
    cd cbrf
    pip install -e .


For using with your own hostname set environment variables, for example

export CBRF_URL_SCHEME=http

How to use


To get raw XML answers you should use cbrf.api methods:

>>> import cbrf

>>> cbrf.get_currencies_info()
<Element 'Valuta' at 0x10b91f688>

>>> cbrf.get_daily_rates()
<Element 'ValCurs' at 0x10b82b9a8>

>>> date_1 = datetime(2001, 3, 2)
>>> date_2 = datetime(2001, 3, 14)
>>> get_dynamic_rates(date_req1=date_1, date_req2=date_2, currency_id='R01235')
<Element 'ValCurs' at 0x1107017c8>


Also you can user base models for work with API (see examples in the tests).


>>> from cbrf.models import CurrenciesInfo

>>> c_info = CurrenciesInfo()
>>> c_info.get_by_id("R01305").name
'Ирландский фунт'
>>> c_info.get_by_id("R01305").eng_name
'Irish Pound'


>>> from cbrf.models import DailyCurrenciesRates

>>> daily = DailyCurrenciesRates()
datetime.datetime(2017, 3, 11, 0, 0)
>>> daily.get_by_id('R01035').name
'Фунт стерлингов Соединенного королевства'
>>> daily.get_by_id('R01035').value


>>> from cbrf.models import DynamicCurrenciesRates

>>> date_1 = datetime(2001, 3, 2)
... date_2 = datetime(2001, 3, 14)
... id_code = 'R01235'
>>> dynamic_rates = DynamicCurrenciesRates(date_1, date_2, id_code)
>>> dynamic_rates.get_by_date(datetime(2001, 3, 8)).value


To run tests:

pytest cbrf/ 

You should install pytest first


Bug reports, bug fixes, and new features are always welcome. Please open issues, and submit pull requests for any new code.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cbrf, version 0.4.7
Filename, size File type Python version Upload date Hashes
Filename, size cbrf-0.4.7.tar.gz (6.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page