So im trying to POST to my python rest server but i cant get this right. The goal is to send a list from the client to server and when received check if objcects of that list already exist in another, and if not, to append them to the existing list. Heres my code:
Server:
from flask import Flask, request jsonify
import requests, json
app = Flask(__name__)
url = "http://0.0.0.0:5000"
list = ["1","2","3","4"]
IPs2 = []
@app.route('/')
def index():
     return "Hello"
@app.route('/list/', methods=['GET','POST'])
def get_tasks():
    if request.method == 'GET':
        return jsonify(list)
    if request.method == 'POST':
        IPs2 = request.json(IPs)
        for i in IPs2:
            if i not in list
                list.append(i)
if __name__ == '__main__':
app.run(host="0.0.0.0", port = 5000,debug=True)
client:
import json 
import requests
IPs = ["4", "5"]
api_url = 'http://0.0.0.0:5000/list/'
r = requests.post(url = api_url, json=IPs)
 
     
    