1

I'm using requests to post data to this Auth0 api, here's the code

@receiver(post_save, sender=OrgUser)
def user_is_created(sender, instance, created, **kwargs):
    if created:
        full_name = instance.full_name
        first_name = instance.first_name
        last_name = instance.last_name
        email = instance.email
        cell = instance.cell
        password = ''.join(random.choices(string.ascii_uppercase + string.digits, k=15))
        url = "https://127.0.0.1:8080/dbconnections/signup"
        user_data = {
            'client_id': config("APP_CLIENT_ID"),
            'connection': config("DATABASE_CONNECTION"),
            'full_name': full_name,
            'first_name': first_name,
            'last_name': last_name,
            'email': email,
            'password': password,     
            'cell': cell,
        }
        r = requests.post(url, json = user_data, headers = {'User-agent': 'your bot 0.1'}, verify=False)
    else:
        pass

I'm getting the following erroe message

requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /dbconnections/signup (Caused by SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:1091)')))

I searched for similar questiones but nothings helped so far.

I also have these two lines in the terminal after runnig the code

[07/Oct/2022 15:08:12] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x01\x00Ý\x01\x00\x00Ù\x03\x03}\x9aP\x98|9\x9eÁ±XÀ\x97C)G@¶\x880G\x80õ\x87u÷,\'"µ\x96ü@\x00\x00bÀ0À,À/À+\x00\x9f\x00\x9eÀ2À.À1À-\x00¥\x00¡\x00¤\x00')
[07/Oct/2022 15:08:12] You're accessing the development server over HTTPS, but it only supports HTTP.

2 Answers2

1

This error can come about when an outdated version of pyOpenSSL exists within an environment. It may be worthwhile to to uninstall pyOpenSSL if the version is old and and reinstall reinstall a newer version.

Similar problem: https://github.com/psf/requests/issues/4246

Tanner
  • 171
  • 1
  • 12
1

I fixed it. In my url I instead of

"https://127.0.0.1:8080/dbconnections/signup"

I had to put

"https://my-auth0-domain/dbconnections/signup"