django.conf.settings. - python examples

Here are the examples of the python api django.conf.settings. taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

3 View Complete Implementation : serializers.py
Copyright Apache License 2.0
Author : ShipChain
    def get_presigned_s3_thumbnail(self, obj):
        if obj.upload_status != UploadStatus.COMPLETE:
            return None

        thumbnail_key = obj.s3_key.rsplit('.', 1)[0] + '-t.png'

        url = settings.S3_CLIENT.generate_presigned_url(
            'get_object',
            Params={
                'Bucket': f"{self._s3_bucket}",
                'Key': thumbnail_key
            },
            ExpiresIn=settings.S3_URL_LIFE
        )

        LOG.debug(f'Generated one time s3 url thumbnail for: {obj.id}')

3 View Complete Implementation : permissions.py
Copyright Apache License 2.0
Author : ShipChain
def is_carrier(request, shipment):
    """
    Custom permission for carrier shipment access
    """
    response = settings.REQUESTS_SESSION.get(f'{PROFILES_WALLET_URL}/{shipment.carrier_wallet_id}/?is_active',
                                             headers={'Authorization': f'JWT {get_jwt_from_request(request)}'})

    return response.status_code == status.HTTP_200_OK and request.method in ('GET', 'PATCH')

3 View Complete Implementation : permissions.py
Copyright Apache License 2.0
Author : ShipChain
def is_moderator(request, shipment):
    """
    Custom permission for moderator shipment access
    """
    if shipment.moderator_wallet_id:
        response = settings.REQUESTS_SESSION.get(f'{PROFILES_WALLET_URL}/{shipment.moderator_wallet_id}/?is_active',
                                                 headers={'Authorization': f'JWT {get_jwt_from_request(request)}'})

        return response.status_code == status.HTTP_200_OK and request.method in ('GET', 'PATCH')

    return False

3 View Complete Implementation : permissions.py
Copyright Apache License 2.0
Author : ShipChain
def is_shipper(request, shipment):
    """
    Custom permission for shipper shipment access
    """
    response = settings.REQUESTS_SESSION.get(f'{PROFILES_WALLET_URL}/{shipment.shipper_wallet_id}/?is_active',
                                             headers={'Authorization': f'JWT {get_jwt_from_request(request)}'})

    return response.status_code == status.HTTP_200_OK and request.method in ('GET', 'PATCH')