N
N
NetWay2018-07-23 13:38:34
Django
NetWay, 2018-07-23 13:38:34

Django how to implement two different API serial connections?

A webhook in Django accepts messages from an API and should send a 200 OK code then create a new connection to another API and forward the messages.

@csrf_exempt
def comments(request):
    if request.method == 'POST':
        r = json.loads(request.body.decode('utf-8'))
        requests.post('https://xxxxx.xxx', json=r)
        return HttpResponse()

As a result of code execution, I receive messages from the first API twice, as I understand it, due to the lack of a 200 OK response. How to send the code 200 OK to the first API and continue executing the code to send the message?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2018-07-30
@NetWay

Celery

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question