You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.4 KiB
36 lines
1.4 KiB
import base64
|
|
import json
|
|
import time
|
|
import requests
|
|
import selenium
|
|
service = Service(executable_path=r'D:\ide\anaconda\chromedriver.exe')
|
|
browser = webdriver.Chrome(service=service)
|
|
data = load_workbook('1.xlsx')
|
|
sheetnames = data.get_sheet_names()
|
|
sheet = data.get_sheet_by_name(sheetnames[0])
|
|
sheet = data.active
|
|
nrows = sheet.max_row
|
|
list1 = ['A','B','C','D','E','F','G','H','J','K','L','M','N','O','P','Q','R','S','T','W','X','Y','Z']
|
|
browser.get('http://www.iplant.cn/frps/cname/'+str(j)+'')
|
|
a = browser.find_element(By.XPATH,'//*[@id="voldiv"]/div[3]/table/tbody/tr[2]/td[2]/div['+str(i)+']/a').get_attribute("href")
|
|
b = a[26:]
|
|
c = b[:-4]
|
|
d = c.replace('%20','+')
|
|
e = c.replace('%20',' ')
|
|
url = 'http://www.iplant.cn/ashx/getfrps.ashx?key='+str(d)
|
|
url1 = 'http://www.iplant.cn/ashx/getcol.ashx?name='+str(e1,'utf-8')
|
|
headers = {'content-type': 'application/json', 'Api-Token': '4c67f2c4e0b72a5fd1aac6a461c5c1b0'}
|
|
r = requests.get(url, verify=False, headers=headers)
|
|
sheet.cell(nrows + 1, 1).value = "name"
|
|
sheet.cell(nrows + 1, 2).value = "posi"
|
|
sheet.cell(nrows + 1, 3).value = "result"
|
|
sheet.cell(nrows + 1, 4).value = "jie"
|
|
sheet.cell(nrows + 1, 5).value = "men"
|
|
sheet.cell(nrows + 1, 6).value = "gang"
|
|
sheet.cell(nrows + 1, 7).value = "mu"
|
|
sheet.cell(nrows + 1, 8).value = "ke"
|
|
sheet.cell(nrows + 1, 9).value = "shu"
|
|
|
|
data.save('3s.xlsx')
|
|
data.close()
|
|
print("Excel 文件已创建并数据已追加成功!") |