xiluoc un pc pour les unirs .... | d'attendre:
Voila ca vous evitera de cliquer refresh
- v0.2 ptit correction HEC checker
Python http://www.python.org/
Pour fair un son sous win effacer la method beep
ajouter import winsound au debut du programme
et a la place de #BEEP vous mettez Beep(440, 63)
http://docs.python.org/lib/module-winsound.html
Bon jespere que ca vas marche jai pas vraiment teste hehe
Windows:
- Demarrer / python / python idle
- copiez-y le code
- effacezla methode Beep ligne 23:30
- ajoutez : import winsound, ligne 4
- ligne 90 beep devient Beep(440,60)
- puis run
Code :
- #!/usr/bin/python
- # HEC checker
- import urllib
- import urllib2
- import os
- import time
- email = "email"
- password = "ur pass"
- urlformulaire = "http://appli3.hec.fr/Miel/logEspace.jsp"
- urlespace = "http://appli3.hec.fr/Miel/ctrlCpteProsCand"
- urlresults = 'http://appli3.hec.fr/Miel/suiviCandidature.jsp'
- delay_sec = 5
- user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
- referer1 = 'http://appli3.hec.fr/Miel/logEspace.jsp'
- referer2 = 'http://appli3.hec.fr/Miel/accueilEspace.jsp'
- def beep(frequency, amplitude, duration):
- sample = 8000
- half_period = int(sample/frequency/2)
- beep = chr(amplitude)*half_period+chr(0)*half_period
- beep *= int(duration*frequency)
- audio = file('/dev/audio', 'wb')
- audio.write(beep)
- audio.close()
- def main():
- current_result = ""
- session_id = get_session_id()
- #post our credential to the "espace en ligne" page
- response = login(session_id)
- while True:
- # nex step the scores !
- response = read_score_page(session_id)
- current_result_page_content = check_scores(response, current_result)
- def get_session_id():
- print "get session id"
- req = urllib2.Request(urlresults)
- response = urllib2.urlopen(req)
- the_page = response.read()
- return response.info()['Set-Cookie']
- def login(session_id):
- req = urllib2.Request(urlformulaire)
- response = urllib2.urlopen(req)
- the_page = response.read()
- values = {'typeAcces' : "2",
- 'emailCompte' : email,
- 'pwdCompte' : password }
- headers = {'User-Agent' : user_agent,
- 'Referer': referer1,
- 'Cookie': session_id,
- 'Connection': 'keep-alive',
- 'Keep-Alive': '300',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Content-Length': '61',}
- data = urllib.urlencode(values)
- req = urllib2.Request(urlespace, data, headers)
- response = urllib2.urlopen(req)
- print "loged in "
- return response
- def read_score_page(sessionid):
- print "read score"
- data = None
- headers = {'User-Agent' : user_agent,
- 'Referer': referer2,
- 'Cookie': sessionid,
- 'Connection': 'keep-alive',
- 'Keep-Alive': '300',}
- req2 = urllib2.Request(urlresults, data, headers)
- response2 = urllib2.urlopen(req2)
- return response2
- def check_scores(response, current_result):
- if "Suivi de votre candidature" not in response.read():
- main()
- html = response.read()
- if html != current_result and current_result != "":
- #BEEP
- beep(440, 63, 1)
- os.exit()
- else:
- print "not yet"
- current_result = html
- time.sleep(delay_sec)
- return response
- if __name__ == '__main__':
- main()
|
Message édité par xiluoc le 11-05-2007 à 16:45:21
|