macadmins/simpleMDMpy

Account() doesn't correctly get account details

Closed this issue · 1 comments

Account() returns an array with only ['type', 'attributes'] instead of a dictionary with the account details.

>>> import SimpleMDMpy
>>> print(SimpleMDMpy.Account(api_key).get_account_details())
['type', 'attributes']

Expected output (something like): {'data': {'attributes': {'apple_store_country_code': 'US', 'name': 'Example Corp'}, 'type': 'account'}}

I believe this is due to [resp_data.extend](https://github.com/macadmins/simpleMDMpy/blob/5221aa32548e2468ade4b92f700d7ebc9d826699/SimpleMDMpy/SimpleMDM.py#L40].

I think changing resp_data to a dictionary resp_data = {} and using resp_data.update(resp_json) might be a better approach and would resolve this.

Alternatively we could leave resp_data as an Array and change resp_data.extend to resp_data.append, which I think would resolve this.

Either of these changes are likely to introduce more bugs.

i was wrong and @MagerValp has a potential resolution that needs to be tested, PR'd, and reviewed on the return_one branch.