import requests
import json
import urllib
from lxml import etree
import subprocess
import re
import threading
import time
import os
from openpyxl import workbook
from openpyxl import load_workbook
import time
import base64
import json
import requests
timestamp=time.time()#获当前时间的时间戳
headers={
'Host': 'www.faxuanyun.com',
'Connection': 'keep-alive',
'Host': 'www.faxuanyun.com',
'Connection': 'keep-alive',
'Cache-Control': 'max-age=0',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.69 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/,signed-exchange;v=b3;q=0.9',
'Referer': 'http://www.faxuanyun.com/rg.html',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'zh-CN,zh;q=0.9',
}
url='http://www.faxuanyun.com'
page_text = requests.get(url=url,headers=headers).text
tree = etree.HTML(page_text)
link = tree.xpath("//p/img[@id='login_validateImg']/@src")
# print(link)
for site in link:
print(site)
import time
t = int(time.time())
yanurl='http://www.faxuanyun.com'+site
print(yanurl)
#links='http://www.faxuanyun.com/service/gc.html?timestamp=%s'%(t)+'000'
urllib.request.urlretrieve(yanurl , filename='C:/Users/wangweiwei/Desktop/xuexi/image/1.jpg')
def base64_api(uname, pwd, img, typeid):
with open(img, 'rb') as f:
base64_data = base64.b64encode(f.read())
b64 = base64_data.decode()
data = {"username": uname, "password": pwd, "typeid": typeid, "image": b64}
result = json.loads(requests.post("http://api.ttshitu.com/predict", json=data).text)
if result['success']:
return result["data"]["result"]
else:
return result["message"]
return ""
if __name__ == "__main__":
img_path = "C:/Users/wangweiwei/Desktop/xuexi/image/1.jpg"
result = base64_api(uname='******', pwd='******', img=img_path, typeid=3)
print(result)
code=result
phone='******'
mima='xz123456'
# code1=result
denglu_url='http://www.faxuanyun.com/bss/service/userService!doUserLogin.do?userAccount=%s&userPassword=%s&code=%s'%(phone,mima,code)
# denglu_url='http://www.faxuanyun.com/bss/service/userService!doUserLogin.do?userAccount=********&userPassword=*********&code=code=%s&rid=a66b77220566d72569da0d843ceee221&key=287'(code)
request = requests.post(url=denglu_url)
print(request)
content=request.content.decode()
print(content)