Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Friends,
I am writing first python script in Power BI but but I get some nasty error which goes over my head.
Here is my script
import requests
import pandas as pd
# Set the request parameters
url = 'https://myinstance.xyz-wow.com/api/now/table/incident'
user = 'abc'
password = 'xyz'
headers = {"Content-Type": "application/json", "Accept": "application/json"}
# Do the HTTP request within a try-except block to handle potential errors
try:
response = requests.get(url, auth=(user, password), headers=headers)
response.raise_for_status() # This will raise an exception for HTTP errors
data = response.json()
# Since Power BI expects a DataFrame, we'll convert the resulting data to a DataFrame
# It is assumed data['result'] contains the records you want to display
df = pd.DataFrame(data['result'])
# Output the DataFrame into Power BI
# Please note that the last dataframe in the script will be the one imported into Power BI
df
except requests.exceptions.RequestException as e:
print(f'An error occurred: {e}')
This is what I am getting for it
Solved! Go to Solution.
Hi @smerugu28
There could be various reasons for the error message you attached.
Please refer to the linked discussions about similar challenges :
https://stackoverflow.com/questions/58522535/ado-net-error-trying-to-run-python-script-in-powerbi
And the linked videos:
https://www.youtube.com/watch?v=5D0BkNsu5CM
https://www.youtube.com/watch?v=fd7OYfeSGXE
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Thank you for your prompt reply! @Ritaf1983
Hi @smerugu28
Ensure that the API endpoint is accessible with the credentials you're using. You can do this by attempting to access the URL directly in a web browser or using a tool like Postman.
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for your prompt reply! @Ritaf1983
Hi @smerugu28
Ensure that the API endpoint is accessible with the credentials you're using. You can do this by attempting to access the URL directly in a web browser or using a tool like Postman.
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @smerugu28
There could be various reasons for the error message you attached.
Please refer to the linked discussions about similar challenges :
https://stackoverflow.com/questions/58522535/ado-net-error-trying-to-run-python-script-in-powerbi
And the linked videos:
https://www.youtube.com/watch?v=5D0BkNsu5CM
https://www.youtube.com/watch?v=fd7OYfeSGXE
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
User | Count |
---|---|
72 | |
70 | |
37 | |
23 | |
22 |
User | Count |
---|---|
96 | |
94 | |
50 | |
42 | |
40 |