UnicodeEncodeError: ‘latin-1‘ codec can‘t encode characters in position 41-44: Body (‘学术快报‘) is not

一、问题解决:
需要修改json 的 编码方式

import requests
import json
data = {"input":"jxyg20240909002","genType":"学术快报","uuid":"b433727d-0759-4fc1-a8a9-f4ad5e877d5d","break":0,"mainHyPlatform":"EKRPT"}


res = requests.get("http://192.168.4.211:8011/gpt", data = json.dumps(data,ensure_ascii=False).encode("utf8"),stream = True)   #忽略ssh证书
for w in res.iter_content(decode_unicode="utf8",chunk_size=1024):
    w = w[5:].strip()
    print(w)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值