Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot overwrite attribute __setattr__ in class CompressionScanResult #586

Closed
yusufalper opened this issue Jan 3, 2023 · 4 comments · Fixed by #587
Closed

Cannot overwrite attribute __setattr__ in class CompressionScanResult #586

yusufalper opened this issue Jan 3, 2023 · 4 comments · Fixed by #587

Comments

@yusufalper
Copy link

yusufalper commented Jan 3, 2023

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
@mwoodbri
Copy link

mwoodbri commented Jan 3, 2023

Since pydantic v1.10.3

@yusufalper
Copy link
Author

Since pydantic v1.10.3

can you give any suggestion? what should i do?

@KramNamez
Copy link
Contributor

For now, you can explicitly install pydantic 1.10.2, and continue using SSLyze until this issue is resolved (either by SSLyze or pydantic).

@nabla-c0d3
Copy link
Owner

Fix released as part of v5.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
4 participants