1

I got the following error

AttributeError: 'module' object has no attribute '_create_unverified_context'.

I'm using Python 3.4.2 .

My code:

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

When I run this code, the error happens._create_unverified_context can be used in Python 3.4.2, so I really cannot understand why this error happens. How should I fix this? Traceback says

Traceback (most recent call last):
  File "quickstart.py", line 3, in <module>
    ssl._create_default_https_context = ssl._create_unverified_context()
AttributeError: 'module' object has no attribute '_create_unverified_context'

2 Answers 2

0

Are you sure _create_verified_context is an attribute and not a method? Have you tried:

import ssl
ssl._create_default_https_context = ssl._create_unverified_context()
Sign up to request clarification or add additional context in comments.

6 Comments

Actually, I do not think so. You cannot have the same error so please post you error.
I added my full traceback
Even if it is a method why would you call it? Also ssl is a module not a class.
My bad, I was not checking that you are using Python3.4. As far as I know, _create_unverified_context exists in Python3.6 but is not supported in Python3.4. You can check yourself by looking at Lib\ssl.py.
@t.m.adam So,how should I fix this?
|
-1

This error occurs if:

  • python version is less than 2.7 i
  • if the module being used isn't compatible with the python version being used

    Faced same issue when using module "pysphere" with python 2.7.3.

Just commenting out the line "ssl._create_default_https_context = ssl._create_unverified_context()" in the piece of code i had, worked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.