Python Call | Modifying sdk examples are not pulling in everything
Hi Team,
I am able to generate my token and authenticate fine using the SDK; However having difficulty getting fields back that I want.
For example in the get events call (https://developer.box.com/reference/get-events/)
stream_position = 100
events = client.events().get_events(stream_type="admin_logs")
stream_position = events['next_stream_position']
for event in events['entries']:
print('Got {0} event that occurred at {1}'.format(event.event_type, event.created_at))
This returns fine what is in the format.. example output:
Got EDIT_USER event that occurred at 2021-03-31T08:39:02-07:00
However, I am trying to get either the full response that is listed in that link under "Response Example". Are you able to provide me an alternate call to pull that entire response form the admin logs?
Also, can you explain to me how I can add elements like 'name' and 'login' to the existing SDK call? I tried a handful of ways by explicitly defining but still not coming. When I try to "print(events)", it only returns
Event>, <Box Event>, <Box Event>, <Box Event>, <Box Event>, <Box Event>, <Box Event>]
Thanks!
-
Official comment
Hi Kishan,
The response you are currently receiving should have all the fields to match the response on our documentation site. You just need to parse the JSON object like you do in the print statement for the various fields you want to print or stringify the entire json blob per entry and print that.
I'm not sure I understand what you mean by adding name and login to the sdk call? can you elaborate?
Thanks,
Alex, Box Developer Advocate
Comment actions
Please sign in to leave a comment.
Comments
1 comment