In fact, the problem is with SSL, if your server uses the https method, then you need to add the following line to requests.post
r = requests.post(api_url, data = {"var 1":"value", "var 2":"value"}, verify=True)
Also make sure your api_url includes https not http
I wrote a small function for this
def get_base_url(request): host = get_host(request) if request.is_secure(): return '{0}{1}/{2}'.format('https://', host, 'url') else: return '{0}{1}/{2}'.format('http://', host, 'url')
source share