1def login(self,ids):
2 try:
3 global br
4 br = mechanize.Browser()
5 br.set_handle_equiv(True)
6 br.set_handle_gzip(True)
7 br.set_handle_redirect(True)
8 br.set_handle_referer(True)
9 br.set_handle_robots(False)
10 br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
11 br.addheaders = [('User-Agent','Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36')]
12 br.open(self.u.format('/login'))
13 br.select_form(nr=0)
14 br.form['email']=ids.split('|')[0]
15 br.form['pass']=ids.split('|')[1]
16 sub=br.submit().read()
17 if 'logout.php' in str(res) or 'mbasic_logout_button' in str(res):
18 self.ganti(ids)
19 else:
20 print(f'[\033[91mFailed\033[0m] {ids}')
21 except: pass