def post(self, request, *args, **kwargs):
        email = request.POST.get('email')
        api_key = request.POST.get('api_key')
        version = request.POST.get('version')
        package_id = request.POST.get('package_id')

        if not email or not api_key and not version:
            message = {'success': False, 'errors': []}
            if not email:
                message['errors'].append('Email is mandatory.')
            if not api_key:
                message['errors'].append('API key is mandatory.')
            if not version:
                message['errors'].append('Version is mandatory.')
            return HttpResponseBadRequest(json.dumps(message))

        member = self.get_member(email, api_key)
        if member is None:
            return HttpResponseForbidden(
                json.dumps({'success': False, 'errors': ['Bad credentials.']}))
        if not member.is_active:
            return HttpResponseForbidden(
                json.dumps(
                    {'success': False, 'errors': ['Account not active.']}))
        if package_id and not member.package_set.get(pk=package_id):
            return HttpResponseForbidden(
                json.dumps(
                    {
                        'success': False,
                        'errors': ['Access to this package is not allowed.']}))

        try:
            if package_id:
                package = member.package_set.only('package').get(pk=package_id)
            else:
                package = member.package_set.filter(
                    version=version).only('package').latest('update')
        except Package.DoesNotExist:
            return HttpResponseNotFound(
                json.dumps(
                    {'success': False, 'errors': ['Package not found.']}))

        response = HttpResponse(
            package.package.read(),
            content_type='application/zip, application/octet-stream')
        response.streaming = True
        response['Content-Disposition'] = (
            'attachment; filename=package_version-%s.zip' % package.version)
        return response

        # return redirect(package.package.url)
dataset/ETHPy150Open socketubs/sublimall-server/sublimall/storage/views.py/DownloadPackageAPIView.post/original