user.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:PyMoe 作者: ccubed 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号