def __init__(self, n, image): self.master=Tk() self.master.resizable(width=FALSE, height=FALSE) self.name=n self.logIn="" if n=="": self.name="guest" self.LogIn=engine.login("guest") else: #try: self.LogIn=engine.login(name=self.name) #except: #try: #engine.utility.createuser(self.name) #self.LogIn=engine.login(name=self.name) #except: # pass #creating a canvas to put an image on it self.canvas=Canvas(self.master, bg="white", height=500, width=800) self.canvas.pack() #putting a background image on the canvas self.photo=ImageTk.PhotoImage(Image.open(image)) self.canvas.create_image(385, 200, image=self.photo)
def crawl_table(request): # 세션에서 저장해놓은 사용자 아이디와 비밀번호 가져오기 user_id = request.session['user_id'] user_pwd = request.session['user_pwd'] # 로그인 재진행 user_response, session = engine.login(user_id, user_pwd) # 사용자 학과 user_depart = request.POST.get('major') # 복수전공 확인 변수 ('True' / 'False' ) 로 들어옴 double_chk = bool(request.POST.get('double_chk')) # 외국인 여부 foreigner = bool(request.POST.get('foreigner')) # 학부 이름 depart_name = request.POST.get('depart_name') depart_name = depart_name.replace('ㆍ', '').replace('▶', '') if double_chk is True: # 복수전공 double_major = request.POST.get('double_major') else: # 단일전공이면 False로 변경 double_major = False table = engine.crawl_table(session) result = checker.check(user_id[:4], major_1=user_depart, major_2=double_major, foreigner=foreigner, records=table, depart_name=depart_name) grade = ['교양학점', '본전공학점', '복수전공학점', '총학점'] context = { 'result': result, 'grade': grade, } return render(request, 'main/result.html', context)
def crawling(request): user_id = request.POST.get('user_id') user_pwd = request.POST.get('user_pwd') request.session['user_id'] = user_id request.session['user_pwd'] = user_pwd user_response, session = engine.login(user_id, user_pwd) if engine.login_check(user_response, session): depart_name, department, foreigner = engine.get_user_info(session) double_major = engine.check_double_major(session) context = { 'depart_name': depart_name, 'department': department, 'foreigner': foreigner, 'double_major': double_major, } return render(request, 'main/user_detail.html', context) else: del request.session['user_id'] del request.session['user_pwd'] return render(request, 'main/login_fail.html')
#!/usr/bin/python import engine as engine import logging import sys import time import settings engine = engine.engine() try: while True: print '=== start loop', time.strftime("%c"), '===' sendProbes = False # time.localtime().tm_hour >= 22 or time.localtime().tm_hour < 8 # sys.exit() own = engine.login('login', 'password') print own if sendProbes: if not own['probes']: engine.attack(sendProbes) else: numberOfAttacks = 7 if time.localtime().tm_hour >= 15 and time.localtime( ).tm_hour < 22 or time.localtime().tm_wday > 4: numberOfAttacks = 5 for i in range(0, numberOfAttacks - own['attacks']): engine.attack()
def calllogin(): return engine.login(request)
else: displaystring="I can't definitely say,\n but I think you can go with\noption .. " displaystring+=ans root=Tk() root.title("Expert's Advice") root.configure(background="white") root.geometry("500x500") im=Image.open(self.expertimage) image=ImageTk.PhotoImage(im) size=12 tempfont = tkFont.Font(family='Helvetica',size=size,name="font%s" %size) newcanvas=Canvas(root,width=500,height=500,bg='white') size=15 tempfont1 = tkFont.Font(family='Helvetica',size=size,name="font%s" %size) size=20 tempfont2 = tkFont.Font(family='Helvetica',size=size,name="font%s" %size) newcanvas.place(x=0,y=0,relheight=1,relwidth=1) newcanvas.create_image(225,120,image=image) newcanvas.create_text(250,300,text=self.expertname+"\nSays..,\n"+displaystring,font=tempfont2) quit_button=Button(root,text="QUIT",bd=2,bg="honeydew2",command=root.destroy) quit_button.place(x=300,y=450) root.mainloop() l=login("guest") obj=lifelines(l) obj.phone_a_friend('B',14) obj.view_expert() obj.expert_advice('A',"MY") obj.audiencepoll('C',12) #l.currentplayer.close()