improving

This commit is contained in:
pezy
2017-11-14 18:01:55 +08:00
parent db264a0b93
commit ffe50b01bb
2 changed files with 26 additions and 7 deletions

View File

@@ -3,20 +3,37 @@
from selenium import webdriver from selenium import webdriver
from time import sleep from time import sleep
import sys
if len(sys.argv) < 3:
print('Usage: python cmd_email.py [sendto] [message]')
sys.exit()
browser = webdriver.Chrome() browser = webdriver.Chrome()
browser.get('https://ui.ptlogin2.qq.com/cgi-bin/login?style=9&appid=522005705&daid=4&s_url=https%3A%2F%2Fw.mail.qq.com%2Fcgi-bin%2Flogin%3Fvt%3Dpassport%26vm%3Dwsk%26delegate_url%3D%26f%3Dxhtml%26target%3D&hln_css=http%3A%2F%2Fmail.qq.com%2Fzh_CN%2Fhtmledition%2Fimages%2Flogo%2Fqqmail%2Fqqmail_logo_default_200h.png&low_login=1&hln_autologin=%E8%AE%B0%E4%BD%8F%E7%99%BB%E5%BD%95%E7%8A%B6%E6%80%81&pt_no_onekey=1') browser.get('https://ui.ptlogin2.qq.com/cgi-bin/login?style=9&appid=522005705&daid=4&s_url=https%3A%2F%2Fw.mail.qq.com%2Fcgi-bin%2Flogin%3Fvt%3Dpassport%26vm%3Dwsk%26delegate_url%3D%26f%3Dxhtml%26target%3D&hln_css=http%3A%2F%2Fmail.qq.com%2Fzh_CN%2Fhtmledition%2Fimages%2Flogo%2Fqqmail%2Fqqmail_logo_default_200h.png&low_login=1&hln_autologin=%E8%AE%B0%E4%BD%8F%E7%99%BB%E5%BD%95%E7%8A%B6%E6%80%81&pt_no_onekey=1')
sleep(2) sleep(1)
try: try:
qq = browser.find_element_by_id('u') qq = browser.find_element_by_id('u')
qq.send_keys('375575128') qq.send_keys('') # qq
password = browser.find_element_by_id('p') password = browser.find_element_by_id('p')
password.send_keys('FzVSIPYk87890310') password.send_keys('') ## qq password
go = browser.find_element_by_id('go') go = browser.find_element_by_id('go')
go.click() go.click()
sleep(1) sleep(1)
password2 = browser.find_element_by_id('pwd') password2 = browser.find_element_by_id('pwd')
password2.send_keys('Cpz87890310') password2.send_keys('') # mail password
password2.submit() password2.submit()
sleep(1)
write = browser.find_element_by_css_selector('.qm_btnIcon')
write.click()
sendto = browser.find_element_by_id('showto')
sendto.send_keys(sys.argv[1])
subject = browser.find_element_by_id('subject')
subject.send_keys('System mail by python')
content = browser.find_element_by_id('content')
content.send_keys(' '.join(sys.argv[2:]))
sleep(2)
submit = browser.find_element_by_css_selector('.qm_btn.qm_btn_Blue')
submit.click()
except: except:
print('Was not able to find an element with your qq.') print('Was not able to find an element with your qq.')

View File

@@ -1,10 +1,12 @@
#!python3 #!python3
# deleting_unneeded_files.py - walks through a folder tree and searches for exceptionally large files or folders. say, # deleting_unneeded_files.py - walks through a folder tree and searches for
# ones that have a file size of more than 100MB. Print these files with their absolute path to the screen. # exceptionally large files or folders. say, ones that have a file size of more
# than 100MB. Print these files with their absolute path to the screen.
import os import os
import shutil import shutil
def deleting_large_files(fd, mega): def deleting_large_files(fd, mega):
for foldername, subfolders, filenames in os.walk(fd): for foldername, subfolders, filenames in os.walk(fd):
for filename in filenames: for filename in filenames:
@@ -13,7 +15,7 @@ def deleting_large_files(fd, mega):
size /= 1024 * 1024 size /= 1024 * 1024
if size > mega: if size > mega:
print(filepath) print(filepath)
#os.unlink(filepath) # os.unlink(filepath)
deleting_large_files("D:\\BaiduNetdiskDownload", 10) deleting_large_files("D:\\BaiduNetdiskDownload", 10)