資源簡介
python使用requests模擬登錄帶驗(yàn)證碼的專利網(wǎng)站demo
代碼片段和文件信息
import?requests
import?base64
from?bs4?import?BeautifulSoup
if?__name__?==?‘__main__‘:
????checkHeader?=?{
????????“Host“:?“www.pss-system.gov.cn“
????????“Proxy-Connection“:?“keep-alive“
????????“Cache-Control“:?“max-age=0“
????????“Origin“:?“http://www.pss-system.gov.cn“
????????“Upgrade-Insecure-Requests“:?“1“
????????“User-Agent“:?“Mozilla/5.0?(Windows?NT?10.0;?Win64;?x64)?AppleWebKit/537.36?(KHTML?like?Gecko)?Chrome/60.0.3112.90?Safari/537.36“
????????“Content-Type“:?“application/x-www-form-urlencoded“
????????“Accept“:?“text/htmlapplication/xhtml+xmlapplication/xml;q=0.9image/webpimage/apng*/*;q=0.8“
????????“Referer“:?“http://www.pss-system.gov.cn/sipopublicsearch/portal/uiIndex.shtml“
????????“Accept-Encoding“:?“gzip?deflate“
????????“Accept-Language“:?“zh-CNzh;q=0.8“
????}
????header?=?{
????????“Accept“:?“text?/?html?*?/?*;q?=?0.01“
????????“Accept-Encoding“:?“gzip?deflate“
????????“Accept-Language“:?“zh-CNzh;q=0.8“
????????“Content-Type“:?“application/x-www-form-urlencoded;?charset=UTF-8“
????????“User-Agent“:?“Mozilla/5.0?(Windows?NT?10.0;?Win64;?x64)?AppleWebKit/537.36?(KHTML?like?Gecko)?Chrome/60.0.3112.90?Safari/537.36“
????}
????baseUrl?=?‘http://www.pss-system.gov.cn/sipopublicsearch/patentsearch/tableSearch-showTableSearchIndex.shtml‘
????checkUrl?=?‘http://www.pss-system.gov.cn/sipopublicsearch/wee/platform/wee_security_check‘
????timeUrl?=?‘http://www.pss-system.gov.cn/sipopublicsearch/portal/checkLoginTimes-check.shtml‘
????debugUrl?=?‘http://www.pss-system.gov.cn/sipopublicsearch/portal/sessionDeBugAC.do‘
????codeurl?=?‘http://www.pss-system.gov.cn/sipopublicsearch/portal/login-showPic.shtml‘
????‘‘‘此處改為大家在專利網(wǎng)注冊的賬號‘‘‘
????strName?=?‘‘
????strPass?=?‘‘
????base64Name?=?str(base64.b64encode(bytes(strNameencoding=‘utf-8‘))?‘utf-8‘)
????base64Pass?=?str(base64.b64encode(bytes(strPassencoding=‘utf-8‘))?‘utf-8‘)
????timeData?=?{
?????
評論
共有 條評論