TF400898: 发生内部错误。活动 ID:1fc05eca-fed8-4065-ae1a-fc8f2741c0ea
Posted
技术标签:
【中文标题】TF400898: 发生内部错误。活动 ID:1fc05eca-fed8-4065-ae1a-fc8f2741c0ea【英文标题】:TF400898: An Internal Error Occurred. Activity Id: 1fc05eca-fed8-4065-ae1a-fc8f2741c0ea 【发布时间】:2022-01-20 15:31:03 【问题描述】:我正在尝试通过 azure API 将文件推送到 git repo,但出现 activity_id 错误。我关注了他们的documentation 并尝试在我的存储库中添加简单文件。 这是我的代码:
import requests, base64
pat_token = "xxxx-xxxxx-xxxx"
b64Val = base64.b64encode(pat_token.encode()).decode()
payload =
"refUpdates": [
"name": "refs/heads/main",
"oldObjectId": "505aae1f15ae153b7fc53e8bdb79ac997caa99e6"
],
"commits": [
"comment": "Added task markdown file.",
"changes": [
"changeType": "add",
"item":
"path": "TimeStamps.txt"
,
"newContent":
"content": "# Tasks\n\n* Item 1\n* Item 2",
"contentType": "rawtext"
]
]
headers =
'Authorization': 'Basic %s' % b64Val,
'Content-Type': 'application/json',
params = (
('api-version', '6.0'),
)
response = requests.post('https://dev.azure.com/organization/project/_apis/git/repositories/repo/pushes', headers=headers, data=payload, params=params)
有人知道如何解决这个问题吗?我还在他们的开发者社区中添加了这个issue
【问题讨论】:
【参考方案1】:我已经修复了这个错误,实际上有效载荷不是 json 格式,所以我必须将其设为 json,然后它就可以正常工作了。 像这样
response = requests.post('https://dev.azure.com/organization/project/_apis/git/repositories/repoId/pushes', headers=headers, params=params, data=json.dumps(payload))
【讨论】:
以上是关于TF400898: 发生内部错误。活动 ID:1fc05eca-fed8-4065-ae1a-fc8f2741c0ea的主要内容,如果未能解决你的问题,请参考以下文章
使用 rest api 捕获付款时发生 Paypal 内部服务器错误