Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Abha
Frequent Visitor

Power-bi: Python Requests package doesn't work on powerbi Service, throws module not found error.

Hi,

 

We need to make API call using python script in powerbi, for which we needed to add python import requests package which works well in powerbi desktop but on powerbi service it gives "ModuleNotFounError:No module named 'requests"

 

Can you please help why python requests package in not supported on service and what is alternative to make it work?

Looking forward to hear from you!!

 

 

4 REPLIES 4
Anonymous
Not applicable

Hi @Abha ,

 

According to the official documentation, the requests package is not supported in the Power BI service. This is because the service doesn't support Python packages that provide client-server queries over the World-Wide Web for security and privacy reasons.

As an alternative, you can try to use the urllib package, which is a built-in Python module for handling URLs. You can use it to make HTTP requests and parse the response data. Here is an example of how to use it in Power BI Desktop:

```python
import urllib.request
import pandas as pd

# Define the API endpoint
url = "https://api.exchangeratesapi.io/latest"

# Make a GET request and read the response
response = urllib.request.urlopen(url)
data = response.read()

# Convert the response data to a pandas DataFrame
df = pd.read_json(data)

# Extract the rates as a list of tuples
rates = list(df["rates"].items())

# Create a new DataFrame with the rates
rates_df = pd.DataFrame(rates, columns=["Currency", "Rate"])
```

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Thanks for responding.

the urllib also gives error on service: urllib.error.URLError

Anonymous
Not applicable

Hi @Abha ,

 

Try it.

import urllib.request

url = "https://example.com/api/endpoint"
response = urllib.request.urlopen(url)
data = response.read().decode("utf-8")

Replace the url variable with the API endpoint you want to call.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

I'm facing this same problem and I tried using urllib instead of requests but no luck.  Still blocked for python visuals in PBI service.  Has anybody found a workaround?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.