从 Django 获取原始查询

发布于 2024-08-29 11:07:59 字数 270 浏览 3 评论 0原文

我想从 Django 获取原始查询(与发送的格式完全相同)。

目前,django 向我发送一个查询 dict 对象,其中如果我执行 querydict.urlencode(),我会收到查询,但格式与发送的格式不同,因为字典会破坏位置。

对于 GET,我们可以使用 request.get_full_path()。

我还没有找到 POST 的机制。

我需要它,因为我正在做 HMAC,对于 HMAC,字段的精确定位很重要。

问候

K

I would like to get the original query (in the exact same format as sent) from Django.

Currently, django sends me a query dict object, wherein if I do querydict.urlencode(), I get the query back, but in a different format from what is sent, since dictionary mangles the positions.

For GET, we can use, request.get_full_path().

I have not found a mechanism for POST.

I require it since I am doing a HMAC, and for HMAC, the exact positioning of fields are important.

Regards

K

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

百善笑为先 2024-09-05 11:07:59

抱歉,这个问题已经解决了。

我们可以使用 raw_post_data 来实现这一点。忘了那件事了。

Sorry, this is solved.

We can use raw_post_data for that. Forgot about that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文