Skip to main content

The Unofficial Python API wrapper for the Microsoft Power BI REST API.

Project description

Unofficial Power Bi Python API

Table of Contents

Overview

Version: 0.1.2

Power BI is a business analytics service by Microsoft. It aims to provide interactive visualizations and business intelligence capabilities with an interface simple enough for end users to create their own reports and dashboards. It is part of the Microsoft Power Platform. This library allows you to use the Power BI Rest API from python. Along with providing the different endpoints, it will also handle the authentication process for you.

Resources

Setup

Setup - Requirements Install:

For this particular project, you only need to install the dependencies, to use the project. The dependencies are listed in the requirements.txt file and can be installed by running the following command:

pip install -r requirements.txt

After running that command, the dependencies should be installed.

Setup - Local Install:

If you are planning to make modifications to this project or you would like to access it before it has been indexed on PyPi. I would recommend you either install this project in editable mode or do a local install. For those of you, who want to make modifications to this project. I would recommend you install the library in editable mode.

If you want to install the library in editable mode, make sure to run the setup.py file, so you can install any dependencies you may need. To run the setup.py file, run the following command in your terminal.

pip install -e .

If you don't plan to make any modifications to the project but still want to use it across your different projects, then do a local install.

pip install .

This will install all the dependencies listed in the setup.py file. Once done you can use the library wherever you want.

Setup - PyPi Install:

To install the library, run the following command from the terminal.

pip install python-power-bi

Setup - PyPi Upgrade:

To upgrade the library, run the following command from the terminal.

pip install --upgrade python-power-bi

Usage

Here is a simple example of using the powerbi library.

from pprint import pprint
from configparser import ConfigParser
from powerbi.client import PowerBiClient

# Initialize the Parser.
config = ConfigParser()

# Read the file.
config.read('config/config.ini')

# Get the specified credentials.
client_id = config.get('power_bi_api', 'client_id')
redirect_uri = config.get('power_bi_api', 'redirect_uri')
client_secret = config.get('power_bi_api', 'client_secret')

# Initialize the Client.
power_bi_client = PowerBiClient(
    client_id=client_id,
    client_secret=client_secret,
    scope=['https://analysis.windows.net/powerbi/api/.default'],
    redirect_uri=redirect_uri,
    credentials='config/power_bi_state.jsonc'
)

# Initialize the `Dashboards` service.
dashboard_service = power_bi_client.dashboards()

# Add a dashboard to our Workspace.
dashboard_service.add_dashboard(name='my_new_dashboard')

# Get all the dashboards in our Org.
pprint(dashboard_service.get_dashboards())

Support These Projects

Patreon: Help support this project and future projects by donating to my Patreon Page. I'm always looking to add more content for individuals like yourself, unfortuantely some of the APIs I would require me to pay monthly fees.

YouTube: If you'd like to watch more of my content, feel free to visit my YouTube channel Sigma Coding.

Questions: If you have questions please feel free to reach out to me at coding.sigma@gmail.com

Project details


Download files

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

Source Distribution

python-power-bi-0.1.2.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

python_power_bi-0.1.2-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file python-power-bi-0.1.2.tar.gz.

File metadata

  • Download URL: python-power-bi-0.1.2.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.10

File hashes

Hashes for python-power-bi-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3cb1d7e53e8e54dae0fd39d6b31f6090daa375848058636f5b1b773a6e7738f3
MD5 be6a519810f0492c8f2e6d7a1d590fe6
BLAKE2b-256 b101c009129f3ed1be52e1dc68fec5e81955d79ae494b351ecaf53ad8904e731

See more details on using hashes here.

File details

Details for the file python_power_bi-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: python_power_bi-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.10

File hashes

Hashes for python_power_bi-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 412b15f601bd1e1a495271badd327f38a2dedd4614126221f39ac14d85b0f979
MD5 f84fbdda7a71876414c2324f4fe3fef4
BLAKE2b-256 e17813b4a8740cb0fcfa09f0326275341b795be4078db484a127788f5ac25abe

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page