Skip to main content

Easier communication between Microsoft Power BI REST API and a client

Project description

pwerpy

This Python package, makes communication between Microsoft Power BI REST API and a client easier.

Read this in other languages: Español.

Requirements

  • Python >= 3.7 and < 4

Installation

pip install pwerpy

Before Using:

It's mandatory to have these in order to successfully use pwerpy, otherwise, you won't be able to make any request to Power BI REST API:

  • Your Azure Active Directory (AD) Client ID
  • Your Azure AD Username
  • Your Azure AD Password

Usage/Examples

Once you have your client ID and both workspace username and password, you're ready to go!

To get your Azure Active Directory tenant ID (tenant id)

from pwerpy import powerpy

domain_name = 'YOUR_DOMAIN_NAME'

tenant_id = powerpy.get_tenant_id(domain_name)

To get your authentication access token, in order to request your Bearer authorization token

from pwerpy import powerpy

tenant_id = 'YOUR_TENANT_ID'
client_id = 'YOUR_CLIENT_ID'
user = 'YOUR_WORKSPACE_USERNAME'
pwd = 'YOUR_WORKSPACE_PASSWORD'

access_token = powerpy.get_access_token(tenant_id, client_id, user, pwd)

To get your Bearer authorization token

from pwerpy import powerpy

access_token = 'YOUR_ACCESS_TOKEN'

auth = powerpy.get_authorization_token(access_token)

To make a GET request

from pwerpy import powerpy

url = 'YOUR_POWER_BI_REST_API_URL'
auth = 'YOUR_BEARER_AUTHORIZATION_TOKEN'

response = powerpy.get(url, auth)

To make a POST request

from pwerpy import powerpy

url = 'YOUR_POWER_BI_REST_API_URL'
auth = 'YOUR_BEARER_AUTHORIZATION_TOKEN'

response = powerpy.post(url, auth)

These are the essential functions in order to communicate with Power BI REST API successfully.

Functions

powerpy

  • get_tenant_id()
  • get_access_token()
  • get_authorization_token()
  • get()
  • post()

skills

  • get_token_usage()
  • get_datasets_in_group()
  • get_datasets_names_in_group()
  • refresh_dataset_in_group_by_name()
  • refresh_dataset_by_id()

License

Pwerpy is licensed under the MIT license.

Copyright © 2022, Fernando Assef (4ssef)

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

pwerpy-1.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pwerpy-1.0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pwerpy-1.0.1.tar.gz.

File metadata

  • Download URL: pwerpy-1.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.9

File hashes

Hashes for pwerpy-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d8e394bf4cb0b863261591a71aa8982ca67541c03cb5c74d888d1e77e86cde96
MD5 e16faba6aac7e3c0c977483df77707fd
BLAKE2b-256 2c5644e899ab23e103628306a83c51222626d6bb608b88fe050fffe78c92a26e

See more details on using hashes here.

File details

Details for the file pwerpy-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pwerpy-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.9

File hashes

Hashes for pwerpy-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d78a5270da9a31a63cb701e4dbcadd2cd3fccbf26532e5bed6ec4941e73a82d3
MD5 04eafcc81b24df74cb6aad832da85253
BLAKE2b-256 0514ecd8961bcfa3e9c52e058fb203d75f4fb595bda20c9a4c0c58b710daaaf8

See more details on using hashes here.

Supported by

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