doukangbin9698 2019-01-18 07:19
浏览 134

如何在不使用Python中的协议(http,https或ftp)的情况下重定向URL?

I am trying to convert PHP code to Python for the payment gateway integration. In PHP, there is a code "header("Location: " . $url);" and the URL is "gatewaysdk://asdzxc?summaryStatus=SUCCESSFUL&3DSecureId=XXXXXX"(without protocol - http, https or ftp).
In PHP, the code is working fine.
Is there any way to do it in Python.

I have tried using redirect and HttpResponseRedirect - return redirect(redirect_url, allow_redirects=True).
The error I got was
"django.core.exceptions.DisallowedRedirect: Unsafe redirect to URL with protocol 'gatewaysdk'".
After debugging the error I found HttpResponseRedirect supports only with protocol (http, https or ftp).

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大