Created
June 18, 2020 21:02
-
-
Save philerooski/12ac6b88b880ed934bc4d414ec5c3e77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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