macadmins / macadmins/jamf-pro-sdk-python
[Feature Request] Option to parse XML from Classic API endpoints
@brysontyrrell がすでに取り組んでいます。
2023年11月28日 から。
- 主要言語
- Python
- スター
- 69
- フォーク
- 16
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Currently, JSON responses are requested from the Classic API and can be parsed with the .json() method:
response = api.classic_api_request("GET", "accounts/userid/257")
user_info = response.json()
However, there's no equivalent option for parsing XML responses if the headers are overridden to request XML:
response = api.classic_api_request("GET", "accounts/userid/257", override_headers={"Accept": "application/xml"})
user_info = response.xml() # this doesn't exist
Some orgs may benefit from the ability to choose between XML and JSON responses. One use case would be working around Jamf product issues that affect the accuracy of information returned via one format — like PI104345: /accounts endpoint giving different results when searching by userid vs. username.
Proposal
The SDK could provide an .xml() method similar to the existing .json() method that converts XML responses to dictionary form, possibly leveraging a module like xmltodict to do the work behind the scenes.
Alternatively, the response could contain a .data attribute that provides the relevant information in structured data (lists or dicts) regardless of what serialization format was requested — a parsed equivalent to .text. This attribute could replace both .json() and .xml() functionalities.
Thanks for considering.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。