bitbucket-api

Howto use python urllib2 to create service POST with bitbucket API?

試著忘記壹切 提交于 2019-12-04 18:30:53
While this code works fine to add a deployment ssh-key to my repos... print 'Connecting to Bitbucket...' bitbucket_access = base64.b64encode(userbb + ":" + passwordbb) bitbucket_headers = {"Content-Type":"application/json", "Authorization":"Basic " + bitbucket_access} bitbucket_request_url = "https://bitbucket.org/api/1.0/repositories/<username>/%s/deploy-keys" % project_name bitbucket_request_req = urllib2.Request(bitbucket_request_url) for key,value in bitbucket_headers.items(): bitbucket_request_req.add_header(key,value) request_data = json.dumps({"key":public_key, "label":subproject})

Request OAuth token from BitBucket

浪尽此生 提交于 2019-12-04 05:11:02
I've been trying to integrate BitBucket to my application for the past 4 hours to no avail. While reading through BitBucket's RESTful API documentation , I noticed that you need to use OAuth — it's OK, I'm using J.R Conlin's OAuthSimple library, which if fine by me (I tried oauth-php but it was kinda complicated — I didn't need all of those options for such a small integration). For what I understand, the first step to authenticate with OAuth is to request a new token via POST. When providing the necessary parameters, you should get a response from BitBucket, like this: oauth_token

Bitbucket pull request builder plugin keeps triggering same commit build

亡梦爱人 提交于 2019-12-04 03:24:38
I need to integrate Bitbucket with Jenkins. So that whenever a PR is opened it will trigger a build in Jenkins. Then commit status of the last commit in the PR will be updated as failed or success and this commit wont trigger the build again. (This works beautiful with Github but seems to be a nightmare for me with Bitbucket) So far I did: Installed Bitbucket pull request builder plugin. Set everything up like its described in https://github.com/jenkinsci/bitbucket-pullrequest-builder-plugin#readme User has write permissions to the repository (we added shh pub key to organization and its in

Bitbucket API 2 - create repository in a team project

别说谁变了你拦得住时间么 提交于 2019-12-03 14:10:54
I have a team on my bitbucket account, myteam , which contains a project named mainproject . Whenever I want to create a repository inside I only need to execute this command line: $ curl -X POST -v -u myaccount:passwd "https://api.bitbucket.org/2.0/repositories/myteam/repo1" -d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks"}' This works. However the issue arises when I create a second project, named secondproject . How am I supposed to tell the API to which project the repository should belong? I tried specifying the project information in the data (-d): $ curl -X POST

curl vs python “requests” when hitting APIs

一世执手 提交于 2019-12-03 05:49:14
问题 I am trying to hit the Bitbucket API for my account, and a successful attempt looks like: curl --user screename:mypassword https://api.bitbucket.org/1.0/user/repositories in the command line. In python, I try: import requests url = 'https://api.bitbucket.org/1.0/user/repositories' then r = requests.post(url, data={'username': myscreename, 'password':mypassword}) and r = requests.post(url, data="myscreename:mypassword") and r = requests.post(url, data={"user": "myscreename:mypassword"}) all

curl vs python “requests” when hitting APIs

你离开我真会死。 提交于 2019-12-02 19:10:12
I am trying to hit the Bitbucket API for my account, and a successful attempt looks like: curl --user screename:mypassword https://api.bitbucket.org/1.0/user/repositories in the command line. In python, I try: import requests url = 'https://api.bitbucket.org/1.0/user/repositories' then r = requests.post(url, data={'username': myscreename, 'password':mypassword}) and r = requests.post(url, data="myscreename:mypassword") and r = requests.post(url, data={"user": "myscreename:mypassword"}) all get 405 error. The API is https://confluence.atlassian.com/bitbucket/rest-apis-222724129.html . I wonder:

How to get a full list of repositories that a user is allowed to access?

断了今生、忘了曾经 提交于 2019-11-30 01:55:50
问题 I have found bitbucket api like: https://bitbucket.org/api/2.0/repositories/{teamname} But this link return 301 status (moved permanently to !api/2.0/repositories/{teamname} ). Ok, but this one returns status 200 with zero repositories. I provide two parameters as user and password , but nothing seems changed. So, can anybody answer how to get full list of private repositories that allowed to specific user? 回答1: Atlassian Documentation - Repositories Endpoint provides a detail documentation

How to sync repo in bitbucket to Visual studio team service?

萝らか妹 提交于 2019-11-28 09:33:55
I am very new to VSTS platform. In one of my project, I am trying to integrate the bitbucket source control to VSTS. By this way I should be able to see the updates made on bitbucket onto the VSTS account. I have tried creating build on VSTS, but that only shows the commits history of the selected repository of bitbucket. Is there a way to manage all the bitbucket changes on VSTS as source control? To sync changes from bitbucket repo to VSTS git repo automatically, you can achieve it by using a VSTS build definition . Detail steps as below: 1. Create a build definition with Bitbucket repo When

How to sync repo in bitbucket to Visual studio team service?

给你一囗甜甜゛ 提交于 2019-11-27 04:36:27
问题 I am very new to VSTS platform. In one of my project, I am trying to integrate the bitbucket source control to VSTS. By this way I should be able to see the updates made on bitbucket onto the VSTS account. I have tried creating build on VSTS, but that only shows the commits history of the selected repository of bitbucket. Is there a way to manage all the bitbucket changes on VSTS as source control? 回答1: To sync changes from bitbucket repo to VSTS git repo automatically, you can achieve it by