Skip to content

Instantly share code, notes, and snippets.

@philerooski
Created June 18, 2020 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philerooski/12ac6b88b880ed934bc4d414ec5c3e77 to your computer and use it in GitHub Desktop.
Save philerooski/12ac6b88b880ed934bc4d414ec5c3e77 to your computer and use it in GitHub Desktop.
import bridgeclient # https://github.com/larssono/bridgeclient
import functools
def get_bridge_client(email, password, study):
bridge = bridgeclient.bridgeConnector(email, password, study=study)
return bridge
"""
Defaults to fetching records from the previous 24 hours
`start_time` and `end_time` are iso8601 strings
"""
def get_upload_history(user_id, bridge, start_time=None, end_time=None):
response = bridge.restGET(
f"/v3/participants/{user_id}/uploads",
data = {"startTime": start_time, "endTime": end_time})
return response
def get_all_participants(bridge):
all_participants = bridge.getParticipants()
return all_participants
# get upload history from previous 24 hours for all participants
def main():
bridge = get_bridge_client(your_email, your_password, your_study)
all_participants = get_all_participants(bridge)
uploads_from_previous_24_hours = all_participants.id.apply(
functools.partial(get_upload_history, bridge=bridge))
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment