gpt4 book ai didi

python - Django View 接收不完整的 POST 负载

转载 作者:行者123 更新时间:2023-12-01 05:01:16 26 4
gpt4 key购买 nike

我有一个简单的观点如下:

@csrf_exempt
def stackcommits(request):
print request.body
return HttpResponse("")

当我 POST 到映射到此 View 的 URL 时,我的控制台显示不完整且损坏的负载。它大约是应有尺寸的三分之一,即便如此,对我来说,它的第三个也不是连续的,而是以几个随机的部分交付的。如下:

2014-09-30 18:47:21
<QueryDict: {u'payload': [u'{"zen":"Avoid administrative distraction.","hook_id":3103635,"hook":{"url":"https://api.github.com/repos/valeyard/SearchDemon/hooks/3103635","test_url":"https://api.github.com/repos/valeyard/SearchDemon/hooks/3103635/test","id":3103635,"name":"web","active":true,"events":["push"],"config":{"secret":"","url":"http://searchdemon.pythonanywhere.com/searchdemon/stackcommits/","content_type":"json","insecure_ssl":"0"},"last_response":{"code":null,"status":"unused","message":null},"updated_at":"2014-09-29T20:56:33Z","created_at":"2014-09-29T20:56:33Z"},"repository":{"id":24075885,"name":"SearchDemon","full_name":"valeyard/SearchDemon","owner":{"login":"valeyard","id":5278331,"avatar_url":"https://avatars.githubusercontent.com/u/5278331?v=2","gravatar_id":"","url":"https://api.github.com/users/valeyard","html_url":"https://github.com/valeyard","followers_url":"https://api.github.com/users/valeyard/followers",

2014-09-30 18:47:21
.github.com/repos/valeyard/SearchDemon/issues{/number}","pulls_url":"https://api.github.com/repos/valeyard/SearchDemon/pulls{/number}","milestones_url":"https://api.github.com/repos/valeyard/SearchDemon/milestones{/number}","notifications_url":"https://api.github.com/repos/valeyard/SearchDemon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/valeyard/SearchDemon/labels{/name}","releases_url":"https://api.github.com/repos/valeyard/SearchDemon/releases{/id}","created_at":"2014-09-15T22:10:54Z","updated_at":"2014-09-24T17:12:44Z","pushed_at":"2014-09-29T20:42:34Z","git_url":"git://github.com/valeyard/SearchDemon.git","ssh_url":"git@github.com:valeyard/SearchDemon.git","clone_url":"https://github.com/valeyard/SearchDemon.git","svn_url":"https://github.com/valeyard/SearchDemon","homepage":null,"size":1172,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":tr

有什么想法吗?我被告知这不是 PA 的基础设施问题,所以这很可能是我这边的问题。但我不知道是什么

最佳答案

我认为您只是看到了一个日志记录工件。该消息作为单个 POST 传递,但记录器正在分解该消息,因为它太长。使用 print >> sys.stderr, request.body 代替仅仅 print 消息(将其发送到服务器日志),它将出现在错误日志中没有截断。

关于python - Django View 接收不完整的 POST 负载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26128061/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com