Multiple request header configuration information, and random information

# Plurality of configuration request header information, and random information

A plurality of configuration request header
using randomly selected random information
word does not say, directly on the code

 

 

import random

# Configuration request header, random information
AGENT1 = 'the Mozilla / 5.0 (the Windows NT 6.1; the WOW64; RV: 6.0) the Gecko / 20,100,101 Firefox / 6.0'
Agent 2 = 'the Mozilla / 5.0 (the Windows NT 6.1; the WOW64) AppleWebKit / 535.1 ( KHTML, like the Gecko) the Chrome / 14.0.835.163 Safari / 535.1 '
agent3 =' the Mozilla / 5.0 (the Windows NT 6.1; the WOW64) AppleWebKit / 534.50 (KHTML, like the Gecko) Version / 5.1 Safari / 534.50 '
agent4 =' the Mozilla / 4.0 ( compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident / 5.0; SLCC2; the .NET the CLR 2.0.50727; the CLR the .NET '\
' 3.5.30729; the .NET the CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E; 2.X MetaSr SE 1.0) '
agent5 =' the Mozilla / 5.0 (compatible; MSIE 9.0; the Windows NT 6.1; the WOW64; Trident / 5.0; SLCC2; .NET the CLR 2.0.50727;. NET CLR '\
'3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E) '

list1 = [agent1, agent2, agent3, agent4, agent5]

The random.choice = Agent (List1)
# print request header
print (agent)

header = {
'User-Agent': agent
}


See specific use https://blog.csdn.net/weixin_44752021/article/details/102600359

What do not understand or if you have any advice welcome comments on this article!
Thank you

 

Guess you like

Origin www.cnblogs.com/chx123/p/11707046.html