How to use get and post callbacks together

I have both post and get callbacks from an external api
from the post one i need a variable to send to the get one
how can i do it?


class parspostget(View):
    def __init__(self,):
        print("INITTT")
        self.post_hmac = ''
        
    def get(self, request, *args, **kwargs):
        print("GET DEF START")
        print(request.method)
        print(self.post_hmac)
        print(request.session.get("hmac"))

        print("GET DEF END")
        return render(request, "store/card_payment.html")
        # return JsonResponse("get", safe=False)
    
    @csrf_exempt 
    def post(self, request, *args, **kwargs):
        print("POST DEF START")
        print(request.method)
        self.post_hmac = paymentProcCallback(request)
        print(self.post_hmac)
        request.session['hmac'] = self.post_hmac
        print("POST DEF END")
        return render(request, "store/card_payment.html")
        # return JsonResponse("post", safe=False)

That depends strictly upon the external service. There should be documentation somewhere that specifies the details of what data is sent and received.

I have assigned
request.session[‘hmac’] = self.post_hmac
in the post function

but i can not get it in the get function
print(request.session.get(“hmac”)) => None

I doubt seriously that the external service uses session-based connections. You’re going to want to save this data in the database and find what data the service uses to associate requests. But again, that’s something that you’re only going to be able to determine for sure by researching this through their documentation.