Skip to main content
1 de 2

NameError: name ‘workshop’ is not defined

me parece el error NameError: name ‘workshop’ is not defined

código:

def all_reports(app,workshop):
    reportes=[]
    # print(session)
    print(workshop)
    for i in workshop:
        if i['type'] == 'Workspace':
            url=f"https://api.powerbi.com/v1.0/myorg/groups/{i['id']}/reports"
            api_response = requests.get(url, headers=get_request_header(app))
    if api_response.status_code != 200:
        abort(api_response.status_code, description=f'Error while retrieving Embed URL\n{api_response.reason}:\t{api_response.text}\nRequestId:\t{api_response.headers.get("RequestId")}')
    api_response = json.loads(api_response.text)
    for a in api_response['value']:
        dic2={'id_workshop':i['id'],'id_report':a['id'], 'name_report':a['name'] }
    reportes.append(dic2)
    print(dic2)

@app.route('/allworkshop')
def reporte():
     return all_reports(app,workshop)

Donde debo definir el parámetro workshop? el error lo marca en la ultima línea.