获取 SDK 有多种方式,较为推荐的方式是通过包依赖管理工具下载最新版本。
pip install python-hifive-openapi
取决于系统环境,可能需要在命令前加 sudo。
首先进入 控制台 > HIFIVE授权管理 获取 appId,serverCode。具体API调用示例详见API接口文档。
// 控制台appId ——> appKey, 控制台serverCode ——> secret, 服务器地址 ——> url
req = hifive.api.HFBaseLoginRequest(url)
req.set_app_info(hifive.appinfo(appKey, secret))
// 如果需要,设置用户身份识别token
// req.set_app_info(hifive.appinfo(appkey, secret, token))
req.clientId = "hf2y7jk19a56qetq05"
req.nickname = "zealot"
req.gender = GenderEnum.MAN.value
req.birthday = "1594639058"
req.location = "30.779164,103.94547"
req.education = EducationEnum.MASTER.value
req.profession = "8"
req.isOrganization = "true"
req.favoriteSinger = "周杰伦"
req.favoriteGenre = "1"
resp = req.getResponse()