Created
July 26, 2020 14:09
-
-
Save prabhu/f14257465e3659f2acba874b2d2ef29d to your computer and use it in GitHub Desktop.
Example for making Bitbucket api calls from pipelines using the local proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# Use local bitbucket proxy to avoid the need for app password | |
proxies = { | |
"http": "http://localhost:29418", | |
"https": "http://localhost:29418", | |
} | |
# Use the proxies object in requests for making | |
# authenticated calls without app passwords | |
requests.put( | |
f"http://api.bitbucket.org/2.0/repositories/{BITBUCKET_REPO_OWNER}/{BITBUCKET_REPO_SLUG}/commit/{BITBUCKET_COMMIT}/reports/shiftleft-ngsast", | |
proxies=proxies, | |
headers={"Content-Type": "application/json",}, | |
json=annotation, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment