Skip to content

Extend response headers to response#397

Merged
nmuesch merged 2 commits intomasterfrom
nick/fix_headers
Jun 10, 2019
Merged

Extend response headers to response#397
nmuesch merged 2 commits intomasterfrom
nick/fix_headers

Conversation

@nmuesch
Copy link
Copy Markdown
Contributor

@nmuesch nmuesch commented Jun 10, 2019

Properly extend the response headers to the response object list.

Resolves:

Traceback (most recent call last):
  File "test.py", line 14, in <module>
    print (api.Monitor.get_all())
  File "/usr/local/lib/python3.7/site-packages/datadog/api/monitors.py", line 57, in get_all
    return super(Monitor, cls).get_all(**params)
  File "/usr/local/lib/python3.7/site-packages/datadog/api/resources.py", line 181, in get_all
    return APIClient.submit('GET', cls._resource_name, api_version, **params)
  File "/usr/local/lib/python3.7/site-packages/datadog/api/api_client.py", line 161, in submit
    response_obj['response_headers'] = response_headers
TypeError: list indices must be integers or slices, not str

issues on endpoints that had response headers returned.

Fixes #393

@nmuesch nmuesch merged commit 8c50a4a into master Jun 10, 2019
@nmuesch nmuesch deleted the nick/fix_headers branch June 10, 2019 16:26
@aamangeldi
Copy link
Copy Markdown

aamangeldi commented Jun 10, 2019

@ofek @nmuesch this seems to have broken sth on my end, which works fine in 0.29.0:

/databricks/python/lib/python3.5/site-packages/datadog/api/metrics.py in send(cls, metrics, attach_host_name, **single_metric)
     89             raise KeyError("'points' parameter is required")
     90 
---> 91         return super(Metric, cls).send(attach_host_name=attach_host_name, **metrics_dict)
     92 
     93     @classmethod

/databricks/python/lib/python3.5/site-packages/datadog/api/resources.py in send(cls, attach_host_name, id, **body)
     76         if id is None:
     77             return APIClient.submit('POST', cls._resource_name, api_version, body,
---> 78                                     attach_host_name=attach_host_name)
     79 
     80         path = '{resource_name}/{resource_id}'.format(

/databricks/python/lib/python3.5/site-packages/datadog/api/api_client.py in submit(cls, method, path, api_version, body, attach_host_name, response_formatter, error_formatter, **params)
    160             if response_obj:
    161                 for response in response_obj:
--> 162                     response['response_headers'] = response_headers
    163 
    164             if response_formatter is None:

TypeError: 'str' object does not support item assignment

nmuesch added a commit that referenced this pull request Jun 10, 2019
This reverts commit 8c50a4a, reversing
changes made to d22eec7.
@nmuesch nmuesch mentioned this pull request Jun 10, 2019
dabcoder pushed a commit to dabcoder/datadogpy that referenced this pull request Oct 25, 2019
dabcoder pushed a commit to dabcoder/datadogpy that referenced this pull request Nov 28, 2019
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 this pull request may close these issues.

API Calls Failing Due to TypeError (0.29.0)

3 participants