fake_useragent库—随机生成请求头
ua=UserAgent() #对象 实例化
ua.chrome #生成谷歌浏览器的对象
ua.firefox
import requests
from fake_useragent import UserAgent
url='https://maoyan.com/board/4?offset=0'
ua=UserAgent()
headers={'user-agent':ua.random}
requests.get(url,headers=headers)