I'm getting missing 1 required positional argument on the code below. I tried different stuffs but no luck. I believe it is a small detail that I'm missing but since I'm a beginner on Python and I'm not being able to fix it myself.
import requests
from flask import Flask, jsonify, request, render_template
import os
app = Flask(__name__)
@app.route('/outages')
def map_status(data):
url = "https://my-api.local.com/data"
response = requests.get(url)
result_data = json.loads(response.text)
if(data['install_status']=='1'):
data['install_status']='Installed'
elif(data['install_status']=='3'):
data['install_status']='Maintenance'
return data
result_data['result']=map(map_status,result_data['result'])
return(list(result_data['result']))
This is the error I'm getting:
[ERR] TypeError: map_status() missing 1 required positional argument: 'data'
If I change the return for print, it works, but on this case I need to use return to get the data.