Python HTTPS POST request(to API) response with status 200 but the data is not generate in the API Document

448 Views Asked by At

I'm trying to post request using python, The status code is 200 but the object doesn't create on the server. In other words, I am trying to post data to API document, but the post does not generate in the API hostname, despite to 200 ok (status code).

  headers2 = {
        'user': 'myuser',
        'Version': '10.0',
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'Authorization': 'Bearer MyKey'
    }

for link in url_to_upload:
    data = {"name": "Malicious Links", "value": link, "source": "API Script"}
    req = requests.post('https://api_hostname/api/reference_data/sets', headers=headers2, data=data, verify=False)
    if req.status_code == 200:
        continue
    else:
        print("Hey There! I'm sorry, but there's a problem with posting it")
0

There are 0 best solutions below