Cannot overwrite attribute __setattr__ in class CompressionScanResult
yusufalper opened this issue · comments
Installed sslyze with pip, When I try below code to start a scan(copying from docs), I am getting a error. I am not sure if this is library related but I can't fix it with trying again and again.
the code:
from sslyze import ServerScanRequest
from sslyze.server_setting import ServerNetworkLocation
from sslyze.errors import ServerHostnameCouldNotBeResolved
try:
all_scan_requests = [
ServerScanRequest(server_location=ServerNetworkLocation(hostname="cloudflare.com")),
ServerScanRequest(server_location=ServerNetworkLocation(hostname="google.com")),
]
except ServerHostnameCouldNotBeResolved:
# Handle bad input ie. invalid hostnames
print("Error resolving the supplied hostnames")
the error:
Traceback (most recent call last):
File "sslyze_test.py", line 1, in <module>
from sslyze import ServerScanRequest
File "local/lib/python3.7/site-packages/sslyze/__init__.py", line 23, in <module>
from sslyze.plugins.scan_commands import ScanCommand
File "local/lib/python3.7/site-packages/sslyze/plugins/scan_commands.py", line 8, in <module>
from sslyze.plugins.compression_plugin import CompressionImplementation
File "local/lib/python3.7/site-packages/sslyze/plugins/compression_plugin.py", line 35, in <module>
CompressionScanResultAsJson = pydantic.dataclasses.dataclass(CompressionScanResult, frozen=True)
File "pydantic/dataclasses.py", line 231, in pydantic.dataclasses.dataclass
)
File "pydantic/dataclasses.py", line 218, in pydantic.dataclasses.dataclass.wrap
# When cls._FIELDS is filled in with a list of Field objects, the name
File "python3.7/dataclasses.py", line 1010, in dataclass
return wrap(_cls)
File "python3.7/dataclasses.py", line 1002, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
File "python3.7/dataclasses.py", line 963, in _process_class
raise TypeError(f'Cannot overwrite attribute {fn.__name__} '
TypeError: Cannot overwrite attribute __setattr__ in class CompressionScanResult
- OS: Amazon Linux EC2
- Python version: python3.7
Since pydantic v1.10.3
Since pydantic v1.10.3
can you give any suggestion? what should i do?
For now, you can explicitly install pydantic 1.10.2, and continue using SSLyze until this issue is resolved (either by SSLyze or pydantic).
Fix released as part of v5.1.0