Can't deserialize response body from batch request as the json properties are single quoted
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Beginne in msgraph_core/requests/batch_response_content.py, insbesondere bei response_body und get_response_by_id, und reproduziere das Problem mit der gezeigten Batch-Anforderung. Untersuche den an die Serialisierungsregistrierung übergebenen Antworttext und vergleiche ihn mit den Erwartungen des JSON-Parsers. Als erledigt gilt die Aufgabe, wenn ApplicationCollectionResponse aus der Batch-Antwort deserialisiert werden kann und die Anwendungs-ID abgerufen werden kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
I'm trying to list applications filtered by particular IDs - there's loads of them so I'm using a batch request with 15 filters at a time (limit). This will allow me to get all the object IDs to query owners etc.
When I attempt to deserialize the BatchResponseContent object with get_response_by_id(response_id, ApplicationCollectionResponse), I get a stack telling me that it can't decode as the properties are single quoted rather than double quoted.
Traceback (most recent call last):
File "/<project>/.venv/lib/python3.9/site-packages/msgraph_core/requests/batch_response_content.py", line 126, in response_body
parse_node = ParseNodeFactoryRegistry().get_root_parse_node(
File "/<project>/.venv/lib/python3.9/site-packages/kiota_abstractions/serialization/parse_node_factory_registry.py", line 41, in get_root_parse_node
return factory.get_root_parse_node(vendor_specific_content_type, content)
File "/<project>/.venv/lib/python3.9/site-packages/kiota_abstractions/serialization/parse_node_proxy_factory.py", line 56, in get_root_parse_node
node = self._concrete.get_root_parse_node(content_type, content)
File "/<project>/.venv/lib/python3.9/site-packages/kiota_serialization_json/json_parse_node_factory.py", line 37, in get_root_parse_node
content_dict = json.loads(content_as_str)
File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.9/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
This is backed up by if I just try to do a json_loads(response.body.decode('utf-8')), which then succeeds if I do a .replace("'", '"').
Expected behavior
I should be able to provide the ApplicationCollectionResponse object to BatchResponseContent.get_response_by_id and deserialize the batch response so that I can get the ID out of the response.
How to reproduce
for app_filter in app_filters:
app_query_params = (
ApplicationsRequestBuilder.ApplicationsRequestBuilderGetQueryParameters(
select=["appId", "id", "serviceManagementReference"],
filter=f"appId in {app_filter}",
)
)
app_request_config = RequestConfiguration(query_parameters=app_query_params)
batch_request_content.add_request_information(
client.applications.to_get_request_information(
request_configuration=app_request_config
),
app_filter,
)
batch_response = await client.batch.post(batch_request_content)
if not batch_response or not batch_response.responses:
log.error("Batch request for application object IDs failed")
return None
for response_id in batch_response.responses.keys():
batch_response.get_response_by_id(response_id, ApplicationCollectionResponse)
SDK Version
1.17.0 of msgraph-sdk (so 1.2.0 of msgraph-core)
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_
- Vorherrschende Sprache
- Python
- Sterne
- 288
- Forks
- 52
- Ø Merge
- 8 Std. 10 Min.
- Gemergte PRs (30 T.)
- 1
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoftgraph/msgraph-sdk-python-core
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
Logging to root logger Offenstatus:waiting-for-triage type:bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
status:waiting-for-triage type:bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
microsoftgraph/msgraph-sdk-python-core#1030 · 2 Kommentare · 4 Reaktionen ·
-
status:waiting-for-triage type:feature
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 52/100
-
status:waiting-for-triage type:bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 48/100
Alle Issues in microsoftgraph/msgraph-sdk-python-core
Ähnliche Issues
-
triage/confirmed
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
apache/cloudstack#14222 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100