Skip to content

Domain API returns a list from list_domains which cannot be accessed #108

@pkern

Description

@pkern

Version

12.0.0

What happened

domain_api.DomainApi(api_client).list_domains(id, version) gives me a DomainsResponse object that contains a list in _data_store. It does not seem to cope with that. You cannot iterate because that will try to index 0 which yields:

In [77]: [domain for domain in domains]
---------------------------------------------------------------------------
ApiAttributeError                         Traceback (most recent call last)
Cell In[77], line 1
----> 1 [domain for domain in domains]

File ~/src/debian/fastly/venv/lib/python3.13/site-packages/fastly/model_utils.py:468, in ModelSimple.__getitem__(self, name)
    465 if name in self:
    466     return self.get(name)
--> 468 raise ApiAttributeError(
    469     "{0} has no attribute '{1}'".format(
    470         type(self).__name__, name),
    471     [e for e in [self._path_to_item, name] if e]
    472 )

ApiAttributeError: DomainsResponse has no attribute '0' at ['['received_data']']

It seems like the only way to actually access the data is to break the abstraction and access _data_store directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions