Python 调用 百度翻译 出现error997 的解决办法

如果程序不报错,其主要原因是百度防爬虫,可能是因为电脑网页版本的百度翻译防爬所致,换用手机版本的百度翻译暂时可行。这也是很多视频都是用手机版百度翻译来讲解的原因;

大多数换用手机版的也会报997错误,或许是手机也防爬虫了吧,如果用get的方法来爬虫是可以的,但是使用post方法是会报997错误的

以下是我的get方法的爬虫代码,大佬们别喷,我刚学;

import pprint
import requests
url = "http://www.baidu.com"
response = requests.get(url)
# response.encoding="utf-8"
# print(response.text)
#把响应的二进制节流转换为str类型
# print(response.content.decode())
pprint.pprint(response.content.decode())

2019-03-30

文章来自:https://www.cnblogs.com/chuangqi/p/10629791.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3