def activity_profile_get(req_dict): # Instantiate ActivityProfile ap = ActivityProfileManager() # Get profileId and activityId profileId = req_dict['params'].get('profileId', None) if 'params' in req_dict else None activityId = req_dict['params'].get('activityId', None) if 'params' in req_dict else None #If the profileId exists, get the profile and return it in the response if profileId: resource = ap.get_profile(profileId, activityId) if resource.profile: response = HttpResponse(resource.profile.read(), content_type=resource.content_type) else: response = HttpResponse(resource.json_profile, content_type=resource.content_type) response['ETag'] = '"%s"' % resource.etag return response #Return IDs of profiles stored since profileId was not submitted since = req_dict['params'].get('since', None) if 'params' in req_dict else None resource = ap.get_profile_ids(activityId,since) response = HttpResponse(json.dumps([k for k in resource]), content_type="application/json") response['since'] = since return response