it is my first time posting here so forgive me if my question is not up to par. As part of my job duties, I have to run API scripts from time to time though I really only have a basic understanding of python. 

Below is a while loop:

```
hasMoreEntries = events['has_more'];
while (hasMoreEntries):
    url = "https://api.dropboxapi.com/2/team_log/get_events/continue"

    headers = {
        "Authorization": 'Bearer %s' % aTokenAudit,
        "Content-Type": "application/json"
    }

    data = {
        "cursor": events['cursor']
    }

    r  = requests.post(url, headers=headers, data=json.dumps(data))
    events = r.json()
    hasMoreEntries = events['has_more'];

    for event in events['events']:
        counter+=1;

print 'member id %s has done %s activites' % (memberId, counter)

```

From my understanding, the while loop will continuously count events and add to the counter. Because some users have too many events, I was thinking of stopping the counter at 5000 but not sure how to do so. Would adding an if/else somewhere work?