You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

AdanHerrera's avatar
AdanHerrera
Explorer | Level 3
7 years ago

Python API

I'm working with Python & API v2 I need the following information: If I have a shared folder with several users, is it possible to obtain a record of the users who have visited or downloaded the fi...
  • Greg-DB's avatar
    Greg-DB
    7 years ago

    It looks like you have the right basic idea, but there are a few things to note:

    - You have 'none' instead of 'None'.

    - You can filter by category, which in this case would be 'dropbox.team_log.EventCategory.file_operations'.

    - You can filter by time, which can be good as without a time filter you may have to parse through more events than desired.

    - You need to check GetTeamEventsResult.has_more, and call back to team_log_get_events_continue if it's True.

     

    So, for example, to look for file_download events from the past week, that might look like:

     

    import datetime
    
    import dropbox
    
    access_token = '...'
    dbx_team = dropbox.DropboxTeam(access_token)
    account_id = 'dbid:...'
    time_range = dropbox.team_common.TimeRange(
        start_time=datetime.datetime.now() - datetime.timedelta(days=7))
    
    def handle_events(events):
        print("Processing %s events..." % len(events))
        for event in events:
            if event.event_type.is_file_download():
                print(event)
    
    result = dbx_team.team_log_get_events(
        limit=1000,
        account_id=account_id,
        time=time_range,
        category=dropbox.team_log.EventCategory.file_operations)
    handle_events(result.events)
    
    while result.has_more:
        result = dbx_team.team_log_get_events_continue(result.cursor)
        handle_events(result.events)
  • Greg-DB's avatar
    Greg-DB
    7 years ago
    1. No, unfortunately there isn't a way to filter by path across all members, but I'll pass this along as a feature request.

    2. Also no, it's not possible to filter to a specific event type, but we'll consider this a feature request as well.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 12 months ago
325 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!