Hi,
-- I am integrating instamojo payment gateway with django application.
After a successful or a failed transaction Instamojo will POST the transaction details to the webhook URL. I am getting 403 error at do_POST method
Sample code for webhook - https://support.instamojo.com/hc/en-us/articles/208485745-Webhook-URL-in-PHP-Python
I have implemented webhook_receiver.py like this:
class MojoHandler(BaseHTTPRequestHandler):
def do_POST(self):
pass
if __name__ == "__main__":
httpd = HTTPServer(('', PORT), MojoHandler)
httpd.serve_forever()
I want to use the @csrf_exempt on the class method 'do_POST', it
doesn't get recognised.
@csrf_exempt
class MojoHandler(BaseHTTPRequestHandler):
def do_POST(self):
pass Using above code I'm getting error TypeError: __init__() missing 2 required positional arguments: 'client_address' and 'server'
Below both type(a and b)of decorator doesn't work
a. class MojoHandler(BaseHTTPRequestHandler):
@csrf_exempt
def do_POST(self):
passb. @method_decorator(csrf_exempt, name='do_POST')
class MojoHandler(BaseHTTPRequestHandler):
def do_POST(self):
pass Why is the decorator not working? Is there any way, how I could disable the csrf protection for this method?
Thank You!
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5f3b24b0-dfb8-4a2e-b606-5930cdcdfe2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment