2๐
โ
If your parameters
object is a Django QueryDict
, it already has a very convenient urlencode() method on it. Try something like this instead:
parameters = request.POST.copy()
parameters['cmd']='_notify-validate'
return self.call_paypal(parameters.urlencode()) == 'VERIFIED'
The copy() call is needed because the QueryDict
from the request
object is read-only. Calling copy()
makes a mutable deep-copy that you are free to modify.
I do something like this in my Paypal IPN application and it has been working for some time.
๐คBrian Neal
0๐
As your self.params
contains some non ASCII characters so you have to encode this to UTF-8
before passing to urllib.urlencode
, Look at this answer, it explains how to pass the parameters to urlencode
.
๐คAhsan
- [Answered ]-Django admin site
- [Answered ]-How does one incorporate a Django application into an existing twisted server?
- [Answered ]-What is happening in this urlpatterns list of Python Django urls.py file?
Source:stackexchange.com