in gha_scanner/__init__.py [0:0]
def fetch_flow(self, commit, w_data):
try:
rawUrl = "https://raw.githubusercontent.com/apache"
self.logger.log.debug(
"Fetching %s/%s/%s/%s"
% (rawUrl, commit["project"], commit["sha"], w_data["path"])
)
r = self.s.get(
"%s/%s/%s/%s"
% (rawUrl, commit["project"], commit["sha"], w_data["path"])
)
r_content = yaml.safe_load(
"\n".join(
[
line
for line in r.content.decode("utf-8").split("\n")
if not re.match(r"^\s*#", line)
]
)
)
except (KeyError, TypeError, yaml.parser.ParserError) as e:
self.logger.log.critical(e)
return None
self.logger.log.debug(r_content.keys())
if 404 in r_content.keys():
self.logger.log.error(
"%s doesn't exist in %s" % (w_data["path"], commit["hash"])
)
return None
self.logger.log.debug("retrieved: %s" % w_data["path"])
return r_content