Skip to main content
 首页 » 编程设计

python之这是什么类型的 JSON 对象 (Gitlab API), (Python)

2025年05月04日24cloudgamer

我使用 GitLab 的文件存储库 API 访问文件的内容,在我点击一个特定文件(任何文本文件)之前,一切似乎都很顺利。

{:file_name=>"requirements.txt", :file_path=>"requirements.txt", :size=>30, :encoding=>"base64", :content=>"ImZsYXNrIgoidXdzZ2kiCiJnb2dvc2VjcmV0cyIK", :ref=>"master", :blob_id=>"7f551dddd4fd8931419450fb357bad83d2efbe6a", :commit_id=>"40e161fcb323be28259712a6cf5da8fddfda80e1", :last_commit_id=>"40e161fcb323be28259712a6cf5da8fddfda80e1"} 

我从未在键前见过冒号,也从未在 JSON 对象中见过“=>”。返回的所有其他 JSON 对象都没有问题。向 API 发出的请求没有错误,因为返回了 200 响应。

这是什么??

请您参考如下方法:

这似乎是 Gitlab 中的一个 Unresolved 错误。参见 https://gitlab.com/gitlab-org/gitlab-ee/issues/2298 .

What is the current bug behavior?

Response:

{:file_path=>"Readme.txt", :branch=>"master"} 

What is the expected correct behavior?

Response:

{"file_name": "Readme.txt", "branch": "master"}