# Useful links# - https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html# - https://confluence.atlassian.com/bitbucket/rest-apis-222724129.html# - https://confluence.atlassian.com/bitbucket/version-1-423626337.html# - https://confluence.atlassian.com/bitbucket/issues-resource-296095191.html# Depends on requests and requests_oauthlib packages (available via pip) fromrequests_oauthlibimportOAuth1Sessionclient_key='Fill me'client_secret='Fill me'ifclient_key=='Fill me'orclient_secret=='Fill me':raiseRuntimeError('Provide key and secret')bitbucket=OAuth1Session(client_key,client_secret=client_secret)url='https://api.bitbucket.org/1.0/repositories/secure-it-i/android-app-vulnerability-benchmarks/issues'r=bitbucket.get(url)print(r)# create issues# each line in benchmarks.csv should contain benchmark name and assignee withopen("benchmarks.csv","rt")asf:forlineinf.readlines():tmp1=line.strip().split(',')data={'status':'new','priority':'blocker','title':'Create functional test for '+tmp1[0],'responsible':tmp1[1],'kind':'enhancement'}print(data)r=bitbucket.post(url,data=data)print(r)r.close()## delete issues#for i in range(77, 117):# r = bitbucket.delete(url + "/" + str(i))# print(r)
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.