From d0bd294dc2aa1a7b5c08616bc1c802346aaf60d4 Mon Sep 17 00:00:00 2001 From: saxenabhishek Date: Mon, 14 Mar 2022 05:33:44 +0530 Subject: [PATCH] feat: slower alternative for get_required_deps --- bench/utils/app.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bench/utils/app.py b/bench/utils/app.py index eedd2400..434af655 100644 --- a/bench/utils/app.py +++ b/bench/utils/app.py @@ -171,9 +171,14 @@ def get_required_deps(org, name, branch, deps="hooks.py"): import requests import base64 - url = f"https://api.github.com/repos/{org}/{name}/contents/{name}/{deps}" + git_api_url = f"https://api.github.com/repos/{org}/{name}/contents/{name}/{deps}" params = {"branch": branch or "develop"} - res = requests.get(url=url, params=params).json() + res = requests.get(url=git_api_url, params=params).json() + + if "message" in res: + git_url = f"https://raw.githubusercontent.com/{org}/{name}/{params['branch']}/{deps}" + return requests.get(git_url).text + return base64.decodebytes(res["content"].encode()).decode()