Skip to content
Snippets Groups Projects
Commit a9d4c199 authored by Bryan Tong Minh's avatar Bryan Tong Minh
Browse files

Added domain parameter to login

parent 8229965d
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ This is mwclient 0.6.3. The following are the release notes for this version. ...@@ -4,7 +4,7 @@ This is mwclient 0.6.3. The following are the release notes for this version.
== Changes in version 0.6.3 == == Changes in version 0.6.3 ==
Mwclient 0.6.3 is unreleased. Mwclient 0.6.3 is unreleased.
* No changes yet. * Added domain parameter to login.
== Changes in version 0.6.2 == == Changes in version 0.6.2 ==
Mwclient was released on 2 May 2009. Mwclient was released on 2 May 2009.
......
...@@ -274,11 +274,11 @@ class Site(object): ...@@ -274,11 +274,11 @@ class Site(object):
raise errors.EmailError, data raise errors.EmailError, data
def login(self, username = None, password = None, cookies = None): def login(self, username = None, password = None, cookies = None, domain = None):
if self.initialized: self.require(1, 10) if self.initialized: self.require(1, 10)
if username and password: if username and password:
self.credentials = (username, password) self.credentials = (username, password, domain)
if cookies: if cookies:
if self.host not in self.conn.cookies: if self.host not in self.conn.cookies:
self.conn.cookies[self.host] = http.CookieJar() self.conn.cookies[self.host] = http.CookieJar()
...@@ -287,7 +287,10 @@ class Site(object): ...@@ -287,7 +287,10 @@ class Site(object):
if self.credentials: if self.credentials:
wait_token = self.wait_token() wait_token = self.wait_token()
while True: while True:
login = self.api('login', lgname = self.credentials[0], lgpassword = self.credentials[1]) if self.credentials[2]:
login = self.api('login', lgname = self.credentials[0], lgpassword = self.credentials[1], lgdomain = self.credentials[2])
else:
login = self.api('login', lgname = self.credentials[0], lgpassword = self.credentials[1])
if login['login']['result'] == 'Success': if login['login']['result'] == 'Success':
break break
elif login['login']['result'] == 'Throttled': elif login['login']['result'] == 'Throttled':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment