Update get_repo_settings in bitbucket_provider.py to fetch file via API request

This commit is contained in:
Ori Kotek
2023-10-30 18:36:46 +02:00
parent 4bda9dfe04
commit 73bb70fef4

View File

@ -41,9 +41,10 @@ class BitbucketProvider(GitProvider):
def get_repo_settings(self):
try:
contents = self.repo_obj.get_contents(
".pr_agent.toml", ref=self.pr.head.sha
).decoded_content
url = (f"https://api.bitbucket.org/2.0/repositories/{self.workspace_slug}/{self.repo_slug}/src/"
f"{self.pr.destination_branch}/.pr_agent.toml")
response = requests.request("GET", url, headers=self.headers)
contents = response.text.encode('utf-8')
return contents
except Exception:
return ""