I would like to convert a request from Python code to M used in Power BI Power Query
My Python code is
\\
import requests import datetime as dt
headers = {'Authorization': 'Bearer tok_123', 'Accept': 'text/csv'}
url = 'https://api.123/'
params = ( ('start_time', start_date), ('end_time', tomorrow), )
response = requests.get(url, headers=headers, params=params)
data = response.text
\\
The M code I have made (which does not work) is below. Could you let me know where I am going wrong?
Am getting error 400 invalid request. I think there is something wrong with the way I am translating params.
\\
let
apiUrl = "https://api.123/", options = [Headers =[#"Authorization"="Bearer tok_123", #"start_time"="2021-01-05", #"end_time"="2021-02-05"]], result = Web.Contents(apiUrl , options)
in
result
\\
Thanks
print(response.text){orprint(data)}? - Michal Palko