python get请求 url_Python请求Get(URL)200响应,没有d

我正在使用请求库执行GET请求。我可以得到200个响应,但它不返回任何数据,它返回对象“jobs”,但不返回其他内容。我正在使用Visualping.io api。我已经成功地运行CURl命令,并且成功地从浏览器url。。。。这是我的python代码。我已经编辑了我的凭证和PHP sesh id`import requests

r = requests.get("https://visualping.io/api/job/list", headers={'username':'myemail@email.com', 'password':'MyPassword', 'User-Agent':'test'})

print (r.content)

print (r.status_code)

print (r.headers)

print (r.json)`

我也尝试过不使用用户和pass作为头,只是在url中这样传递它们。。这同样适用于浏览器和curl`https://visualping.io/api/job/list?username='myusername'&password='mypassword'`

对于这两个,我得到以下输出

//printcontent{“success”:true,“jobs”:[]}

//打印状态码200

//下面是打印标题

{'X-Powered-By':'PHP/5.5.35','Transfer-Encoding':'chunked','Set-Cookie':'PHPSESSID={MYSESSIONID};expires=Fri,2017年5月26日20:42:31 GMT;Max-Age=3600;path=/','expires':'Thu,1981年11月19日08:52:00 GMT','Vary':'Accept-Encoding','Server':'nginx',Connection':'keep alive','Pragma':'no-cache','cache-Control:'没有存储,没有缓存,必须重新验证日期,post check=0,pre check=0,'日期':'Fri,2017年5月26日19:42:31 GMT,'内容类型':'text/html,'内容编码':'gzip'}

//这是print json

{u'jobs':[],u'success':True}

这是一个街区`{"success":true,"jobs":[]}

200

{'X-Powered-By': 'PHP/5.5.35', 'Transfer-Encoding': 'chunked', 'Set-Cookie': 'PHPSESSID={MYSESSIONID}; expires=Fri, 26-May-2017 20:43:47 GMT; Max-Age=3600; path=/', 'Expires': 'Thu, 19 Nov 1981 08:52:00 GMT', 'Vary': 'Accept-Encoding', 'Server': 'nginx', 'Connection': 'keep-alive', 'Pragma': 'no-cache', 'Cache-Control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'Date': 'Fri, 26 May 2017 19:43:47 GMT', 'Content-Type': 'text/html', 'Content-Encoding': 'gzip'}

>`

以下是文档中的预期响应

获取/api/job/list`{

"jobs": {

"active": [

{

"id": "NzqkVe1AI6WYBli",

"created": "2015-09-06 00:37:16",

"url": "www.google.de",

"description": "Google Landing Page",

"runs": "10",

"trigger": "1",

"interval": "60",

}

],

"inactive": [

{

"id": "gCXHiydaCulFOFA",

"created": "2016-09-06 00:37:16",

"url": "www.bing.de",

"description": "Bing Landing Page",

"runs": "25",

"trigger": "10",

"interval": "300"

}

],

}

}`

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值