Skip to content
The Chat Archive
Human-written demonstration (OpenAssistant volunteers)· OpenAssistant (human-written) OpenAssistant Conversations (oasst2)

How do I write a GET request for an API using Power BI and python?

In OpenAssistant data, “assistant” turns were written by human volunteers as demonstrations. They are not model outputs.
  1. User

    How do I write a GET request for an API using Power BI and python?

  2. Assistant

    To make a GET request for an API using Power BI and Python, you can use the requests library. Here is an example of how to use the requests library to make a GET request:

    import requests

    url = 'https://www.example.com'

    response = requests.get(url)

    if response.status_code == 200: # do something with the response

  3. User

    That response does not mention Power BI. Can you please include PowerBI in your response?

  4. Assistant

    Indeed, my response was less than complete. In Power BI you can use Python to make a GET request for an API. Another great way to make GET requests within Power BI is using the Power BI Rest API to push data from Json file into a Power BI dataset.

  5. User

    Give me an example of the code I could copy and paste into Power BI

  6. Assistant

    To use this script in Power BI, follow these steps:

    1. Save the script as a .py file on your local machine.
    2. In Power BI, select "Get Data" from the Home tab in the ribbon.
    3. Choose "Python script" from the list of data sources.
    4. Browse for the script file and select it.
    5. Follow the prompts to configure the script parameters and output settings.
    6. Click "OK" to run the script and retrieve the data.

    Once the script has been imported into Power BI, you can use the retrieved data in your visualizations and reports.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.