0

I am using Django 2.2.10 and using python manage.py runsslserver to locally develop an https site.

I have written an authentication app, with view function that returns JSON data as ff:

def foobar(request):
    data = {
            'param1': "foo bar"
        }

    return JsonResponse(data)

I am calling this function in the parent project as follows:

def index(request):    
    scheme_domain_port = request.build_absolute_uri()[:-1]
    myauth_login_links_url=f"{scheme_domain_port}{reverse('myauth:login_links')}"

    print(myauth_login_links_url)
    
    data = requests.get(myauth_login_links_url).json()
    
    print(data)

When I navigate to https://localhost:8000myproj/index, I see that the correct URL is printed in the console, followed by multiple errors, culminating in the error shown in the title of this question:

HTTPSConnectionPool(host='localhost', port=8000): Max retries exceeded with url:/index (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))

How do I pass the SSL cert being used in my session (presumably generated by runsslserver to the requests module) ?

Homunculus Reticulli
  • 65,167
  • 81
  • 216
  • 341
  • 1
    Does this answer your question? [SSL HTTS requests.exceptions.SSLError: HTTPSConnectionPool(host='google.com', port=443)](https://stackoverflow.com/questions/51768496/ssl-htts-requests-exceptions-sslerror-httpsconnectionpoolhost-google-com-po) – Jaydeep Jul 28 '20 at 17:22
  • Yeah, that pretty much answers my question. Not sure whether to delete/close my question now that @zero has answered it :/ – Homunculus Reticulli Jul 28 '20 at 17:24

1 Answers1

1

try this:

data = requests.get(myauth_login_links_url, verify=False).json()
Jaydeep
  • 775
  • 2
  • 8
  • 14