return a dictionary of notes or a collection of notes
@@ -185,12 +185,14 @@ class Client(object):
If the list is emails, returns an array of dictionaries with 'email' and 'profile'"""
tildematch = re.compile('~.+')
if len(email_or_id_list) > 0 and tildematch.match(email_or_id_list[0]):
- att = 'ids'
+ response = requests.post(self.baseurl + '/user/profiles', json={'ids': email_or_id_list})
+ response = self.__handle_response(response)
+ return [Note.from_json(p) for p in response.json()['profiles']]
else:
- att = 'emails'
- response = requests.post(self.baseurl + '/user/profiles', json={att: email_or_id_list})
+ response = requests.post(self.baseurl + '/user/profiles', json={'emails': email_or_id_list})
response = self.__handle_response(response)
- return response.json()['profiles']
+ return { p['email'] : Note.from_json(p['profile'])
+ for p in response.json()['profiles'] }
def post_profile(self, id, content):
response = requests.put(
