As part of our CI/CD we want to add some check to run code on python files and check if there are some secrets in code (like API, passwords etc.). I saw only programs that do this, and I want to create a Python script that does it.
Does anyone have some suggestion or example for this?
I'm not sure it exactly what you look for but you can use GitGuardian API,
The GitGuardian API puts at your fingertips the power to detect more than 200 types of secrets in any text content, as well as other potential security vulnerabilities.
py-gitguardian can be used to create integrations to scan various data sources, from your workstation's filesystem to your favorite chat application.
You can check API details here with all the response codes and expected structures on each method.
just take a look GitGuardian/py-gitguardian Github repository, You can also check this Youtube video that will help you implement this.
Good luck.