Curl可以工作,但是python请求不能';T

Curl可以工作,但是python请求不能';T,python,python-2.7,http,docker,curl,Python,Python 2.7,Http,Docker,Curl,当我做卷曲时,我得到一个响应: root@3d7044bac92f:/home/app/tmp# curl -H "Content-type: application/json" -X GET https://github.com/timeline.json -k {"message":"Hello there, wayfaring stranger. If you\u2019re reading this then you probably didn\u2019t see our blog

当我做卷曲时,我得到一个响应:

root@3d7044bac92f:/home/app/tmp# curl -H "Content-type: application/json" -X GET https://github.com/timeline.json -k 

{"message":"Hello there, wayfaring stranger. If you\u2019re reading this then you probably didn\u2019t see our blog post a couple of years back announcing that this API would go away: http://git.io/17AROg Fear not, you should be able to get what you need from the shiny new Events API instead.","documentation_url":"https://developer.github.com/v3/activity/events/#list-public-events"}
但是,当我对同一URL执行python请求时,我会得到状态410

import requests

headers = {
    'Content-type': 'application/json',
}

r = requests.get('https://github.com/timeline.json')
print r.json

root@3d7044bac92f:/home/app/tmp# python rest.py 
<bound method Response.json of <Response [410]>>
导入请求
标题={
“内容类型”:“应用程序/json”,
}
r=请求。获取('https://github.com/timeline.json')
打印r.json
root@3d7044bac92f:/home/app/tmp#python rest.py
有什么好处

主机是一个标准的Ubuntu docker映像,只安装了Curl和一些python模块。Python-V是2.7

注意:我看了这个问题,但我不能远程登录到上面的服务器,所以解决方案不适用于我:
您的程序中至少出现了两个错误

1) 您尚未为
请求.get()调用指定
数据=
标题
参数。试试这个:

 r = requests.get('https://github.com/timeline.json', data=data, headers=headers)
print r.json()
2)
.json
是响应对象的方法,而不是数据属性。作为一种方法,必须调用它才能有效。试试这个:

 r = requests.get('https://github.com/timeline.json', data=data, headers=headers)
print r.json()

你能改为打印r.text吗?curl也会收到410的响应
curl-i
curl-v
将显示响应头。json()就是它。谢谢