import random
# 先定义一个空的User—Agent列表
userAgent_list = []
# 向空列表追加各个浏览器的User—Agent值
# Opera
userAgent_list.append(
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 OPR/26.0.1656.60')
userAgent_list.append('Opera/8.0 (Windows NT 5.1; U; en)')
userAgent_list.append(
'Mozilla/5.0 (Windows NT 5.1; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.50')
userAgent_list.append(
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.50')
# Firefox
userAgent_list.append(
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0')
userAgent_list.append(
'Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10')
# Safari
userAgent_list.append(
'Mozilla/