Encountered verification problems when grabbing WeChat public account articles under Linux! ! ! ! ! ! ! !
This is the People’s Daily link I want to grab: http://mp.weixin.qq.com/profile?src=3×tamp=1492739045&ver=1&signature=bSSQMK1LY77M4O22qTi37cbhjhwNV7C9V4aor9HLhAvbGc2ybWX*qg3WqxntZ7iq0kvYe87oP pcSJKFdmGMx5g==
1: First of all, accessing on the browser is normal.
2: The access prompt under Linux requires verification. The following is a simple code
url = http://mp.weixin.qq.com/profile?src=3×tamp=1492738883&ver=1&signature=bSSQMK1LY77M4O22qTi37cbhjhwNV7C9V4aor9HLhAvbGc2ybWX*qg3WqxntZ7iq2xTLUTfxAMzK79UGvalY1A==
response = urllib2.urlopen(url)
print response.read()
The results of the visit are as follows:
Additional explanation of how to obtain the link to the public account:
1: First visit the link: http://weixin.sogou.com/weixi...
2: Then obtain the link to the People's Daily public account. jump.
Can it be captured without simulating the request header? It is recommended to simulate the request header first and try again
Now after adding the header to the request, the error returned is as follows. Please give me some more tips
You can use request, the local environment is Mac OSX, python3.6.1
The content is in the line with the red box