Skip to content

get_device_position

get_device_position(
    tracker_name: ResourceName,
    device_id: Id,
    *,
    config_overrides: Optional[LocationClientConfig] = None,
) -> GetDevicePositionResponse

Retrieves a device's most recent position according to its sample time.

Device positions are deleted after 30 days.

Parameters:

  • tracker_name (ResourceName) –

    The tracker resource receiving the position update.

  • device_id (Id) –

    The device whose position you want to retrieve.

Raises:

  • AccessDeniedException –

    The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.

  • InternalServerException –

    The request has failed to process because of an unknown server error, exception, or failure.

  • ResourceNotFoundException –

    The resource that you've entered was not found in your AWS account.

  • ThrottlingException –

    The request was denied because of request throttling.

  • ValidationException –

    The input failed to meet the constraints specified by the AWS service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_location/_services/location.py
def get_device_position(
    self,
    tracker_name: "capo_location.types.resource_name.ResourceName",
    device_id: "capo_location.types.id.Id",
    *,
    config_overrides: Optional[LocationClientConfig] = None,
) -> "capo_location.types.get_device_position_response.GetDevicePositionResponse":
    """<p>Retrieves a device's most recent position according to its sample time.</p> <note> <p>Device positions are deleted after 30 days.</p> </note>

    Args:
        tracker_name: <p>The tracker resource receiving the position update.</p>
        device_id: <p>The device whose position you want to retrieve.</p>

    Raises:
        capo_location.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.</p>
        capo_location.errors.internal_server_exception.InternalServerException: <p>The request has failed to process because of an unknown server error, exception, or failure.</p>
        capo_location.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource that you've entered was not found in your AWS account.</p>
        capo_location.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling.</p>
        capo_location.errors.validation_exception.ValidationException: <p>The input failed to meet the constraints specified by the AWS service. </p>
        capo_location.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_location.types.get_device_position_request.GetDevicePositionRequest]",
    ) -> OperationResponse[
        "capo_location.types.get_device_position_response.GetDevicePositionResponse"
    ]:
        import capo_location._operations.location_service.get_device_position

        output, http_response = (
            capo_location._operations.location_service.get_device_position.get_device_position(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_location.types.get_device_position_response.GetDevicePositionResponse",
    ) -> dict[str, Any]:
        import capo_location.types.get_device_position_response

        return capo_location.types.get_device_position_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetDevicePosition", redact_output=_redact_output),
    )
    input_: capo_location.types.get_device_position_request.GetDevicePositionRequest = {
        "tracker_name": tracker_name,
        "device_id": device_id,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output