/opt/miniconda3/envs/project-name/bin/python /Users/xxxx/Library/Application Support/JetBrains/PyCharm2024.1/scratches/scratch.py
Traceback (most recent call last):
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/kiota_serialization_json/json_parse_node.py", line 199, in get_enum_value
return enum_class[camel_case_key] # type: ignore
File "/opt/miniconda3/envs/project-name/lib/python3.10/enum.py", line 440, in __getitem__
return cls._member_map_[name]
KeyError: 'Global'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/xxxx/Library/Application Support/JetBrains/PyCharm2024.1/scratches/scratch.py", line 79, in <module>
response = asyncio.run(get_global_login_pages())
File "/opt/miniconda3/envs/project-name/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/opt/miniconda3/envs/project-name/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/Users/xxxx/Library/Application Support/JetBrains/PyCharm2024.1/scratches/scratch.py", line 74, in get_global_login_pages
result = await graph_client.security.attack_simulation.login_pages.get(request_configuration = request_configuration)
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/msgraph/generated/security/attack_simulation/login_pages/login_pages_request_builder.py", line 68, in get
return await self.request_adapter.send_async(request_info, LoginPageCollectionResponse, error_mapping)
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/kiota_http/httpx_request_adapter.py", line 192, in send_async
value = root_node.get_object_value(parsable_factory)
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/kiota_serialization_json/json_parse_node.py", line 212, in get_object_value
self._assign_field_values(result)
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/kiota_serialization_json/json_parse_node.py", line 281, in _assign_field_values
field_deserializer(JsonParseNode(field_value))
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/msgraph/generated/models/login_page_collection_response.py", line 40, in <lambda>
"value": lambda n : setattr(self, 'value', n.get_collection_of_object_values(LoginPage)),
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/kiota_serialization_json/json_parse_node.py", line 163, in get_collection_of_object_values
return list(
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/kiota_serialization_json/json_parse_node.py", line 165, in <lambda>
lambda x: self._create_new_node(x).get_object_value(factory), # type: ignore
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/kiota_serialization_json/json_parse_node.py", line 212, in get_object_value
self._assign_field_values(result)
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/kiota_serialization_json/json_parse_node.py", line 281, in _assign_field_values
field_deserializer(JsonParseNode(field_value))
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/msgraph/generated/models/login_page.py", line 75, in <lambda>
"source": lambda n : setattr(self, 'source', n.get_enum_value(SimulationContentSource)),
File "/opt/miniconda3/envs/project-name/lib/python3.10/site-packages/kiota_serialization_json/json_parse_node.py", line 201, in get_enum_value
raise Exception(f'Invalid key: {camel_case_key} for enum {enum_class}.')
Exception: Invalid key: Global for enum <enum 'SimulationContentSource'>.
Process finished with exit code 1
Describe the bug
I took the following code from the API documentation:
Expected behavior
The function
await graph_client.security.attack_simulation.login_pages.get(...)should return all login pages.How to reproduce
Minimal working example:
SDK Version
1.4.0
Latest version known to work for scenario above?
No response
Known Workarounds
A workaround is to just write a get request with another library. But that should be done by this SDK, if it would work...
Debug output
Click to expand log
Configuration
I think that problem is not specific to this configuration.
Other information
Taking the same code (minimal working example) and only changing the filter from
filter="source eq 'global'"tofilter="source eq 'tenant'", the SDK call works as expected.The error cause seems to be here:
Copied source code:
The member
Global_seems to cause the problem because of the trailing_. I don't quite understand, why this members needs the trailing_and would be happy to learn more about that.