A
A
Alex Xmel2021-08-01 17:37:09
Django
Alex Xmel, 2021-08-01 17:37:09

How to make a POST to a third-party site?

I have a POST request to a third party resource on my site.
After sending it, I process the callback like this:

urlpatterns = [
    path(CALLBACK_URL, csrf_exempt(CallBack.as_view()), name='callback'),
]

I can achieve the same result using the @csrf_exempt decorator before the view
Immediately question number 1: is there a difference between these methods?

Yesterday everything worked, today I get an error 500. I turned off this request on my site and everything worked again. According to the logs, nginx did not really understand anything, it is not yet strong in this.
It is likely that I need to add the IP of the third-party resource where I am contacting to add to a certain IP white list on my website. I understand that I didn’t understand how to do it and by what means, django or nginx ?
And what else do I need to do to correctly and safely issue this request and process it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question