<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Push API get request with Python in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Push-API-get-request-with-Python/m-p/3047820#M40942</link>
    <description>&lt;P&gt;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests
import msal

app_id = ''
tenant_id = ''

username = ''
password = ''

authority_url = f'https://login.microsoftonline.com/{tenant_id}'
scopes = [r'https://analysis.windows.net/powerbi/api/.default']

client = msal.PublicClientApplication(app_id, authority=authority_url)
response = client.acquire_token_by_username_password(username, password, scopes)
access_id = response.get('access_token')

endpoint = 'https://api.powerbi.com/v1.0/myorg/groups'
headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Bearer {access_id}'
}
response_request = requests.get(endpoint, headers=headers)

if response_request.status_code == 200:
    result = response_request.json()
    for item in result['value']:
        print(item['name'])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jan 2023 19:00:37 GMT</pubDate>
    <dc:creator>AntrikshSharma</dc:creator>
    <dc:date>2023-01-27T19:00:37Z</dc:date>
    <item>
      <title>Push API get request with Python</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Push-API-get-request-with-Python/m-p/3045047#M40907</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a python program that posts data via requests.post using the Push URL. This works fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to request.get with a get URL? This would allow me to check what data I already have in the push dataset on Power BI and only post the new data, for example if the program stopped working in the middle of the day.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 12:55:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Push-API-get-request-with-Python/m-p/3045047#M40907</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-26T12:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Push API get request with Python</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Push-API-get-request-with-Python/m-p/3047820#M40942</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests
import msal

app_id = ''
tenant_id = ''

username = ''
password = ''

authority_url = f'https://login.microsoftonline.com/{tenant_id}'
scopes = [r'https://analysis.windows.net/powerbi/api/.default']

client = msal.PublicClientApplication(app_id, authority=authority_url)
response = client.acquire_token_by_username_password(username, password, scopes)
access_id = response.get('access_token')

endpoint = 'https://api.powerbi.com/v1.0/myorg/groups'
headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Bearer {access_id}'
}
response_request = requests.get(endpoint, headers=headers)

if response_request.status_code == 200:
    result = response_request.json()
    for item in result['value']:
        print(item['name'])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 19:00:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Push-API-get-request-with-Python/m-p/3047820#M40942</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2023-01-27T19:00:37Z</dc:date>
    </item>
  </channel>
</rss>

