Open pawamoy opened 5 months ago
I was able to fix it on my end with this:
from safety.auth.cli_utils import build_client_session
client_session, _ = build_client_session()
vulns, db_full = check(session=client_session, packages=packages, ignore_vulns=ignore_vulns)
Entanglement with Click did not make this easy to find :sweat:
Description
I'm using
safety
programmatically:It fails with the following traceback:
The
check
method has a default value ofNone
for thesession
parameter, but that default value causes thefetch_database
function to raise anAttributeError
since it doesn't check if it'sNone
before trying to accessis_using_auth_credentials
on it.Previously, on v2, the above code worked. I understand that I can expect breaking changes going from v2 to v3, but maybe this particular issue was an oversight and can be solved on your side. Let me know! I can also fix my own code to instantiate a session myself and provide it to the
check
function. By the way what is the type of thissession
object?