一品网
  • 首页

fake-useragent库自动生成User-Agent


安装方法

pip(3) install fake-useragent

使用方法如下:

import requests
from fake_useragent import UserAgent
ua = UserAgent()
headers = {'User-Agent': ua.random}
url = '待爬网页的url'
resp = requests.get(url, headers=headers)
python爬虫

相关


python爬虫

Python爬虫--beautifulsoup 4 用法

python爬虫笔记

python爬虫入门 之 requests 模块

Python爬虫基础(二)--beautifulsoup-美丽汤框架介绍

Python爬虫-解析网页之Re库

【Python爬虫】新发现一个高质量跳舞视频网站爬一下试试,男生都喜欢

python爬虫执行js代码-execjs

python爬虫-京东商品爬取

python爬虫(爬取图片)

python爬虫 关于Max retries exceeded with url 的错误

Python爬虫实战一之爬取糗事百科段子

标签

一品网 冀ICP备14022925号-6