简单示例
# -*- coding: utf-8 -*- # @File : fake_useragent_demo.py # @Date : 2018-05-28 from fake_useragent import UserAgent ua = UserAgent() print(ua.ie) print(ua.opera) print(ua.chrome) print(ua.goo gle) print(ua.firefox) print(ua.safari) print(ua.random) """ Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.0; Trident/4.0; InfoPath.1; SV1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 3.0.04506.30) Opera/9.80 (Windows NT 6.0; U; en) Presto/2.7.39 Version/11.00 Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36 Mozilla/5.0 (X11; CrOS i686 3912.101.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0 Mozilla/5.0 (Windows; U; Windows NT 6.1; sv-SE) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4 Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0) Opera 12.14 """