user2492364
user2492364

Reputation: 6713

Django call https : [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

I have to call a api(requests.post(https://192.168.16.10:8443/api/data,json=data)) in my django .
It's https ,so I install django-sslserver

to run django with https

But I got error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

What else should I set??

I try to call https://192.168.16.10:8443/api/data directly by Postman , It works well.
It's the django problem

Upvotes: 2

Views: 9190

Answers (2)

Rupesh Kumar
Rupesh Kumar

Reputation: 15

you can use this command to skip this step

pip install djangorestframework --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org

Upvotes: 0

Selcuk
Selcuk

Reputation: 59445

If you are using a self-signed certificate you can skip certificate verification:

requests.post("https://192.168.16.10:8443/api/data", verify=False)

See requests documentation on SSL verification for details.

Warning: This will reduce the security of SSL as @KlausD pointed out and should be used as a last resort.

Upvotes: 4

Related Questions