Skip to main content
Question

Stream_position parameter API | Python

  • May 22, 2025
  • 1 reply
  • 15 views

Forum|alt.badge.img

Team -- Need help with getting data from the next stream

I'm using the following code snippet:

events = client.events().get_admin_events(created_after='2022-05-10T22:02:24-07:00', event_types=['DOWNLOAD'])

stream_position = events['next_stream_position']

events = client.events().get_admin_events(created_after='2022-05-10T22:02:24-07:00', event_types['DOWNLOAD'],stream_position=stream_position)
However, I get the following error: 
TypeError: Events.get_admin_events() got an unexpected keyword argument 'stream_position'

I followed the following documentation:

https://github.com/box/box-python-sdk/blob/main/docs/usage/events.md

https://github.com/box/box-python-sdk/blob/1dd77709e6e93c218650fddc6251a0805cfd1008/boxsdk/object/events.py

 

My understanding is that the only way to get the data for the next stream is to use the parameter stream_position 

Can you please let me know what am I missing?

 

1 reply

Forum|alt.badge.img

Looks like you have a typo. Its not actually rejecting the stream_position argument. Its not expecting any argument to be there because the argument before it is malformed. You're missing the '='. Try changing:

events = client.events().get_admin_events(created_after='2022-05-10T22:02:24-07:00', event_types['DOWNLOAD'],stream_position=stream_position)

to

events = client.events().get_admin_events(created_after='2022-05-10T22:02:24-07:00', event_types=['DOWNLOAD'],stream_position=stream_position)