We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

J_Matsumoto's avatar
J_Matsumoto
Explorer | Level 4
8 years ago

Confirmation of audit log

I'd like to check the audit log using python module.

 

TEAM_AUDIT_TOKEN = 'xxxxxxx'
dbx_team = dropbox.DropboxTeam(TEAM_AUDIT_TOKEN)
dbx_user = dbx_team.as_user("dbmid:xxxxxx")
end_time = dt.datetime.now()
start_time = end_time - dt.timedelta(hours=2)
check_times = dropbox.team_common.TimeRange(start_time,end_time)
res = dbx_user.team_log_get_events(
limit=None,
account_id=None,
time=check_times,
category=dropbox.team_log.EventCategory.logins)



It's possible to acquire below.

GetTeamEventsResult(events=None, cursor='xxxxxxxxxxxxxx, has_more=False)

I want you to tell me how log can be acquired after this.

  • Greg-DB's avatar
    Greg-DB
    8 years ago

    It looks like the issue is the timezone that datetime.now is using by default. When interacting with the API, you should use UTC. So, instead of:

     

    end_time = dt.datetime.now()

     

    you can use:

     

    end_time = dt.datetime.utcnow()

     

  • J_Matsumoto's avatar
    J_Matsumoto
    Explorer | Level 4

    Is time of the log record late for 24 hours?


    start_time = end_time - dt.timedelta(hours=33)

     

    (24 hours before, +JST-9:00)

     

    If it was changed, it could be acquired.

    • Greg-DB's avatar
      Greg-DB
      Icon for Dropbox Staff rankDropbox Staff

      It looks like the issue is the timezone that datetime.now is using by default. When interacting with the API, you should use UTC. So, instead of:

       

      end_time = dt.datetime.now()

       

      you can use:

       

      end_time = dt.datetime.utcnow()

       

      • J_Matsumoto's avatar
        J_Matsumoto
        Explorer | Level 4

        Greg

         

        I'm very thankful.

        Can the present designation audit log be acquired only after 24 hours?

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: 5 hours 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!