Do we need to close session explicitly in django request?

Let's say, we have class

class Pipe(object):
    def __init__(self, imp_url=IAMPORT_API_URL):
        requests_session = requests.Session()
        requests_adapters = requests.adapters.HTTPAdapter(max_retries=3)
        requests_session.mount('https://', requests_adapters)
        self.requests_session = requests_session

    def get(self, url, payload=None)
        return self.requests_session.get(url, headers=headers, params=payload)

class RequestAPIView(APIView):
    def put(self, request):
        pipe = Pipe()

After call RequestAPIView, Do we need to close self.session explicitly in pipe object? Or after RequestAPIView done, Does the self.session will be closed automatically?

Answers: 0