django - any insight into creating an https request to submit a cart to sagepay -


A link for the tutorial to create a https POST request to park a payment gateway, in this case Sejape < / P>

Or what might be the best example to be one in the package?

Do you need to contact the server directly or redirect your user to there? urlib import urlib, urllib2 url = "https: // server / endpoint" headers = {'agent': 'Mozilla / 4.0 (compatible; MSIE 5.5; Windows NT) '} Data = urllib.urlencode ({' datafield1 ': data1,' datafield2 ': data2}) Request = urllib2.Request (url, data, header) response = urllib2.urlopener (request) .open () < / Code>

For the user there, it is generally thought that the user will click on a button that will post the correct information. This is usually hidden in the form of the "confirm the order" button.

This can be achieved either by hiding the right areas and all the fields, with a form of the form:

  class HiddenForm (form): param1 = TextField (initial_hidden) = True) param2 = textField (initial_hidden = true) & lt; Form action = "https: // server / endpoint" method = "POST" & gt; {{Form.hidden_fields}} & lt; Input type = "submit" value "confirm the order" & gt; & Lt; / Form & gt;    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -