You can easily connect and access OLAP cubes with the help of python package xmla. xmla plays a vital role in communicating with OLAP and performs all functions with the cubes.
Install xmla package either by
python -m pip install xmla --user
or
python -m venv xmlaenv
# python -m venv --without-pip xmlenv - use if the above commands throws error
cd xmlaenv
source bin/activate
git clone https://github.com/may-day/olap
cd olap/xmla
# optional if you have it already
pip install pipenv
pipenv install -dev
python setup.py develop
After installation, Connect to OLAP XMLA Cubes using location, username and password parameters.
import olap.xmla.xmla as xmla
provider = xmla.XMLAProvider()
connect = provider.connect(location='http://localhost/OLAP/msmdpump.dll',
username = 'test', password = 'test')
source = connect.getOLAPSource()