') self.br.select_form(nr=0) self.br.form['status'] = 'test' self.br.submit(nr=1) #這是隱私和同步 self.br.select_form(nr=0) #僅自己可見 self.br.find_control(type="checkbox").items[0].selected=true #設定並返回 self.br.submit(nr=1) #簽到 self.br.select_form(nr=0)# -*- coding: utf-8 -*-
import mechanize
import cookielib
import sys
from beautifulsoup import beautifulsoup
class checkin:
def __init__(self,url):
self.br = mechanize.browser()
self.id = "your id"
self.pwd= "your pwd"
self.url= url
def setcookie(self,user,password):
self.id = user
self.pwd= password
def setbrowser(self):
###設定一些引數,因為是模擬客戶端請求,所以要支援客戶端的一些常用功能,比如gzip,referer等
#設定header
self.br.addheaders = [('user-agent', 'mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.1.11) gecko/20100701 firefox/3.5.11')]
def login(self):
response = self.br.open(self.url)
self.br.select_form(nr=0)
self.br.form['user'] = self.id
self.br.form['pwd'] = self.pwd
self.br.submit()
print "login successfully"
def checkin(self):
self.br.follow_link(text = '簽到')
self.br.select_form(nr = 0)
self.br.form['q'] = 'your addr'
self.br.submit()
self.br.follow_link(text='
your addr
self.br.submit(nr=0) def printpage(self): checkin_content = self.br.response().read() file = open("c:\\users\\yaomian\\desktop\\3.html", "wb") file.write(checkin_content)def main(): jiepang = checkin("") jiepang.setbrowser() jiepang.login()
jiepang.checkin() jiepang.printpage()if __name__ == "__main__": main()
Python自動簽到打卡
通過 selenium 框架來實現自動打卡 導庫 usr bin env python3 coding utf 8 software pycharm virtualenv workon contact 1040691703 qq.com desc code descripton author 未昔 ...
用python實現的NYOJ自動簽到程式
程式簡介 使用說明 import requests from bs4 import beautifulsoup deflogin check response 抓取獲得登入結果 soup beautifulsoup response.text,html.parser lists soup.find ...
delphi實現discuz論壇自動簽到功能
思路 本來是想使用idhttp模擬提交頁面,無奈cookies沒模擬成功,那就使用最笨的方法,模擬滑鼠指標點選。獲取簽到頁面提交的引數,自己寫個提交的頁面 sign.html,delphi中的webbrowser開啟sign.html,在23點58分時開啟程式,timer每隔500ms去點選提交按鈕...