安装模块

pip install fake_useragent

生成user agent

import requests
from fake_useragent import UserAgent

ua = UserAgent()
headers = {'User-Agent': ua.random}

requests.get(url, headers=headers)
posted on 2021-06-23 11:44  jaysonteng  阅读(474)  评论(0编辑  收藏  举报