annotate pyikriam/createAccount.py @ 220:5fa938cbe058

Class of account creater
author kevin@tombear.tombears.com
date Tue, 04 Nov 2008 18:28:28 +0800
parents
children f3502833be7c
rev   line source
220
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
1 import urllib2,urllib
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
2
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
3 from ikariam import fake_moz
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
4 from lazy.www import c
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
5
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
6 class CreateAccount:
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
7 """
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
8 For create sheep to cheat. take care of the ip address & email check by yourself.
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
9 """
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
10 def __init__(self,account,email,password,server):
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
11 self.account=account
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
12 self.password=password
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
13 self.server=server
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
14 self.email=email
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
15 headers=[('Referer','http://'+self.server[self.server.find('.')+1:]+'/register.php')]
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
16 self.browser = fake_moz(headers)
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
17 urllib2.install_opener(self.browser)
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
18 pass
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
19
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
20 def ca(self):
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
21 self.baseurl='http://'+self.server
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
22 params = {
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
23 "function":"createAvatar",\
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
24 "name":self.account,\
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
25 "email":self.email,\
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
26 "password":self.password,\
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
27 "agb":"on"}
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
28 self.ret=c(self.baseurl+'/index.php?action=newPlayer').get(params).get_content()
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
29 pass
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
30
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
31 class confirme:
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
32 def __init__(self,confirmeurl):
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
33 self.confirmeurl=confirmeurl
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
34 self.browser = fake_moz()
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
35 urllib2.install_opener(self.browser)
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
36 pass
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
37
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
38 def run(self):
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
39 self.ret=c(self.confirmeurl).get().get_content()
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
40 pass
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
41
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
42 """
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
43 ikariamca=CreateAccount('someac','kevin@butyshop.com','contest123','s2.ikariam.tw')
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
44 a=ikariamca.ca()
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
45 confirme("http://s2.ikariam.tw/index.php?action=newPlayer&function=validateEmail&hash=c239c92a94690066078ca95c993d348b&id=70997").run()
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
46 """
5fa938cbe058 Class of account creater
kevin@tombear.tombears.com
parents:
diff changeset
47