a question

Ovay
Hi Jagwar
Could your Bot add interwikilinks at the Kurdish Wiktionary?-Thanks in advance--George Animal (discussion) 31 Jolay 2012 à 13:00 (UTC)Répondre

Hi George, I can! I'll do it :). --Jagwar grrrr... / homewiki 31 Jolay 2012 à 13:05 (UTC)Répondre

Here at the mg.wiktionary i will add the Kurdish entries.Sonn.Thanks--George Animal (discussion) 31 Jolay 2012 à 13:16 (UTC)Répondre
Hi I am again
Thanks for the adding of the interwikilinks.I change the formats of the entires of at the Kurdish wiktionary, but there are too much.I would have done it but I don't understand the python-language.

Could your Bot help me, if you have time.For example the English entries: The nouns:

==Inglîzî==
{{nav}}
===Wate===

===Ji===

should be:

== {{=en=}} ==
{{nav|en}}

=== Wate ===

=== Ji ===

The adjectives:

==Inglîzî==
{{rd}}
===Wate===

===Ji===

should be:

== {{=en=}} ==
{{rd|en}}

=== Wate ===

=== Ji ===

The verbs:

==Inglîzî==
{{l}}
===Wate===

===Ji===

should be:

== {{=en=}} ==
{{l|en}}

=== Wate ===

=== Ji ===

The verbs:

PS:The category Kategorî:Peyvên inglîzî should be removed.--George Animal (discussion) 31 Jolay 2012 à 18:54 (UTC)Répondre

As I can understand, you ask me for a word replacement... for all words? I have just started the work. But don't promise it will all be clear. Check punctually the corrected entries. I won't success treating every entry in one time, so I may need bot flag not to flood the wiki RC. Are you bureaucrat? Can you support flagging my bot? Reply me when possible. Best regards. --Jagwar grrrr... / homewiki 31 Jolay 2012 à 19:45 (UTC)Répondre

Hi
I am only an admin.The bureaucrats are inactive.--George Animal (discussion) 1 Aogositra 2012 à 11:16 (UTC)Répondre

Let me do them. --Jagwar grrrr... / homewiki 1 Aogositra 2012 à 13:41 (UTC)Répondre

I can't it and thats why I have to give up.)-George Animal (discussion) 3 Aogositra 2012 à 14:40 (UTC)Répondre

Pywikipedia installation

Ovay

Hi. You have probably misconfigured the bot. Please configure correctly the config.py file (which contains languagefamily, name of the bot variables) by launching wikipedia.py. Once the file config.py created, launch login.py and enter your password (you only have one try) :

python login.py -pass:xxxx

(i'm not sure about the argument. Try -pass:xxx, else -password:xxx) Hope it helps. --Jagwar grrrr... / homewiki 2 Aogositra 2012 à 13:07 (UTC)Répondre

family = 'wiktionary'
mylang = 'ku'
usernames['wiktionary']['ku'] = u'GanimalBot'
console_encoding = 'utf-8'
Is this correct for Windows?best regards--George Animal (discussion) 2 Aogositra 2012 à 17:56 (UTC)Répondre
I have added the python link to the environemental variables. Shall I create a file with the content user-config.py the users have written here?--George Animal (discussion) 2 Aogositra 2012 à 18:00 (UTC)Répondre
Or is the login.py enough?--George Animal (discussion) 2 Aogositra 2012 à 18:01 (UTC)Répondre
How can I konw that I am logged in?.--George Animal (discussion) 2 Aogositra 2012 à 18:07 (UTC)Répondre
I think it is not easy to configure it correctly.--George Animal (discussion) 2 Aogositra 2012 à 18:12 (UTC)Répondre
I can't it.I need the Bot for the edis at the ku wiktiobary.Could you say me the steps?--George Animal (discussion) 2 Aogositra 2012 à 18:26 (UTC)Répondre

A quick-made solution

Ovay

This is the duplicata of my user-config.py copy it in lieu of your user-config.py (but change things if needed):

# -*- coding: utf-8  -*-

# This is an automatically generated file. You can find more configuration parameters in 'config.py' file.

# The family of sites we are working on. wikipedia.py will import
# families/xxx_family.py so if you want to change this variable,
# you need to write such a file.
family = 'wiktionary'

# The language code of the site we're working on.
mylang = 'ku'

# The dictionary usernames should contain a username for each site where you
# have a bot account.

usernames[family]['ku'] = u'GanimalBot' 
sysopnames[family]['ku'] = u'George Animal'


############## LOGFILE SETTINGS ##############

# Defines for which scripts a logfile should be enabled. Logfiles will be
# saved in the 'logs' subdirectory.
# Example:
#     log = ['interwiki', 'weblinkchecker', 'table2wiki']
# It is also possible to enable logging for all scripts, using this line:
#     log = ['*']
# To disable all logging, use this:
#     log = []
# Per default, logging of interwiki.py is enabled because its logfiles can
# be used to generate so-called warnfiles.
# This setting can be overridden by the -log or -nolog command-line arguments.
log = []


############## INTERWIKI SETTINGS ##############

# Should interwiki.py report warnings for missing links between foreign
# languages?
interwiki_backlink = True

# Should interwiki.py display every new link it discovers?
interwiki_shownew = True

# Should interwiki.py output a graph PNG file on conflicts?
# You need pydot for this: http://dkbza.org/pydot.html
interwiki_graph = False

# Specifies that the robot should process that amount of subjects at a time,
# only starting to load new pages in the original language when the total
# falls below that number. Default is to process (at least) 100 subjects at
# once.
interwiki_min_subjects = 100

# If interwiki graphs are enabled, which format(s) should be used?
# Supported formats include png, jpg, ps, and svg. See:
# http://www.graphviz.org/doc/info/output.html
# If you want to also dump the dot files, you can use this in your
# user-config.py:
# interwiki_graph_formats = ['dot', 'png']
# If you need a PNG image with an HTML image map, use this:
# interwiki_graph_formats = ['png', 'cmap']
# If you only need SVG images, use:
# interwiki_graph_formats = ['svg']
interwiki_graph_formats = ['png']

# You can post the contents of your autonomous_problems.dat to the wiki,
# e.g. to http://de.wikipedia.org/wiki/Wikipedia:Interwiki-Konflikte .
# This allows others to assist you in resolving interwiki problems.
# To help these people, you can upload the interwiki graphs to your
# webspace somewhere. Set the base URL here, e.g.:
# 'http://www.example.org/~yourname/interwiki-graphs/'
interwiki_graph_url = None

# Save file with local articles without interwikis.
without_interwiki = False

# Experimental feature:
# Store the page contents on disk (/cache/ directory) instead of loading
# them in RAM.
interwiki_contents_on_disk = False


############## SOLVE_DISAMBIGUATION SETTINGS ############
#
# Set disambiguation_comment[FAMILY][LANG] to a non-empty string to override
# the default edit comment for the solve_disambiguation bot.
# Use %s to represent the name of the disambiguation page being treated.
# Example:
#
# disambiguation_comment['wikipedia']['en'] = \
#    "Robot-assisted disambiguation ([[WP:DPL|you can help!]]): %s"

sort_ignore_case = False


############## IMAGE RELATED SETTINGS ##############
# If you set this to True, images will be uploaded to Wikimedia
# Commons by default.
upload_to_commons = False


############## TABLE CONVERSION BOT SETTINGS ##############

# will split long paragraphs for better reading the source.
# only table2wiki.py use it by now
splitLongParagraphs = False
# sometimes HTML-tables are indented for better reading.
# That can do very ugly results.
deIndentTables = True
# table2wiki.py works quite stable, so you might switch to True
table2wikiAskOnlyWarnings = True
table2wikiSkipWarnings = False


############## WEBLINK CHECKER SETTINGS ##############

# How many external links should weblinkchecker.py check at the same time?
# If you have a fast connection, you might want to increase this number so
# that slow servers won't slow you down.
max_external_links = 50

report_dead_links_on_talk = False


############## DATABASE SETTINGS ##############
db_hostname = 'localhost'
db_username = 'wikiuser'
db_password = ''


############## SEARCH ENGINE SETTINGS ##############

# Some scripts allow querying Google via the Google Web API. To use this feature,
# you must install the pyGoogle module from http://pygoogle.sf.net/ and have a
# Google Web API license key. Note that Google doesn't give out license keys
# anymore.
# --------------------
# Google web API is obsoleted for long time, now we can use Google AJAX Search API,
# You can signup an API key from http://code.google.com/apis/ajaxsearch/signup.html.
google_key = ''


# using Google AJAX Search API, it require the refer website, this variable save the refer web address
# when you sign up the Key.
google_api_refer = ''

# Some scripts allow using the Yahoo! Search Web Services. To use this feature,
# you must install the pYsearch module from http://pysearch.sourceforge.net/
# and get a Yahoo AppID from http://developer.yahoo.com
yahoo_appid = ''

# To use Windows Live Search web service you must get an AppID from
# http://search.msn.com/developer
msn_appid = ''

# Using the Flickr api
flickr = {
    'api_key': None,  # Provide your key!
    'review': False,  # Do we use automatically make our uploads reviewed?
    'reviewer': None, # If so, under what reviewer name?
    }

# for all connection proxy handle
# to use it, proxy['host'] have to support HTTP and include port number (e.g. localhost:8080)
# if proxy server neen authentication, set ('ID', 'PASSWORD') to proxy['auth'].
proxy = {
    'host': None,
    'auth': None,
}


############## COPYRIGHT SETTINGS ##############

# Enable/disable search engine in copyright.py script
copyright_google = True
copyright_yahoo = True
copyright_msn = False

# Perform a deep check, loading URLs to search if 'Wikipedia' is present.
# This may be useful to improve number of correct results. If you haven't
# a fast connection, you might want to keep they disabled.
copyright_check_in_source_google = False
copyright_check_in_source_yahoo = False
copyright_check_in_source_msn = False

# Web pages may content a Wikipedia text without 'Wikipedia' word but with
# typical '[edit]' tag result of copy & paste procedure. You can want no
# report for this kind of URLs, even if they are copyright violation.
# However, when enabled these URLs are logged in a file.

copyright_check_in_source_section_names = False

# Limit number of queries for page.
copyright_max_query_for_page = 25

# Skip a specified number of queries
copyright_skip_query = 0

# Number of attempts on connection error.
copyright_connection_tries = 10

# Behavior if an exceeded error occur.
#
# Possibilities:
#
#    0 = None
#    1 = Disable search engine
#    2 = Sleep (default)
#    3 = Stop

copyright_exceeded_in_queries = 2
copyright_exceeded_in_queries_sleep_hours = 6

# Append last modified date of URL to script result
copyright_show_date = True

# Append length of URL to script result
copyright_show_length = True

# By default the script try to identify and skip text that contents a wide
# comma separated list or only numbers. But sometimes that might be the
# only part unmodified of a slightly edited and not otherwise reported
# copyright violation. You can disable this feature to try to increase
# number of results.

copyright_economize_query = True


############## FURTHER SETTINGS ##############

# The bot can make some additional changes to each page it edits, e.g. fix
# whitespace or positioning of interwiki and category links.

# This is an experimental feature; handle with care and consider re-checking
# each bot edit if enabling this!
cosmetic_changes = False

# If cosmetic changes are switched on, and you also have several accounts at
# projects where you're not familiar with the local conventions, you probably
# only want the bot to do cosmetic changes on your "home" wiki which you
# specified in config.mylang and config.family.
# If you want the bot to also do cosmetic changes when editing a page on a
# foreign wiki, set cosmetic_changes_mylang_only to False, but be careful!
cosmetic_changes_mylang_only = True
# The dictionary cosmetic_changes_enable should contain a tuple of languages
# for each site where you wish to enable in addition to your own langlanguage
# (if cosmetic_changes_mylang_only is set)
# Please set your dictionary by adding such lines to your user-config.py:
# cosmetic_changes_enable['wikipedia'] = ('de', 'en', 'fr')
cosmetic_changes_enable = {}
# The dictionary cosmetic_changes_disable should contain a tuple of languages
# for each site where you wish to disable cosmetic changes. You may use it with
# cosmetic_changes_mylang_only is False, but you can also disable your own
# language. This also overrides the settings in the cosmetic_changes_enable
# dictionary. Please set your dict by adding such lines to your user-config.py:
# cosmetic_changes_disable['wikipedia'] = ('de', 'en', 'fr')
cosmetic_changes_disable = {}
# Use the experimental disk cache to prevent huge memory usage
use_diskcache = False

# Retry loading a page on failure (back off 1 minute, 2 minutes, 4 minutes
# up to 30 minutes)
retry_on_fail = True

# End of configuration section
  • Launch login.py as I told you further above.
  • If you don't have should be logged in now. Then you may have a wrong username/password.
    • You only have one password try per launch. If it's wrong, you'll have to restart the script.

This is all I can do. --Jagwar grrrr... / homewiki 3 Aogositra 2012 à 00:57 (UTC)Répondre

Lots of thanks.You are the best!I can log in manually on wiktionarys--George Animal (discussion) 3 Aogositra 2012 à 09:02 (UTC)Répondre
What does the login.py and config.py contain if user-config.py contains the parameters above?--George Animal (discussion) 3 Aogositra 2012 à 11:49 (UTC)Répondre
Do you have only the user-config.py?The pywikipedia-file contains config.py interwiki.py user-config.py and user-fixes.py on my Desktop. Wgere could I find the other scripts?--George Animal (discussion) 3 Aogositra 2012 à 11:52 (UTC)Répondre
I use the console mcd and I give
1. C:\Users\xxx> cd C:\Users\xxx\Desktop\pywikipedia
2. THAN:C:\Users\xxx\Desktop\pywikipedia\ python login.py | but I can't log in.Is this correct?
:OR:
2. C:\Users\xxx\Desktop\pywikipedia\ python user-config.py?

--George Animal (discussion) 3 Aogositra 2012 à 12:33 (UTC)Répondre

login.py and config.py contain functions which makes you login and configure the pywikipediabot. Login is prompted by the program when doing a change is needed (console shows "password for user:xxx on wiktionary:ku:"). Same notice as above : you have only one try.

No. I don't have only user-config.py. All pywikipedia related files must be regrouped in one directory, otherwise nothing will work. Other scripts can be found in the directory where wikipedia.py is. --Jagwar grrrr... / homewiki 3 Aogositra 2012 à 13:56 (UTC)Répondre

My login.py contains:
# -*- coding: utf-8  -*-
"""
Script to log the robot in to a wiki account.

Suggestion is to make a special account to use for robot use only. Make
sure this robot account is well known on your home wiki before using.

Parameters:

   -all         Try to log in on all sites where a username is defined in
                user-config.py.

   -clean       Use this option for logout. In combination with -all it
                will log out on all sites where a username is defined.

   -force       Ignores if the user is already logged in, and tries to log in.

   -pass        Useful in combination with -all when you have accounts for
                several sites and use the same password for all of them.
                Asks you for the password, then logs in on all given sites.

   -pass:XXXX   Uses XXXX as password. Be careful if you use this
                parameter because your password will be shown on your
                screen, and will probably be saved in your command line
                history. This is NOT RECOMMENDED for use on computers
                where others have either physical or remote access.
                Use -pass instead.

   -sysop       Log in with your sysop account.

   -test        test whether you are logged-in

   -v -v        (Doubly verbose) Shows http requests made when logging in. This
                might leak private data (password, session id), so make sure to
                check the output. Using -log is recommended: this will output a
                lot of data

If not given as parameter, the script will ask for your username and
password (password entry will be hidden), log in to your home wiki using
this combination, and store the resulting cookies (containing your password
hash, so keep it secured!) in a file in the login-data subdirectory.

All scripts in this library will be looking for this cookie file and will
use the login information if it is present.

To log out, throw away the XX-login.data file that is created in the login-data
subdirectory.
"""
#
# (C) Rob W.W. Hooft, 2003
# (C) Pywikipedia bot team, 2003-2011
#
# Distributed under the terms of the MIT license.
#
__version__='$Id$'

import re, os, query
import urllib2
import wikipedia as pywikibot
import config

# On some wikis you are only allowed to run a bot if there is a link to
# the bot's user page in a specific list.
# If bots are listed in a template, the templates name must be given as
# second parameter, otherwise it must be None
botList = {
    'wikipedia': {
        'en': [u'Wikipedia:Bots/Status/active bots', 'BotS'],
        'simple': [u'Wikipedia:Bots', '/links']
    },
    'gentoo': {
        'en': [u'Help:Bots', None],
    }
}

def show (mysite, sysop = False):
    if mysite.loggedInAs(sysop = sysop):
        pywikibot.output(u"You are logged in on %s as %s."
                         % (repr(mysite), mysite.loggedInAs(sysop=sysop)))
    else:
        pywikibot.output(u"You are not logged in on %s." % repr(mysite))

class LoginManager:
    def __init__(self, password=None, sysop=False, site=None, username=None,
                 verbose=False):
        self.site = site or pywikibot.getSite()
        self.sysop = sysop
        if username:
            self.username = username
            # perform writeback.
            if site.family.name not in config.usernames:
                config.usernames[site.family.name]={}
            config.usernames[site.family.name][self.site.lang]=username
        else:
            if sysop:
                try:
                    self.username = config.sysopnames\
                                    [self.site.family.name][self.site.lang]
                except:
                    raise pywikibot.NoUsername(u'ERROR: Sysop username for %s:%s is undefined.\nIf you have a sysop account for that site, please add such a line to user-config.py:\n\nsysopnames[\'%s\'][\'%s\'] = \'myUsername\'' % (self.site.family.name, self.site.lang, self.site.family.name, self.site.lang))
            else:
                try:
                    self.username = config.usernames[self.site.family.name][self.site.lang]
                except:
                    raise pywikibot.NoUsername(u'ERROR: Username for %s:%s is undefined.\nIf you have an account for that site, please add such a line to user-config.py:\n\nusernames[\'%s\'][\'%s\'] = \'myUsername\'' % (self.site.family.name, self.site.lang, self.site.family.name, self.site.lang))
        self.password = password
        self.verbose = verbose
        if getattr(config, 'password_file', ''):
            self.readPassword()

    def botAllowed(self):
        """
        Checks whether the bot is listed on a specific page to comply with
        the policy on the respective wiki.
        """
        if self.site.family.name in botList \
           and self.site.language() in botList[self.site.family.name]:
            botListPageTitle, botTemplate = botList[self.site.family.name][self.site.language()]
            botListPage = pywikibot.Page(self.site, botListPageTitle)
            if botTemplate:
                for template in botListPage.templatesWithParams():
                    if template[0] == botTemplate \
                       and template[1][0] == self.username:
                        return True
            else:
                for linkedPage in botListPage.linkedPages():
                    if linkedPage.title(withNamespace=False) == self.username:
                        return True
            return False
        else:
            # No bot policies on other sites
            return True

    def getCookie(self, api=config.use_api_login, remember=True, captcha = None):
        """
        Login to the site.

        remember    Remember login (default: True)
        captchaId   A dictionary containing the captcha id and answer, if any

        Returns cookie data if succesful, None otherwise.
        """
        if api:
            predata = {
                'action': 'login',
                'lgname': self.username,
                'lgpassword': self.password,
            }
            if self.site.family.ldapDomain:
                predata['lgdomain'] = self.site.family.ldapDomain
            address = self.site.api_address()
        else:
            predata = {
                "wpName": self.username.encode(self.site.encoding()),
                "wpPassword": self.password,
                "wpLoginattempt": "Aanmelden & Inschrijven", # dutch button label seems to work for all wikis
                "wpRemember": str(int(bool(remember))),
                "wpSkipCookieCheck": '1'
            }
            if self.site.family.ldapDomain:     # VistaPrint fix
                predata["wpDomain"] = self.site.family.ldapDomain
            if captcha:
                predata["wpCaptchaId"] = captcha['id']
                predata["wpCaptchaWord"] = captcha['answer']
            login_address = self.site.login_address()
            address = login_address + '&action=submit'

        if api:
            while True:
                # build the cookie
                L = {}
                L["cookieprefix"] = None
                index = self.site._userIndex(self.sysop)
                if self.site._cookies[index]:
                    #if user is trying re-login, update the new information
                    self.site.updateCookies(L, self.sysop)
                else:
                    # clean type login, setup the new cookies files.
                    self.site._setupCookies(L, self.sysop)
                response, data = query.GetData(predata, self.site, sysop=self.sysop, back_response = True)
                result = data['login']['result']
                if result == "NeedToken":
                    predata["lgtoken"] = data["login"]["token"]
                    if ['lgtoken'] in data['login'].keys():
                        self.site._userName[index] = data['login']['lgusername']
                        self.site._token[index] = data['login']['lgtoken'] + "+\\"
                    continue
                break
            if result != "Success":
                #if result == "NotExists":
                #
                #elif result == "WrongPass":
                #
                #elif result == "Throttled":
                #
                return False
        else:
            response, data = self.site.postData(address, self.site.urlEncode(predata), sysop=self.sysop)
            if self.verbose:
                fakepredata = predata
                fakepredata['wpPassword'] = u'XXXXX'
                pywikibot.output(u"self.site.postData(%s, %s)" % (address, self.site.urlEncode(fakepredata)))
                trans = config.transliterate
                config.transliterate = False #transliteration breaks for some reason
                #pywikibot.output(fakedata.decode(self.site.encoding()))
                config.transliterate = trans
                fakeresponsemsg = re.sub(r"(session|Token)=..........", r"session=XXXXXXXXXX", data)
                pywikibot.output(u"%s/%s\n%s" % (response.code, response.msg, fakeresponsemsg))
            #pywikibot.cj.save(pywikibot.COOKIEFILE)

        Reat=re.compile(': (.*?)=(.*?);')

        L = {}
        if hasattr(response, 'sheaders'):
            ck = response.sheaders
        else:
            ck = response.info().getallmatchingheaders('set-cookie')
        for eat in ck:
            m = Reat.search(eat)
            if m:
                L[m.group(1)] = m.group(2)

        got_token = got_user = False
        for Ldata in L.keys():
            if 'Token' in Ldata:
                got_token = True
            if 'User' in Ldata or 'UserName' in Ldata:
                got_user = True

        if got_token and got_user:
            #process the basic information to Site()
            index = self.site._userIndex(self.sysop)
            if api:
                #API result came back username, token and sessions.
                self.site._userName[index] = data['login']['lgusername']
                self.site._token[index] = data['login']['lgtoken'] + "+\\"
            else:
                self.site._userName[index] = self.username

            if self.site._cookies[index]:
                #if user is trying re-login, update the new information
                self.site.updateCookies(L, self.sysop)
            else:
                # clean type login, setup the new cookies files.
                self.site._setupCookies(L, self.sysop)

            return True
        elif not captcha:
            solve = self.site.solveCaptcha(data)
            if solve:
                return self.getCookie(api = api, remember = remember, captcha = solve)
        return None

    def storecookiedata(self, filename, data):
        """
        Store cookie data.

        The argument data is the raw data, as returned by getCookie().

        Returns nothing.
        """
        s = u''
        for v, k in data.iteritems():
            s += "%s=%s\n" % (v, k)
        f = open(pywikibot.config.datafilepath('login-data',filename), 'w')
        f.write(s)
        f.close()

    def readPassword(self):
        """
        Read passwords from a file.

        DO NOT FORGET TO REMOVE READ ACCESS FOR OTHER USERS!!!
        Use chmod 600 password-file.
        All lines below should be valid Python tuples in the form
        (code, family, username, password) or (username, password)
        to set a default password for an username. Default usernames
        should occur above specific usernames.

        Example:

        ("my_username", "my_default_password")
        ("my_sysop_user", "my_sysop_password")
        ("en", "wikipedia", "my_en_user", "my_en_pass")
        """
        password_f = open(pywikibot.config.datafilepath(config.password_file), 'r')
        for line in password_f:
            if not line.strip(): continue
            entry = eval(line)
            if len(entry) == 2:   #for default userinfo
                if entry[0] == self.username: self.password = entry[1]
            elif len(entry) == 4: #for userinfo included code and family
                if entry[0] == self.site.lang and \
                  entry[1] == self.site.family.name and \
                  entry[2] == self.username:
                    self.password = entry[3]
        password_f.close()

    def login(self, api=config.use_api_login, retry = False):
        if not self.password:
            # 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:'
                                % {'name': self.username, 'site': self.site},
                                password = True)

        self.password = self.password.encode(self.site.encoding())

        if api:
            pywikibot.output(u"Logging in to %(site)s as %(name)s via API."
                             % {'name': self.username, 'site': self.site})
        else:
            pywikibot.output(u"Logging in to %(site)s as %(name)s"
                             % {'name': self.username, 'site': self.site})

        try:
            cookiedata = self.getCookie(api)
        except NotImplementedError:
            pywikibot.output('API disabled because this site does not support.\nRetrying by ordinary way...')
            api = False
            return self.login(False, retry)
        if cookiedata:
            fn = '%s-%s-%s-login.data' % (self.site.family.name, self.site.lang, self.username)
            #self.storecookiedata(fn,cookiedata)
            pywikibot.output(u"Should be logged in now")
            # Show a warning according to the local bot policy
            if not self.botAllowed():
                pywikibot.output(u'*** Your username is not listed on [[%s]].\n*** Please make sure you are allowed to use the robot before actually using it!' % botList[self.site.family.name][self.site.lang])
            return True
        else:
            pywikibot.output(u"Login failed. Wrong password or CAPTCHA answer?")
            if api:
                pywikibot.output(u"API login failed, retrying using standard webpage.")
                return self.login(False, retry)

            if retry:
                self.password = None
                return self.login(api, True)
            else:
                return False

    def logout(self, api = config.use_api):
        flushCk = False
        if api and self.site.versionnumber() >= 12:
            if query.GetData({'action':'logout'}, self.site) == []:
                flushCk = True
        else:
            text = self.site.getUrl(self.site.get_address("Special:UserLogout"))
            if self.site.mediawiki_message('logouttext') in text: #confirm loggedout
                flushCk = True

        if flushCk:
            self.site._removeCookies(self.username)
            return True

        return False

    def showCaptchaWindow(self, url):
        pass

def main():
    username = password = None
    sysop = False
    logall = False
    forceLogin = False
    verbose = False
    clean = False
    testonly = False

    for arg in pywikibot.handleArgs():
        if arg.startswith("-pass"):
            if len(arg) == 5:
                password = pywikibot.input(u'Password for all accounts:',
                                           password = True)
            else:
                password = arg[6:]
        elif arg == "-clean":
            clean = True
        elif arg == "-sysop":
            sysop = True
        elif arg == "-all":
            logall = True
        elif arg == "-force":
            forceLogin = True
        elif arg == "-test":
            testonly = True
        else:
            pywikibot.showHelp('login')
            return

    if pywikibot.verbose > 1:
        pywikibot.output(u"WARNING: Using -v -v on login.py might leak private data. When sharing, please double check your password is not readable and log out your bots session.")
        verbose = True # only use this verbose when running from login.py
    if logall:
        if sysop:
            namedict = config.sysopnames
        else:
            namedict = config.usernames

        for familyName in namedict.iterkeys():
            for lang in namedict[familyName].iterkeys():
                if testonly:
                    show(pywikibot.getSite(lang, familyName), sysop)
                else:
                    try:
                        site = pywikibot.getSite(lang, familyName)
                        loginMan = LoginManager(password, sysop=sysop,
                                                site=site, verbose=verbose)
                        if clean:
                            loginMan.logout()
                        else:
                            if not forceLogin and site.loggedInAs(sysop = sysop):
                                pywikibot.output(u'Already logged in on %s' % site)
                            else:
                                loginMan.login()
                    except pywikibot.NoSuchSite:
                        pywikibot.output(lang+ u'.' + familyName + u' is not a valid site, please remove it from your config')

    elif testonly:
        show(pywikibot.getSite(), sysop)
    elif clean:
        try:
            site = pywikibot.getSite()
            lgm = LoginManager(site = site)
            lgm.logout()
        except pywikibot.NoSuchSite:
            pass
    else:
        loginMan = LoginManager(password, sysop = sysop, verbose=verbose)
        loginMan.login()

if __name__ == "__main__":
    try:
        main()
    finally:
        pywikibot.stopme()

--George Animal (discussion) 3 Aogositra 2012 à 14:36 (UTC) My pywikipedia folder contains only the file user-config.py.--George Animal (discussion) 3 Aogositra 2012 à 14:46 (UTC)Répondre


Could your Bot replace the parameter =Inglîzî= with == {{=en=}} == because I have not A Bot.--George Animal (discussion) 3 Aogositra 2012 à 14:40 (UTC)Répondre
If I enter C:\Users\xxx\Desktop\pywikipedia> python login.py
than you can see:
  • TRaceback <most recent call last>
  • File login.py 57, in <module>
  • import re, os query
  • ImportError : No module named query

--George Animal (discussion) 3 Aogositra 2012 à 14:53 (UTC)Répondre

I only want to add interwikilinks.--George Animal (discussion) 3 Aogositra 2012 à 14:54 (UTC)Répondre
I am logged in now.-Thanks--George Animal (discussion) 3 Aogositra 2012 à 15:07 (UTC)Répondre

If you are unable to make Pywikipediabot work on your computer, continue to use AWB as you did before. AWB is well-made for text replacement. And I think Pywikipedia is only used by people who need to make their own scripts (interwiki linking put apart).

The traceback shown above is due to the absence of one or many scripts in the repository. This means your pywikipedia is totally messed up, and the best thing I advise you to do is to redownload the nighltly release and overwrite script by script (your config should not be affected). I am happy to learn that you have succeeded to log in and hope you a good day. --Jagwar grrrr... / homewiki 3 Aogositra 2012 à 15:21 (UTC)Répondre

I see yet.--George Animal (discussion) 3 Aogositra 2012 à 15:38 (UTC)Répondre
Thanks for the help.I would not had succed without your help. I also wish you a good day!--George Animal (discussion) 3 Aogositra 2012 à 16:09 (UTC)Répondre

Verb endings in Kurdish

Ovay

Hello,

What is the main ending of verbs in Kurdish language? -in? If the case, how related to Farsi is Kurdish? Thanks in advance. --Jagwar grrrr... / homewiki 24 Aogositra 2012 à 18:54 (UTC)Répondre

The are five different endings in the Kurdish.
1. edign is -andin (most used): example: afirandin (create), borandin (forgive), kelandin (cook) qelandin (fry]] teqandin (to explode) tc. etc
2. ending is in: gotin, dîtin, avêtin etc
3. ending is irin : kirin (do]] birin take along, and all wor combinations with kirin like : amade kirin (prepare), bar kirin (upload]]
4. ending is -ûn: bûn, rabûn etc.
5. ending is în: anîn (bring) danîn (lay) etc.

--George Animal (discussion) 24 Aogositra 2012 à 20:42 (UTC)Répondre

Understood. Thanks for the information. Best regards, --Jagwar grrrr... / homewiki 24 Aogositra 2012 à 20:46 (UTC)Répondre

Kurdish verb forms

Ovay

please look at this page: I left a note. Regards, —Jagwargrrrr... / homewiki 27 Aogositra 2012 à 18:04 (UTC)Répondre