Skip to content

Instantly share code, notes, and snippets.

View casperlehmann's full-sized avatar

Casper Lehmann casperlehmann

View GitHub Profile
TOKEN = 'XXX'
REPORT_ID = 'YYY'
GROUP_ID = 'ZZZ'
delete_url = f'https://api.powerbi.com/v1.0/myorg/groups/{GROUP_ID}/reports/{REPORT_ID}'
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + TOKEN
}
res = requests.post(delete_url, headers=headers)
@casperlehmann
casperlehmann / power_bi_report_change_dataset.py
Created January 25, 2019 11:31
Script to change dataset for a Power BI report
import requests
import adal
import json
# Parameters:
GROUP_ID = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
# AAD Client ID -- To get this, go here: https://dev.powerbi.com/apps
CLIENT_ID = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
AUTHENTICATION_URL = 'https://login.microsoftonline.com/egmont.onmicrosoft.com'
#! -*- coding:utf8 -*-
def generate_inverse_transformations(left,right):
return (
lambda left: {
'uuid': left.get('key'),
'first_name': left.get('name').get('first'),
'last_name': left.get('name').get('last'),
'triple_tuples': [x for x in left.get('triples').items()],
'opposites': [{'first': x, 'second': y} for x,y in left.get('opposites')]
@casperlehmann
casperlehmann / Kivy_stop_watch
Last active June 30, 2022 13:52
Stop watch implemented with kivy.clock.Clock
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import NumericProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.clock import Clock
Builder.load_string('''
<MainWidget>:
BoxLayout:
orientation: 'vertical'