0
我想在Github的Jquery项目中获取代码文件的解密内容。如果我做了curl请求,则返回的代码内容将被解密。Python请求与Mac上的Curl请求通过Github API获取代码内容
但是,在Python请求中使用相同的参数时,存在加密。为什么是这样,我能做些什么来获得解密版本?
这里是我的curl命令:
curl https://api.github.com/repos/jquery/jquery/git/blobs/1d2872e34a809a9469ac5cb149a40fc7b8007633 -H "Accept: application/vnd.github-blob.raw"
输出如下:
<?php
# Load and run the test suite as a proper XHTML page
header("Content-type: application/xhtml+xml");
readfile("index.html");
?>
这里是我的Python代码:
import requests
code = requests.get('https://api.github.com/repos/jquery/jquery/git/blobs/1d2872e34a809a9469ac5cb149a40fc7b8007633'\
,headers={'content-type':'application/vnd.github-blob.raw'})
code.json()
输出是这样的:
{'content': 'PD9waHAKCSMgTG9hZCBhbmQgcnVuIHRoZSB0ZXN0IHN1aXRlIGFzIGEgcHJv\ncGVyIFhIVE1MIHBhZ2UKCWhlYWRlcigiQ29udGVudC10eXBlOiBhcHBsaWNh\ndGlvbi94aHRtbCt4bWwiKTsKCXJlYWRmaWxlKCJpbmRleC5odG1sIik7Cj8+\nCg==\n',
'encoding': 'base64',
'sha': '1d2872e34a809a9469ac5cb149a40fc7b8007633',
'size': 136,
'url': 'https://api.github.com/repos/jquery/jquery/git/blobs/1d2872e34a809a9469ac5cb149a40fc7b8007633'}
谢谢Joran为更正。 – MLhacker