def update(self, uid, data, token):
"""
Update a user's data. Requires an auth token.
:param uid str: User ID to update
:param data dict: The dictionary of data attributes to change. Just the attributes.
:param token str: The authorization token for this user
:return: True or Exception
:rtype: Bool or ServerError
"""
final_dict = {"data": {"id": uid, "type": "users", "attributes": data}}
final_headers = self.header
final_headers['Authorization'] = "Bearer {}".format(token)
r = requests.patch(self.apiurl + "/users/{}".format(uid), json=final_dict, headers=final_headers)
if r.status_code != 200:
raise ServerError
return True
评论列表
文章目录