Calling a HTTPS Rest API from a python script



I’m trying to call an HTTPS url from a python script using this code:

from NSCP import Settings, Registry, Core, log, log_err, status
import requests
import json
import socket

nsclient_url = 'https://localhost:8443/'
ords_url = 'https://localhost:8555/ords/'

def oauth_gettoken():
	ords_auth = ords_url + 'cyrille/oauth/token'
	irds_client = '*********************..'
	irds_secret = '*********************..'
	data = {'grant_type':'client_credentials'}
	request =, data=data, auth=(irds_client,irds_secret), verify=False)
	if request.status_code == 404:
		log("Wrong authentication url specified, unable to get token from ORDS")
	if request.status_code == 500:
		log("Internal server error received, unable to get token from ORDS")
	if request.status_code == 200:
		json_result = request.json()
		token = json.dumps(json_result["access_token"])
		return token
	return 0

This grives me the following error:

  File "C:/Program Files/NSClient++/scripts/python/lib\requests\", line 497, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

What’s the proper way to enable the SSL module?