Python Django view to return POST-request to client
<p>I have built a web shop with Django and during payment i build-up a POST-request in the view consisting of necessary payment parameters, which then are sent to the payment gateway, and the payment gateway are happy with the POST-request in general.</p>

<p>So far so good, i want to do this without posting hidden forms visible in the HTML source:code in the browser, with other words i want to build and return the POST-request and data from the Django view to the client.</p>

<p>So i want to do something like this to make sure the POST-request originate from the client and not the server to get around session problem(if its possible to return sessions and act like a man in the middle I'm open for that type of solutions as well):</p>

<pre><code>return requests.post('https://payment.gw/PostAPI/Init', data = payload)
</code></pre>

<p>doing this i get the error:</p>

<pre><code>Django Version:     1.8.13
Exception Type:     AttributeError
Exception Value:    

'Response' object has no attribute 'get'
</code></pre>

<p>TRACEBACK</p>

<pre><code>local/lib/python2.7/site-packages/django/core/handlers/base.py in get_response
response = middleware_method(request, response)
local/lib/python2.7/site-packages/django/middleware/clickjacking.py in process_response
if response.get('X-Frame-Options', None) is not None:
</code></pre>