【发布时间】:2017-03-23 10:19:43
【问题描述】:
我正在尝试使用 python 请求库发送 https 请求 我的代码是
full_url = ''.join(['https://', get_current_site(request).domain, '/am/reply'])
data = {'agent_type':'trigger','input':platform,'user':request.user.id}
print "hi" ### this is printing
a = requests.get(full_url,params=data,verify=False) ##the execution is stucked here even error are not appearing
print "hello" ## this code is not printed
问题是请求后没有执行,整个代码卡在这一点上。 我尝试使用 python shell 验证我的代码,它运行完美。 有什么方法可以让我实时调试整个请求响应,或者有人可以建议我一个解决方案
当有 http 时,整个代码工作正常,但切换到 https 后,整个代码停止工作。我什至尝试放置证书文件但也没有成功
【问题讨论】:
-
你期待什么样的输出?
-
@JitendraMeena 在最后一行代码我的执行被卡住了意味着甚至没有显示错误......但是使用 python shell 我可以执行代码
-
它工作正常......打印输出......你应该做这样的事情 print(a.json()) 或 print(a.content)
-
可以分享一下你网站的域名吗?
-
@JitendraMeena facebook.tuple-mia.com:8000/am/reply
标签: python django python-requests