-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathuse_dataflows.py
More file actions
29 lines (23 loc) · 924 Bytes
/
use_dataflows.py
File metadata and controls
29 lines (23 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Used to demonstrate the usage of the `Dataflows` service."""
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,
# You need to make sure you request this permission, but you can't have it
# with the `.default` scope.
scope=["https://analysis.windows.net/powerbi/api/Pipeline.ReadWrite.All"],
redirect_uri=redirect_uri,
credentials="config/power_bi_state.jsonc",
)
# Initialize the `Dataflows` service.
dataflows_service = power_bi_client.dataflows()