I am trying to format oauth token logs pulled from Google Workspace API using python. The objects returned from the google API call use a mix of formats.
Some sections are formatted like "kind": "admin#reports#activity", which is preferred, while other sections are formtted like "name": "api_name", "value": "caldav". How can I rewrite the sections formatted like the second example to match the first example? "name": "api_name", "value": "caldav" would become "api_name" : "caldav".
Sample log returned (some sections have been redacted):
{"kind": "admin#reports#activity", "id": {"time": "2022-07-13T11:45:59.181Z", "uniqueQualifier": "<redacted>", "applicationName": "token", "customerId": "<redacted>"}, "etag": "<redacted>", "actor": {"email": "<redacted>", "profileId": "<redacted>"}, "ipAddress": "<redacted>", "events": [{"type": "auth", "name": "activity", "parameters": [{"name": "api_name", "value": "caldav"}, {"name": "method_name", "value": "caldav.calendars.report"}, {"name": "client_id", "value": "<redacted>"}, {"name": "num_response_bytes", "intValue": "165416"}, {"name": "product_bucket", "value": "CALENDAR"}, {"name": "app_name", "value": "<redacted>"}, {"name": "client_type", "value": "<redacted>"}]}]}
Thanks,
Dan