0

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")
shb
  • 5,957
  • 2
  • 15
  • 32
hazehav
  • 1
  • 1

0 Answers0