Skip to content

list_events should handle float timestamps #291

Closed
@nickatsegment

Description

@nickatsegment

If you call list_events with a float, no client-side validation rejects this, but the API server doesn't handle floats, and the request fails.

To Reproduce
Steps to reproduce the behavior:

  1. Do list_events(1, 1). This works (returns an empty list generally).
  2. Do list_events(1.0, 1.0). This fails with an obscure error:
HTTP response body: {"errors": ["The value provided for parameter 'start' is invalid"]}

Expected behavior
Either this library should coerce to int (dropping the fractional part) or raise some sort of validation error before sending the request.

Environment and Versions (please complete the following information):

$ pip list | grep datadog
datadog-api-client 1.0.0b6

Additional context

datetime.timestamp() returns a float, which is how I was trying to use this method.

Also the documentation examples could be better. They specify the ints 1 and 1 for both start and end, a thing that would never happen. Suggest showing something relative to datetime.utcnow().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions