查詢稿件狀態並上傳郵箱,很多國內期刊模板一致隨意改動
# -*- coding: utf-8 -*-
# @time : 2019/12/1 22:17
# @author : yemanzhongting
# @email : [email protected]
# @file : 1.py
# @software: pycharm
# !/usr/bin/python
# -*- coding: utf-8 -*-
import smtplib,time
from email.mime.text import mimetext
from email.header import header
from email.mime.image import mimeimage
from email.mime.multipart import mimemultipart
import datetime
import threading
from selenium import webdriver
def getdata():
driver=webdriver.chrome(r'd:\arcgisserver\chromedriver.exe')
driver.get('')
driver.find_element_by_xpath('//*[@id="user_name"]').send_keys('yemanzhongting')
driver.find_element_by_xpath('//*[@id="password"]').send_keys('')#whu3_13
driver.find_element_by_xpath("//input[@onclick='login()']").click()
#driver.implicitly_wait(3)
time.sleep(5)
driver.find_element_by_xpath('/html/body/table/tbody/tr[2]/td/table/tbody/tr[3]/td[3]/table[1]/tbody/tr[3]/td[3]/table/tbody/tr[1]/td/a').click()
time.sleep(5)
#/html/body/table/tbody/tr[2]/td/table/tbody/tr[3]/td[3]/table[1]/tbody/tr[3]/td[3]/table/tbody/tr[1]/td/a
#driver.find_elements_by_css_selector('body > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(3) > td:nth-child(3) > table:nth-child(2) > tbody > tr:nth-child(3) > td:nth-child(3) > table > tbody > tr:nth-child(1) > td > a')
driver.find_element_by_xpath('//*[@id="_div"]/table[2]/tbody/tr/td[2]/table/tbody/tr[4]/td[2]/a').click()
time.sleep(8)
a=driver.find_element_by_xpath('/html/body/center/div[1]/table/tbody/tr[1]/td/table/tbody/tr[4]/td[3]/font')
tmp=a.text
driver.quit()
return tmp
def sendemail():
message = mimetext(content, 'plain', 'utf-8') # 內容, 格式, 編碼
message['from'] = "{}".format(sender)
message['to'] = ",".join(receivers)
message['subject'] = title
try:
smtpobj = smtplib.smtp_ssl(mail_host, 465) # 啟用ssl發信, 埠一般是465
smtpobj.login(mail_user, mail_pass) # 登入驗證
smtpobj.sendmail(sender, receivers, message.as_string()) # 傳送
print("mail has been send successfully.")
except smtplib.smtpexception as e:
print(e)
# def send_email2(smtp_host, from_account, from_passwd, to_account, subject, content):
# email_client = smtplib.smtp(smtp_host)
# email_client.login(from_account, from_passwd)
# # create msg
# msg = mimetext(content, 'plain', 'utf-8')
# msg['subject'] = header(subject, 'utf-8') # subject
# msg['from'] = from_account
# msg['to'] = to_account
# email_client.sendmail(from_account, to_account, msg.as_string())
## email_client.quit()
def all():
con = getdata()
sender = '[email protected]'
receivers = ['[email protected]'] # 接收郵件,可設定為你的qq郵箱或者其他郵箱
# 第三方 smtp 服務
mail_host = "smtp.163.com" # smtp伺服器
mail_user = "" # 使用者名稱 葉滿
mail_pass = "whu313" # 授權密碼,非登入密碼
content = con
title = '人生苦短' # 郵件主題
sendemail()
def sleeptime(hour, min, sec):
return hour * 3600 + min * 60 + sec;
if __name__ == '__main__':
second = sleeptime(12, 0, 0);
while 1 == 1:
con = getdata()
sender = '[email protected]'
receivers = ['[email protected]'] # 接收郵件,可設定為你的qq郵箱或者其他郵箱
# 第三方 smtp 服務
mail_host = "smtp.163.com" # smtp伺服器
mail_user = "" # 使用者名稱 葉滿
mail_pass = "whu313" #
content = con
title = '人生苦短' # 郵件主題
sendemail()
time.sleep(second);
2018 4 21 山東大學學習資源聚合平台工作
今天我主要與同學討論了一下路由問題 應當採用knowledges question id獲取到資訊 而不是採用course id knowledges question id 也許第二條路由資訊看起來更加易於理解,與model的組織形式相符,但是當想做主頁的精品推薦的時候,就必須去先進入某個cour...
2018 5 27 山東大學學習資源聚合平台工作
今天做了摘要的自動生成和手動新增操作 如果使用者選擇自動方式,就會呼叫後台的函式自動為其生成摘要,現在這個演算法只是取前面幾個字元做為摘要,後期再改進演算法,當使用者選擇手動時就可以手動輸入自己的摘要 同時在controller中新加操作 同時,同步了question和resource的介面 接下來...
2018 6 5 山東大學學習資源聚合平台工作
下面是實現的 接下來就是實現ngd演算法公式 public double getrelative string keyword1,string keyword2 double fenzi double math.max math.log fx math.log fy math.log fxy dou...