开发者

How post data over https with urllib2?

开发者 https://www.devze.com 2023-03-08 12:21 出处:网络
I want to integrate a credit card processing in my website using Paybox.com API\'s. I have to send a POST request (usin开发者_StackOverflowg urllib2) to Paybox API\'s with credit card details (number

I want to integrate a credit card processing in my website using Paybox.com API's.

I have to send a POST request (usin开发者_StackOverflowg urllib2) to Paybox API's with credit card details (number, date, cvv) when a user submit a form.

How can I secure that? is it enougth to put https://www.mywebsite.com/card/processing in my form action?

How can I send POST data over HTTPS using urllib2?

PS: I work on Django.


Well in terms of security refer to this QA: POST data encryption - Is HTTPS enough?

As far as how to do it, here's an explanation about using urllib: http://www.codercaste.com/2009/11/28/how-to-use-the-urllib-python-library-to-fetch-url-data-and-more/

The idea is to use the urlencode command to create a parameters object for the request, then create a request object from the url and the parameters object, and then call urlopen on the request object in order to actually send the request.


Here are solutions using python-request lib: http://www.python-requests.org/en/latest/user/advanced/

  • request using ssl: http://docs.python-requests.org/en/latest/user/advanced/#ssl-cert-verification
  • request using post: http://docs.python-requests.org/en/latest/user/quickstart/#more-complicated-post-requests (should also allow verify=True parameter)

By the way, python-request is a very powerful and easy way to make requests.

0

精彩评论

暂无评论...
验证码 换一张
取 消