Ladsgroup has uploaded a new change for review.
https://gerrit.wikimedia.org/r/79730
Change subject: adding option of logging out and adding some descriptions about
not showing characters when people are typing password
......................................................................
adding option of logging out and adding some descriptions about not showing
characters when people are typing password
Change-Id: If25cb90bfdde8fac0ed6ad8a0c224e5f7e811fcb
---
M pywikibot/login.py
M scripts/login.py
2 files changed, 15 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/30/79730/1
diff --git a/pywikibot/login.py b/pywikibot/login.py
index a548197..a4e411d 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -157,7 +157,7 @@
# As we don't want the password to appear on the screen, we set
# password = True
self.password = pywikibot.input(
- u'Password for user %(name)s on %(site)s:'
+ u'Password for user %(name)s on %(site)s (no
character will be shown):'
% {'name': self.username, 'site': self.site},
password = True)
@@ -190,4 +190,4 @@
return True
def showCaptchaWindow(self, url):
- pass
+ pass
\ No newline at end of file
diff --git a/scripts/login.py b/scripts/login.py
index 90d73fe..bcba95a 100755
--- a/scripts/login.py
+++ b/scripts/login.py
@@ -11,6 +11,7 @@
-all Try to log in on all sites where a username is defined in
user-config.py.
+ -logout for logging out
-force Ignores if the user is already logged in, and tries to log in.
@@ -59,7 +60,7 @@
for arg in pywikibot.handleArgs(*args):
if arg.startswith("-pass"):
if len(arg) == 5:
- password = pywikibot.input(u'Password for all accounts:',
+ password = pywikibot.input(u'Password for all accounts (no
character will be shown):',
password = True)
else:
password = arg[6:]
@@ -70,6 +71,16 @@
elif arg == "-force":
pywikibot.output(u"To force a re-login, please delete the revelant
lines from '%s' (or the entire file) and try again." %
join(config.base_dir, 'pywikibot.lwp'))
+ elif arg == "-logout":
+ from pywikibot.data import api
+ site = pywikibot.getSite()
+ uirequest = api.Request(site=site,action="logout")
+ uidata = uirequest.submit()
+ if "error" in str(uidata):
+ pywikibot.output("Something went wrong while loggin out: %s" %
str(uidata))
+ else:
+ pywikibot.output("You should be logged out now")
+ return
else:
pywikibot.showHelp('login')
return
@@ -99,4 +110,4 @@
try:
main()
finally:
- pywikibot.stopme()
+ pywikibot.stopme()
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/79730
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If25cb90bfdde8fac0ed6ad8a0c224e5f7e811fcb
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits