|
class SecurityAndAnalysis(NonCompletableGithubObject): |
There is a type mismatch in the SecurityAndAnalysis class mapping for the secret_scanning_ai_detection attribute. The class defines this attribute as expecting a string (Attribute[str]), but the GitHub REST API actually returns a nested dictionary object ({"status": "enabled"}). This causes a BadAttributeException whenever the property is read.
Environment
PyGitHub Version: 2.9.1
Python Version: 3.12
Steps to Reproduce
from github import Auth, Github
gh = Github(auth=Auth.Token(YOUR_TOKEN))
repo = gh.get_repo("your-org/your-repo")
# Triggers BadAttributeException
print(repo.security_and_analysis.secret_scanning_ai_detection)
Stack Trace / Error Log
File "site-packages\github\SecurityAndAnalysis.py", line 104, in secret_scanning_ai_detection
return self._secret_scanning_ai_detection.value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "site-packages\github\GithubObject.py", line 222, in value
raise BadAttributeException(self.__value, self.__expectedType, self.__exception)
github.GithubException.BadAttributeException: ({'status': 'enabled'}, <class 'str'>, None)
Root Cause Analysis
In SecurityAndAnalysis.py, the attribute initialization is defined as:
self._secret_scanning_ai_detection: Attribute[str] = NotSet
However, the payload received from GitHub is actually:
"secret_scanning_ai_detection": {
"status": "enabled"
}
PyGithub/github/SecurityAndAnalysis.py
Line 51 in 7806e7d
There is a type mismatch in the
SecurityAndAnalysisclass mapping for thesecret_scanning_ai_detectionattribute. The class defines this attribute as expecting a string (Attribute[str]), but the GitHub REST API actually returns a nested dictionary object ({"status": "enabled"}). This causes aBadAttributeExceptionwhenever the property is read.Environment
PyGitHub Version: 2.9.1
Python Version: 3.12
Steps to Reproduce
Stack Trace / Error Log
Root Cause Analysis
In
SecurityAndAnalysis.py, the attribute initialization is defined as:However, the payload received from GitHub is actually: