无法使用 BitBucket 2.0 创建存储库 API
Unable to create repo using BitBucket 2.0 API
当我尝试使用 Bitbucket 创建新的存储库时收到错误请求 API
def create_repo(self):
headers = {
'Content-Type': 'application/json',
}
data = {
"scm": "git",
"grant_type": "access_token",
"project": {
"key": 'US'
},
"access_token": self.get_access_token(),
"username": self.username,
"password": self.password,
}
r = requests.post('https://api.bitbucket.org/2.0/repositories/{teamname}/test1', headers=headers,
data=data)
试图改变很多东西,但是,我每次都收到错误的请求。
来自BitBucket API Authentication methods:
Basic HTTP Authentication as per RFC-2617 (Digest not supported).
Note that Basic Auth with username and password as credentials is only available on accounts that have 2-factor-auth / 2-step-verification disabled.
If you use 2fa, you should authenticate using OAuth2 instead.
所以请首先确保您不使用 2fa。
然后检查发送的请求是否与 /2.0/repositories/{username}/{repo_slug} POST
文档中的请求相似。
当我尝试使用 Bitbucket 创建新的存储库时收到错误请求 API
def create_repo(self):
headers = {
'Content-Type': 'application/json',
}
data = {
"scm": "git",
"grant_type": "access_token",
"project": {
"key": 'US'
},
"access_token": self.get_access_token(),
"username": self.username,
"password": self.password,
}
r = requests.post('https://api.bitbucket.org/2.0/repositories/{teamname}/test1', headers=headers,
data=data)
试图改变很多东西,但是,我每次都收到错误的请求。
来自BitBucket API Authentication methods:
Basic HTTP Authentication as per RFC-2617 (Digest not supported).
Note that Basic Auth with username and password as credentials is only available on accounts that have 2-factor-auth / 2-step-verification disabled.
If you use 2fa, you should authenticate using OAuth2 instead.
所以请首先确保您不使用 2fa。
然后检查发送的请求是否与 /2.0/repositories/{username}/{repo_slug} POST
文档中的请求相似。