Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list_events should handle float timestamps #291

Closed
nickatsegment opened this issue Feb 23, 2021 · 3 comments · Fixed by #487
Closed

list_events should handle float timestamps #291

nickatsegment opened this issue Feb 23, 2021 · 3 comments · Fixed by #487

Comments

@nickatsegment
Copy link

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().

@github-actions
Copy link

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

@github-actions github-actions bot added the stale label Mar 26, 2021
@nickatsegment
Copy link
Author

Verify that you can still reproduce the issue in the latest version of this project.

No thanks, I've already used up my "free labor" quota :P

@therve
Copy link
Contributor

therve commented Jun 21, 2021

Added the extra validation in #487 . Thanks!

@therve therve closed this as completed Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants