Skip to content

Instantly share code, notes, and snippets.

@prabhu
Created July 26, 2020 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prabhu/f14257465e3659f2acba874b2d2ef29d to your computer and use it in GitHub Desktop.
Save prabhu/f14257465e3659f2acba874b2d2ef29d to your computer and use it in GitHub Desktop.
Example for making Bitbucket api calls from pipelines using the local proxy
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