久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

ADAL Python 刷新 PowerBI 數據集

ADAL Python to Refresh PowerBI dataset(ADAL Python 刷新 PowerBI 數據集)
本文介紹了ADAL Python 刷新 PowerBI 數據集的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在 Azure 文檔中發現了一段代碼,它允許在沒有 MFA 的情況下獲取憑據.但我想知道是否可以使用它連接到 PowerBI API.

I found a piece of code on Azure documentation that allows getting credentials without MFA. But I'm wondering if is possible to use it to connect to PowerBI API.

我正在使用的代碼是:

import adal
import requests
from msrestazure.azure_active_directory import AADTokenCredentials

def authenticate_client_key():

    authority_host_uri = 'https://login.microsoftonline.com'
    tenant = 'tenant'
    authority_uri = authority_host_uri + '/' + tenant
    resource_uri = 'https://management.core.windows.net/'
    client_id = 'clientid'
    client_secret = 'client-secret'

    context = adal.AuthenticationContext(authority_uri, api_version=None)
    mgmt_token = context.acquire_token_with_client_credentials(resource_uri, client_id, client_secret)
    credentials = AADTokenCredentials(mgmt_token, client_id)

    return credentials

來源:https://azure.microsoft.com/en-us/resources/samples/data-lake-analytics-python-auth-options/

根據寫在PowerShell上的代碼,目的是將access_token插入到后面的POST請求的header中

According to the code written on PowerShell, the aim is to insert the access_token into the header of the following POST request

POST https://api.powerbi.com/v1.0/myorg/groups/me/datasets/{dataset_id}/refreshes

POST https://api.powerbi.com/v1.0/myorg/groups/me/datasets/{dataset_id}/refreshes

來源:https://powerbi.microsoft.com/en-us/blog/announcing-data-refresh-apis-in-the-power-bi-service/

我嘗試在 POST 請求中使用憑據,但似乎不起作用.

I have tried to use the credentials into the POST request, but seems is not working.

我試過了

url = 'https://api.powerbi.com/v1.0/myorg/groups/me/datasets/datasetid/refreshes'
requests.post(url,data=mgmt_token)

這兩個代碼可以合并嗎?

Is it possible to merge this two codes?

問候,

推薦答案

您可以使用 pypowerbi 包刷新 Power BI 數據集,也可以通過檢查代碼來檢查如何自己執行此操作.https://github.com/cmberryau/pypowerbi

You can use the pypowerbi package to refresh Power BI datasets or you can check how to do it yourself by inspecting the code. https://github.com/cmberryau/pypowerbi

pip install pypowerbi

import adal
from pypowerbi.client import PowerBIClient

# you might need to change these, but i doubt it
authority_url = 'https://login.windows.net/common'
resource_url = 'https://analysis.windows.net/powerbi/api'
api_url = 'https://api.powerbi.com'

# change these to your credentials
client_id = '00000000-0000-0000-0000-000000000000'
username = 'someone@somecompany.com'
password = 'averygoodpassword'

# first you need to authenticate using adal
context = adal.AuthenticationContext(authority=authority_url,
                                     validate_authority=True,
                                     api_version=None)

# get your authentication token
token = context.acquire_token_with_username_password(resource=resource_url,
                                                     client_id=client_id,
                                                     username=username,
                                                     password=password)

# create your powerbi api client
client = PowerBIClient(api_url, token)

# Refresh the desired dataset (dataset and group IDs can be taken from the browser URL)
client.datasets.refresh_dataset(dataset_id='data-set-id-goes-here',
                                notify_option='MailOnCompletion',
                                group_id='group-id-goes-here')

這篇關于ADAL Python 刷新 PowerBI 數據集的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時出現問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節點)
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應并將元素值存儲在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對象)
主站蜘蛛池模板: 国产一区影院 | 国产第1页 | www.久久艹| 日日碰狠狠躁久久躁96avv | 欧美成年人视频在线观看 | 欧美午夜精品理论片a级按摩 | www.久久 | 午夜网站视频 | 成人国产一区二区三区精品麻豆 | 久久精品99 | 激情婷婷成人 | 黄色片免费在线观看 | 一区中文字幕 | 毛片久久久 | 欧美成人激情 | www.日韩免费 | 九九热免费看 | 99在线资源 | 久久久久久久av麻豆果冻 | 中文字幕韩在线第一页 | 国产一区免费视频 | 99免费在线视频 | 国产欧美日韩 | 谁有毛片 | 中文字幕亚洲欧美日韩在线不卡 | 91视频a| 免费精品久久久久久中文字幕 | 狠狠爱网址 | 亚洲视频三 | 亚洲在线一区二区 | 免费国产一区二区 | 射久久 | 日日操夜夜操天天操 | 国产精品一区在线观看 | 日韩国产精品一区二区三区 | 四虎影院在线播放 | 日本午夜网站 | 奇米超碰 | 午夜电影福利 | 久久伊人一区 | 91久久国产综合久久 |