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

api_client.py imports non-existent field from api #460

Closed
rodneykinney opened this issue Oct 10, 2019 · 2 comments · Fixed by #461
Closed

api_client.py imports non-existent field from api #460

rodneykinney opened this issue Oct 10, 2019 · 2 comments · Fixed by #461

Comments

@rodneykinney
Copy link

In version 0.30, this error is thrown when trying to flush metrics from a threadstats recorder:

Traceback (most recent call last):
  File "/worker/python/lib/python3.7/site-packages/datadog/threadstats/base.py", line 312, in flush
    self.reporter.flush_metrics(metrics)
  File "/worker/python/lib/python3.7/site-packages/datadog/threadstats/reporters.py", line 21, in flush_metrics
    api.Metric.send(metrics)
  File "/worker/python/lib/python3.7/site-packages/datadog/api/metrics.py", line 91, in send
    return super(Metric, cls).send(attach_host_name=attach_host_name, **metrics_dict)
  File "/worker/python/lib/python3.7/site-packages/datadog/api/resources.py", line 78, in send
    attach_host_name=attach_host_name)
  File "/worker/python/lib/python3.7/site-packages/datadog/api/api_client.py", line 84, in submit
    from datadog.api import _api_key, _application_key, _api_host, \
ImportError: cannot import name '_return_raw_response' from 'datadog.api' (/worker/python/lib/python3.7/site-packages/datadog/api/__init__.py)

It looks as though every field referenced in this import can be found in the api module except for _return_raw_response.

@zippolyte
Copy link
Contributor

Hi @rodneykinney, thanks for reporting this issue.

Looks like this attribute was supposed to be set by the initialize function:

api._return_raw_response = return_raw_response
. Are you calling initialize ?

I'd suggest doing that or manually setting the attribute to workaround the issue while we work on making it available by default in the api module

@rodneykinney
Copy link
Author

Thanks for the response. It looks like failing to initialize was the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants