[pywikibot] Re: Mass hide revisions

2024-04-11 Thread Bináris
Thanks, we'll try it! It is useful for admins without Pywikibot.

JJMC89  ezt írta (időpont: 2024. ápr. 11., Cs,
17:10):

> You may find Writ Keeper's massRevdel
> <https://en.wikipedia.org/wiki/User:Writ_Keeper/Scripts/massRevdel.js>
> helpful. It allows you to mass hide from Special:Contributions.
>
> Regards,
> JJ
>
>
> On Thu, Apr 11, 2024 at 1:39 AM Bináris  wrote:
>
>> *TL;DR*: we can mass hide vandal revisions from pages histories, e.g.
>> obscene images and edit comments.
>>
>> Of course, this needs admin rights.
>> It is easy to mass hide revisions from the history of one page without
>> bot, just click checkboxes. But it is tiring, if several pages are involved.
>>
>> I wrote a script that is not ready to publish, and I won't show it for
>> the vandal, and needs manual editing. But I can send it in a private mail
>> to those who are interested.
>>
>> The API documentation is here:
>> https://www.mediawiki.org/wiki/API:Revisiondelete
>> But it is not complete. I learned on my own that multiple revids may
>> concern the same page. We don't have to write the title into the request,
>> but must group the revisions by page.
>> The required format is e.g. 27009438|27009402|27009353|27009335|27009151
>> with pipe, all ids belong to the same page, otherwise they won't all be
>> processed, just the first page. This is an undocumentetd feature. :-)
>>
>> Sample code fragment (run with -user:myadminaccount):
>>
>> hide = 'content|comment|user'  # Just to show the syntax, keep what you
>> need
>> reason = 'Vandalism'
>>
>> def gen() -> Iterator[str]:
>> """Yield ids to hide in the above form, page by page. Here comes your
>> work."""
>> yield' 27009438|27009402|27009353|27009335|27009151'  # Example
>>
>> token = site.get_tokens(['csrf']).get('csrf')  # get a single token
>> for ids in gen():
>> params = {'action': 'revisiondelete',
>>   'type': 'revision',
>>   'ids': ids,
>>   'hide': hide,
>>   'token': token,
>>   'reason': reason,
>>  }
>> request = site.simple_request(**params)
>> request.submit()
>>
>> To get the ids use for contrib in user.contributions():
>> contrib[0] will be the page object, while  contrib[1] the revision id
>> for each contribution.
>> --
>> Bináris
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> Public archives at
>> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/2S64RSANNYDCFJPRMHPEP6TAJ7BAXV7M/
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/IGCPHPNVPBEFF3V4SSHHHQW4BIEMTLUL/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/K2N44YD3UGLO2ZKGDZJ2WBT7QFAUXYQ6/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Mass hide revisions

2024-04-11 Thread Bináris
*TL;DR*: we can mass hide vandal revisions from pages histories, e.g.
obscene images and edit comments.

Of course, this needs admin rights.
It is easy to mass hide revisions from the history of one page without bot,
just click checkboxes. But it is tiring, if several pages are involved.

I wrote a script that is not ready to publish, and I won't show it for the
vandal, and needs manual editing. But I can send it in a private mail to
those who are interested.

The API documentation is here:
https://www.mediawiki.org/wiki/API:Revisiondelete
But it is not complete. I learned on my own that multiple revids may
concern the same page. We don't have to write the title into the request,
but must group the revisions by page.
The required format is e.g. 27009438|27009402|27009353|27009335|27009151
with pipe, all ids belong to the same page, otherwise they won't all be
processed, just the first page. This is an undocumentetd feature. :-)

Sample code fragment (run with -user:myadminaccount):

hide = 'content|comment|user'  # Just to show the syntax, keep what you need
reason = 'Vandalism'

def gen() -> Iterator[str]:
"""Yield ids to hide in the above form, page by page. Here comes your
work."""
yield' 27009438|27009402|27009353|27009335|27009151'  # Example

token = site.get_tokens(['csrf']).get('csrf')  # get a single token
for ids in gen():
params = {'action': 'revisiondelete',
  'type': 'revision',
  'ids': ids,
  'hide': hide,
  'token': token,
  'reason': reason,
 }
request = site.simple_request(**params)
request.submit()

To get the ids use for contrib in user.contributions():
contrib[0] will be the page object, while  contrib[1] the revision id for
each contribution.
-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/2S64RSANNYDCFJPRMHPEP6TAJ7BAXV7M/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] How to list contributions of an IP range?

2024-04-11 Thread Bináris
anon = '89.134.24.79/16'
user = pywikibot.User(site, anon)
for contrib in user.contributions():
print(contrib[1])

This makes nothing.
(There is a massive vandal from a range, and I want to hide all the
inappropriate contents made by him.)

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/UQDSEXUWOVDS6KHNGT6QIIMIV44SW6WW/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Path between a category and an article

2024-04-03 Thread Bináris
Hi,

given a category c and a page p, p is listed in c.articles(recurse=True)
But is shouldn't... And I don't know the depth of it.
Is there a simple way to find a path between them, and guess, why is the
page in the category?
(I spent 10 minutes with manual trying, total fail.)

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/S63JZSM6HUGJLUEPNORIJQR6LUDJW3YV/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Flagged revisions

2024-02-03 Thread Bináris
As part of the huwiki package, I wrote some methods dealing with flagged
revisions that work in some wikis. You may find them useful.
https://hu.wikipedia.org/wiki/user:BinBot/huwiki/flaggedrevs.py

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/5KJDUPEFVTYPYDJBJBMJUZQVSIHLMD4J/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: How to add a category to a page

2024-01-15 Thread Bináris
Thank you! :-)

 ezt írta (időpont: 2024. jan. 15., H, 9:23):

> textlib.replaceCategoryLinks() with add_only=True should do the job.
>
> Best
>
> xqt
>
>
> Von meinem iPhone gesendet
>
> Am 04.01.2024 um 13:49 schrieb John :
>
> 
> I use a combination of getCategoryLinks() and then replaceCategoryLinks()
> it updates them in place, or adds them where needed.
>
> On Thu, Jan 4, 2024 at 2:58 AM  wrote:
>
>> Hi,
>>
>> to add a category to several pages, category script can be used. For
>> implementing a function or method, its treat method can be used as templet:
>>
>>
>> https://doc.wikimedia.org/pywikibot/master/_modules/scripts/category.html#CategoryAddBot
>>
>> You can also use textlib for manipulating templates.
>>
>> Best
>> xqt
>>
>> Von meinem iPhone gesendet
>>
>> Am 03.01.2024 um 21:02 schrieb Bináris :
>>
>> 
>> Thank you! At the end,I wrote to the end. We must care if there is
>> already a \n ath end or not.
>>
>> Ethan N.  ezt írta (időpont: 2024. jan. 3., Sze,
>> 18:47):
>>
>>> Bináris,
>>> A nice function for this does not currently exist for Page class. See
>>> https://phabricator.wikimedia.org/T325420.
>>>
>>> I am working on this one so it is in progress. Hopefully this weekend I
>>> will finish the initial version of the changes and start the review
>>> process. There are several workarounds, one of which is adding to end of
>>> text, which you mentioned already. One other workaround is to use
>>> textlib.replaceCategoryLinks(). See
>>> https://doc.wikimedia.org/pywikibot/master/api_ref/textlib.html#textlib.replaceCategoryLinks
>>> .
>>>
>>> Thanks,
>>> Ethan
>>>
>>> On Tue, Jan 2, 2024 at 11:45 PM Bináris  wrote:
>>>
>>>> At
>>>> https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.page.html
>>>> I only find change_category which requires the old cat to be removed
>>>> present.
>>>> But how do I just add a new one w/o changing?
>>>>
>>>> OK, I can add it to the end of text, but that is not nice.
>>>>
>>>> --
>>>> Bináris
>>>> ___
>>>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>>>> Public archives at
>>>> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/YONEOOAH3N2SCACV2Q7QMQGOS3CNBFJA/
>>>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>>>
>>> ___
>>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>>> Public archives at
>>> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/OQZ64BNMCU6W5NC2LMXTC74ZAFNS5YLB/
>>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>>
>>
>>
>> --
>> Bináris
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> Public archives at
>> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/FDJHJJQQQGZHMXA22EHIM5T7B4A3IFCR/
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> Public archives at
>> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/CLHYEALKJVITDYSUTPVSBGKN7PXTZLXY/
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/MVEZD62WRZRTBKGRANEH52LIJIBXAHBJ/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4SO7UIDITXIST7AT4Z2GBTW5CEDYFYBZ/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/IDB7JIMGWLY7ZRGRPVRZOI7BH2NOHOU2/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: How to add a category to a page

2024-01-03 Thread Bináris
Thank you! At the end,I wrote to the end. We must care if there is already
a \n ath end or not.

Ethan N.  ezt írta (időpont: 2024. jan. 3., Sze, 18:47):

> Bináris,
> A nice function for this does not currently exist for Page class. See
> https://phabricator.wikimedia.org/T325420.
>
> I am working on this one so it is in progress. Hopefully this weekend I
> will finish the initial version of the changes and start the review
> process. There are several workarounds, one of which is adding to end of
> text, which you mentioned already. One other workaround is to use
> textlib.replaceCategoryLinks(). See
> https://doc.wikimedia.org/pywikibot/master/api_ref/textlib.html#textlib.replaceCategoryLinks
> .
>
> Thanks,
> Ethan
>
> On Tue, Jan 2, 2024 at 11:45 PM Bináris  wrote:
>
>> At https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.page.html
>> I only find change_category which requires the old cat to be removed
>> present.
>> But how do I just add a new one w/o changing?
>>
>> OK, I can add it to the end of text, but that is not nice.
>>
>> --
>> Bináris
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> Public archives at
>> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/YONEOOAH3N2SCACV2Q7QMQGOS3CNBFJA/
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/OQZ64BNMCU6W5NC2LMXTC74ZAFNS5YLB/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/FDJHJJQQQGZHMXA22EHIM5T7B4A3IFCR/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] How to add a category to a page

2024-01-02 Thread Bináris
At https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.page.html
I only find change_category which requires the old cat to be removed
present.
But how do I just add a new one w/o changing?

OK, I can add it to the end of text, but that is not nice.

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/YONEOOAH3N2SCACV2Q7QMQGOS3CNBFJA/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] I get mad of replace.py, please help

2023-08-22 Thread Bináris
Briefly: I began to use new replace.py.
(I used the old compat one as long as I could with satisfaction, but at a
point some sysop threw out all the logged in bots, and by that time the
login had been crashed.)

Sometimes it works well, sometimes it keeps the first character of the
article and throws away everything else. I cannot find the reason. For
testing here is an example where it shows BOTH behaviours:

My fix is:
fixes['nemezetek'] = {
'regex': True,
'msg': {
'hu':'Nemezetek → nemzetek tömeges javítása',
},
'replacements': [
(r'(n|N)emezetek', r'\1emzetek'), # Ez az alap, amit a
lajostalanításhoz kikommentezünk
]
}

My command in huwiki is:
python pwb.py -nolog replace -fix:nemezetek -search:nemezetek

And the same fix and same command sometimes works well, and in other
arcticles shows the above mentioned silly behaviour.
What do I do wrong?
 I try to attach a small creenshot: two articles are correct, the 3rd one
is totally bad.
[image: kép.png]

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/54IHMXE6B3SKBHMGL5NNGHHH452N22KH/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Moderator please

2023-08-22 Thread Bináris
Who is the moderator here? I sent a message with a small picture that was
not avoidable to show the problem and it got stuck. Please, help.

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/3NKS5SCQCDSQ5X4ZHZPFA5CXEKWMVJHN/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Request for permission to create a Conda package for Pywikibot

2023-06-01 Thread Bináris
Welcome! I think nobody may give you a permission as nobody is boss or
owner here. :-) This is a free collaboration. Pywikibot is under MIT
license, that is the key.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/FFZWSZR4EVM2WAUC7JY7QY5NAF645OIC/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Private wiki configuration/Get page from id

2023-05-11 Thread Bináris
JJMC89  ezt írta (időpont: 2023. máj. 12., P,
1:12):

> There isn't a way to instantiate `Page` from an id.
>

But perhaps should be. Title is not always good for restoring the same page.

Your page id is 1. Sb. renames it – the actual article will have other
title with id 1, the redirect page the old title with new id. However, you
cannot be sure that the redirect leads to the old page at any time! While
manually check the logs is simply, to create an algorithm that finds the
original is very complicated.

The other case is deletion and recreation, that is not a big problem.

So I think page from id is a legal use case.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/DVPQASBZZWETZ5BXFTS4PIJ5GO7SFQRH/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Limit cosmetic changes by a function or generator

2023-04-02 Thread Bináris
Hi,
I wrote a module which handles Flagged Revisions in huwiki.
https://hu.wikipedia.org/wiki/Szerkeszt%C5%91:BinBot/huwiki/flaggedrevs.py
It has a function called cosmeticable(page) to tell if a page is eligible
for cosmetic changes according to huwiki rules.

It also has a CosmeticableFilterPageGenerator which yields only
cosmeticable pages. But it may not have a command-line argument as it
is not in the framework.

Now, what is the way to tell Pywikibot that cosmetic changes should be done
only on pages where the function returns True or which are from this
pagegenerator?
I don't want to modify the core system on my device, because it will be
disrupted when refreshing and is not distributable to other users.

In eneral, is there a way to use own _global_ command-line arguments?
-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/XXEP5USF2XA5O4WUM2LULZMQZTBWYSHJ/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Place for Wikipedia in the framework

2023-03-31 Thread Bináris
Roy Smith  ezt írta (időpont: 2023. márc. 31., P, 17:25):

> For example, as I noted on the phab ticket, I've got my own code which
> determines if an article is a biography.  It uses an entirely different
> method than your code does.  For what I was doing, my method is the right
> way.  For what you're doing, your method is the right way.  It's not clear
> that either method is universally the right way, so putting either of those
> in the core codebase may impose on everybody something which isn't the
> right thing for them.
>

Thank you for your thoughts.
I read your code and found it useful. As you say there, some heuristics is
in the thing, so determining whether an article is a biography is not
exact, which is a problem. My approach is that there are basic indicators
for it, especially P31/Q5. That means it is very likely to be a biography.
If it returns a False, we don't say it is not a biography, but that we have
to investigate further. What I do is very similar to yours: looking for
categories and infoboxes. You found "People and person infobox
templates"category.
I found Kategória:Személyek infoboxsablonjai in huwiki. These two are
connected through Wikidata. https://www.wikidata.org/wiki/Q4574 is
something that could be really useful to write a basic code for all
Wikipedias, and it has 81 interwikis. Then everybody can add own criteria.
Once we decided by specific points of view that a certain article is a
biography, we could instantiate a subclass of Page that yould do a lot of
things primarily based on Wikidata. That's how I see,
An example I have just thought of: as living person templates on talk pages
can again be connected through Wikidata, or listed somehow, and so do
living person categories, we could have a maintenance script that lists
possible contradictions between the article, the talk page and Wikidata if
the person is living or dead. We could offer this in scripts directory for
those who cannot code themselves. I wote something, but nobody will use it
in any other Wikipedia. Now if there is nobody in a small wiki who is able
and willing to code this, they won't have the feature.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/DXZDHM2R7CWALRVHUWWKAU5I5DTMB2KR/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Place for Wikipedia in the framework

2023-03-31 Thread Bináris
Tl;dr: is there a place for Wikipedia-related code? What do we do for code
reusability?

I proposed a Page method in https://phabricator.wikimedia.org/T328769.
This would have shown if an article is a biography (it is about a person).
My idea was opposed because the codebase of BasePage and APIPage is not
Wikipedia-related, and some developers don't want to see any
Wikipedia-specific code in it.
OK, let's say, this is a valid argument. Let's call it *code purity*.

On the other hand, Pywikibot is mostly developed by Wikipedians, mostly
used in Wikipedia, and biographies form a primary scope of Wikipedia. I
definitely think that biographies SHOULD be subclassed to have a lot of
methods that are useful for a lot of Wikipedias and bot owners. If they
write this code for themselves again and again, that's a waste.
Now I definitely will use this feature. What can I do?
First idea is to subclass Page in my code. That is the natural solution. Of
course, when I publish my scripts, others won't be able to use them, and I
won't be able to use others' scripts as they are, because I need this
subclass. Let's call this point od view *code reusability* which is
generally kept an important thing in the world of programming.

Now, what we do (see the above task) is that we throw away code reusability
for the sake of code purity. Is that OK?

I am honestly curious, where the place of Wikipedia is in this framework.

What I WILL do in the present situation: write a module called huwiki and
don't bother other Wikipedias and place my code into this module. It will
contain functions that take the page as parameter (not nice, not natural, I
don't like it, but this is the only way if I cannot subclass) and nice
pagegenerators, all for Hungarian Wikipedia alone, because I need them.

Is that really what we want?
Please help to find the place of Wikipedia-related code.
-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/FV5PQBIFQD3MFJTVOTGQJOLZC4AHZNNK/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] OFF: Idle 80

2023-03-28 Thread Bináris
Wikipedia says me that Eric Idle (after whom IDLE is named) is 80 today.
Well, on a Pythonic mailing list this may be interesting. :-)

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/5O7XZMQTVBINVKVO6BYI3RTOSJIWZU4V/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Huwiki has new namespaces today, Pywikibot does not handle them

2023-03-27 Thread Bináris
Solved: I emptied the apicache-py3 directory, and it works. It always helps
if you write about a problem publicly, the solution comes after. :-)

Bináris  ezt írta (időpont: 2023. márc. 27., H, 20:52):

> Today in wikipedia:hu namespaces 118, 119 were set. See T33308.
> https://phabricator.wikimedia.org/T333083
>
> Now I have problems with the new namespaces.
>
> Message: KeyError: '118 is not a known namespace. Maybe you should clear
> the api cache.'
> Source: Pywikibot\pywikibot\site\_namespace.py
>
> >>> list(site.namespaces())
> [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92,
> 93, 100, 101, 710, 711, 828, 829, 2300, 2301, 2302, 2303]
>
> How to clear the API cache? Should Pywikibot automatically recognaize the
> new namespaces or shall I alter the code somewhere?
>
> --
> Bináris
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/YNTJEIP2PGYPNDARNFGIF4RXQX2U33DK/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Huwiki has new namespaces today, Pywikibot does not handle them

2023-03-27 Thread Bináris
Today in wikipedia:hu namespaces 118, 119 were set. See T33308.
https://phabricator.wikimedia.org/T333083

Now I have problems with the new namespaces.

Message: KeyError: '118 is not a known namespace. Maybe you should clear
the api cache.'
Source: Pywikibot\pywikibot\site\_namespace.py

>>> list(site.namespaces())
[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92,
93, 100, 101, 710, 711, 828, 829, 2300, 2301, 2302, 2303]

How to clear the API cache? Should Pywikibot automatically recognaize the
new namespaces or shall I alter the code somewhere?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/F7DWBG7QJKVYDJMIDC3R4357EPJHWIDK/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: How to avoid leaving extra blank lines when removing templates?

2023-03-22 Thread Bináris
Biking is great and sometimes hard to begin when the other option is
coding. :-)

My approach would be to import template.py as a module which is able to do
the work. Now I see, it has everything in __init__, so not very flexible,
and needs a page generator.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/2TTFBK55IY2NOMWKUXJNQNX2JOH64KDC/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Pywkibot Cookbook

2023-03-09 Thread Bináris
A cookbook has been partially published on the first link. Feel free to
correct, enhance, add your own experiences. Contents are on the right side,
but new chapters may be added by editing the template if you miss something.
Red parts are being prepared on the second link.
Some bugs were discovered during the process, the the last one.

   - https://www.mediawiki.org/wiki/Manual:Pywikibot/Cookbook
   - https://www.mediawiki.org/wiki/User:Bin%C3%A1ris/Pywikibot_cookbook
   - https://phabricator.wikimedia.org/T330855


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/22ODKK5DCKVIE3OKTG6RXR36B4HX4AD7/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Versionchanged

2023-03-05 Thread Bináris
 ezt írta (időpont: 2023. márc. 3., P, 18:14):

> It is always the current version when the change was made.
>

But until yesterday the current version was 8.1.0dev0, then it became 8.0.1
which could not been foreseen.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/3RIKYIPYHANYLHKMX6DYK4RMRBLIW3T7/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Versionchanged

2023-03-03 Thread Bináris
When you contribute something to the framework, how do you know what
version comes to docstring after versionadded or versionchanged?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/D3OIDQJPFYEPDXZYM4A3YT72JEY4DOZI/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Error logging into Wikipedia through pywiki bot on local device

2023-02-28 Thread Bináris
See also https://phabricator.wikimedia.org/T330488

For me it is the same, but still I can save pages under my bot's name.
Myterious. Try to save a page.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/K2F34QNISUV5PX3LWUAS5NTJVAJ7PI4M/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Line breaking the cite templates

2023-02-27 Thread Bináris
Now we have an advanced template_regex in textlib, is it not good? Better
mwparserfh or template_regex?
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/G6H6I2EIPJZ44TU33ADNDDPZNCRQK26C/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Line breaking the cite templates

2023-02-27 Thread Bináris
No problem, I never used cosmetic changes, but will have a look. I just
wanted to know if it is ready or I have to do it.

 ezt írta (időpont: 2023. febr. 27., H, 12:25):

> Don’t see the fix but cosmetic changes only for that template. Where was
> the problem here?
>
> Best
> xqt
>
> Von meinem iPhone gesendet
>
> Am 27.02.2023 um 07:46 schrieb Bináris :
>
> 
> Do we have a script or fix for breaking the cite templates like this?
>
> https://hu.wikipedia.org/w/index.php?title=Cseh_K%C3%A1lm%C3%A1n=prev=25862570
>
> --
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/OOM7BSTDID2GVCFHIWGGAWZASMXFRELL/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4KCH7E53S355WHGIOHQUHIL5HGDUA7RN/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/CDH5RKZVH5QCQA5SYUIKIMPTXKPJI34T/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Line breaking the cite templates

2023-02-26 Thread Bináris
Do we have a script or fix for breaking the cite templates like this?
https://hu.wikipedia.org/w/index.php?title=Cseh_K%C3%A1lm%C3%A1n=prev=25862570

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/OOM7BSTDID2GVCFHIWGGAWZASMXFRELL/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Multiple users in user-config.py?

2023-02-23 Thread Bináris
Roy Smith  ezt írta (időpont: 2023. febr. 24., P, 0:42):

> My bot needs to be able to run as either of two different accounts
> depending on the task.  DYKToolsBot for most things, DYKToolsAdminBot for
> specific tasks that need admin rights.  How do I do this?
>

I just got up to quickly wirite somewhere that we need separate
user-fixes.pys per user, best defined in config.py, and this mail waited me
here. :-)
So we should have per user configs.

An ugly workaround by that time what I did with logins: a Windows batch.
ren other.lwp temp.lwp
ren pywikibot.lwp other.lwp
ren temp.lwp pywikibot.lwp

If you start your scripts froma  batch (or Linux script), this is no extra
pain with user-config.py.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/34WRSZ4QTOB4ORFPNHINUJHJQQ5DQOKI/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Checkuser

2023-02-23 Thread Bináris
Roy Smith  ezt írta (időpont: 2023. febr. 23., Cs, 20:09):

> It's based on mwclient instead of pywikibot, but I do have some code that
> uses the checkuserlog API.
>

Thank you! I don't know mwclient and hate dealing with login, but I will
have a look.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4DBAKSFGO4BLNSV5PKB2766VMP6FK2YH/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Checkuser

2023-02-23 Thread Bináris
Folks, do we have anything to use CU/Investigate by bot?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/5JDS74VISDF4L62QEFPPWNRL4FCHVH3P/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Unable to commit

2023-02-20 Thread Bináris
Roy Smith  ezt írta (időpont: 2023. febr. 20., H, 18:24):

>
> The rest of what I wanted to say was that, for better or worse, git has
> won, at least now.  Looking for client applications that make it easier to
> use is a good thing, but I hope nobody is thinking of moving to some other
> VCS for the underlying repository and protocol.
>

I am not a dreamer, I know that SVN is dead, and if I want to do anything
with programming in 2023, I have to go on with git. That would be OK.
More problem is with gerrit. I know that some folks want to move to Gitlab,
but there is no deadline, and I don't want to wait some more years. I
didn't vote for gerrit when we had the choice on this list, but the
majority voted for moving together with MediaWiki developers. That is still
OK.
The main issue is this strange and mystic error with pulling i18n
submodule. Google is not my friend, I tried everything that I found on
Stackoverflow, and nothing hepls.

For several years I maintained compat/trunk on my computer, developed
scripts for myself. But last year sysops decided to throw out every bot for
some security problem, and by that time login didn't work any more, so I
couldn't go on. Now I was forced to get know the core, and I will have
tremendous work with replace.py until it will have the same knowledge for
me. Once I have to do this, I want to do for everybody, so that other
people can use my developments and I don't have to maintain a whole
personal branch. :-) That is my life story. :-)
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/LUW3FUQAWXYPM6URVWUDR47N2DPVNOLT/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Unable to commit

2023-02-20 Thread Bináris
 ezt írta (időpont: 2023. febr. 20., H, 18:20):

>
>
> … Sorry the mail was committed by accident…
>
> Anyway I would like to recommend TortoiseGit. I’ve wrote a documentation
> at mediawiki wiki how to use it.
>
> Maybe we can organize an online meeting to introduce this way or I could
> help remote via TeamViewer. How do you find my proposals, how should we
> proceed?
>

Yes, absolutely! I will be very grateful for your help!
You already spoke me about Tortoisegit, so I gave it a chance, but the
error message was the same as in command line git. In Phabricator you may
see how many ideas I got from people, and none of them helped.
Theoretically I cannot interpret the situation that a 500 server error
occurs just for me, because either there is a server error or not, and 500
means internal error, not client side.

So yes, I ask your help!
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/EMK2VMIX77CSS5O5IMQMNU2WNJ2ADMWI/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Unable to commit

2023-02-20 Thread Bináris
Thank you for the idea! This sounds interesting. But I would have to upload
my private key to Toolforge, which sounds bad, wouldn't I?

Yusuke Matsubara  ezt írta (időpont: 2023. febr. 20., H,
12:48):

> Hi Bináris
>
> Can you perhaps push from your toolforge user directory? [1] As a
> workaround, something like this might work for you.
>
> 1. Download the pywikibot zip to your local environment. Apparently
> it's Windows in your case, but it can be anything.
> 2. Make changes to the files. I assume you can run tests as well.
> 3. Use ssh to login to toolforge, and use git clone to setup a clone
> of the pywikibot git repository in your toolforge user directory.
> 4. Copy the locally changed files to your toolforge user directory.
> (Use a rsync or sftp client.)
> 5. Back to the toolforge shell, commit the changes to the repository
> in your toolforge user directory, and push using git review.
>
> [1] https://wikitech.wikimedia.org/wiki/Portal:Toolforge/Quickstart
>
> # I see the linked phabricator ticket was declined because the
> discussion was getting out of scope. I hope this one last message
> helps. Otherwise, we probably shouldn't continue talking about
> individual setups here as well.
>
> -Yusuke (User:Whym)
>
>
> On Wed, Feb 15, 2023 at 8:19 PM Bináris  wrote:
> >
> > Folks, I really made a lot of effort, even asked somebody to help IRL,
> but I am tired.
> >
> > I want develop Pywikibot, instead I am struggling with the working
> environment. Although git is hundred times as complicated as SVN and gerrit
> is a nightmare, my main problem is with git installing i18n submodule.
> > See https://phabricator.wikimedia.org/T329452
> >
> > It causes two main problems:
> >
> > I cannot run tests. I have another copy of Pywikibot from downloaded
> zip, I can run tests there, but the same command fails in git copy.
> > I cannot push my commits. For some reason an i18n part is always
> included which makes Jenkins fail. Now I can remove it after pushing, but
> Jenkins fails again, see
> https://gerrit.wikimedia.org/r/c/pywikibot/core/+/888745
> >
> > Error message:
> https://integration.wikimedia.org/ci/job/pywikibot-core-tox-doctest-docker/7631/console
> : FAILURE in 33s
> > I am very frustrated and disappointed, but I cannot do anything until
> T329452 is solved somehow.
> >
> > --
> > Bináris
> > ___
> > pywikibot mailing list -- pywikibot@lists.wikimedia.org
> > Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/MQWDKSWS5LBBEZ4LHOMGAZRKFG3O7OZM/
> > To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/QLKUHZGPT4FCVE54ZVR7VSBMOE43VIE6/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/RB3QT4VOE3ULBQWW6L3MA7CB77AMYRZF/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: pywikibot.stopme()

2023-02-20 Thread Bináris
Thank you!
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/255JAENW7DXNQMONIUAJVTBAVBFWISVK/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] pywikibot.stopme()

2023-02-19 Thread Bináris
Is pywikibot.stopme() still useful? I don't see it in the scripts.

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/N4YTJSVS7FF4ATD7DB7IJ4JHWSCGSHLV/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Unable to commit

2023-02-15 Thread Bináris
Folks, I really made a lot of effort, even asked somebody to help IRL, but
I am tired.

I want develop Pywikibot, instead I am struggling with the working
environment. Although git is hundred times as complicated as SVN and gerrit
is a nightmare, my main problem is with git installing i18n submodule.
See https://phabricator.wikimedia.org/T329452

It causes two main problems:

   - I cannot run tests. I have another copy of Pywikibot from downloaded
   zip, I can run tests there, but the same command fails in git copy.
   - I cannot push my commits. For some reason an i18n part is always
   included which makes Jenkins fail. Now I can remove it after pushing, but
   Jenkins fails again, see
   https://gerrit.wikimedia.org/r/c/pywikibot/core/+/888745

Error message:
https://integration.wikimedia.org/ci/job/pywikibot-core-tox-doctest-docker/7631/console
: FAILURE in 33s
I am very frustrated and disappointed, but I cannot do anything until
T329452 is solved somehow.

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/MQWDKSWS5LBBEZ4LHOMGAZRKFG3O7OZM/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: f strings and regexes

2023-02-11 Thread Bináris
Yes, definitely. Thank you!

Merlijn van Deen (valhallasw)  ezt írta (időpont:
2023. febr. 11., Szo, 22:41):

> Hi Bináris,
>
> I would consider it on a case-by-case basis. Note that the guidelines
> state "should be avoided", not "are absolutely forbidden to be used" :-)
>
> For short regexps, I'd use f-strings where reasonable (i.e. where the
> regex itself does not use {} for the number of characters to match) and
> otherwise %-based formatting.
>
> For longer regexps, string concatenation can often be clearer, also
> because it makes it possible to add comments to clarify how the regexp is
> built up.
>
> Hope this helps,
>
> Merlijn / valhallasw
>
> On 11/02/2023 22:10, Bináris wrote:
>
>
>
> Bináris  ezt írta (időpont: 2023. febr. 2., Cs,
> 19:22):
>
>>
>> https://www.mediawiki.org/wiki/Manual:Pywikibot/Development/Guidelines#Miscellaneous
>> says:
>> " Prefer f-strings over string.format(). Modulo operator % for string
>> formatting should be avoided."
>>
>> I tried to rewrite a modulo-formatted regex to f-string, but than
>> realized, that in f-strings all curly braces must be doubled, which makes
>> regexes very hard to read and easy to misspell.
>>
>> What is the best practice when you substitute a variable into a regex?
>>
>> Is there any policy for this? Or should there be? If not, and modulo is
> forbidden, I think the best tapproach is to use concatenation in such
> situation. Opinions?
>
> --
> Bináris
>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at 
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/5T4HUQRFKWAOHANQD5LHPC776FIVLAPE/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/QV67KNCEWCASVZKUMDRNOIXMFEFK2DDV/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/2ED2QAZEU532SYTHHKINBQSMCNLSDGEE/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: f strings and regexes

2023-02-11 Thread Bináris
Bináris  ezt írta (időpont: 2023. febr. 2., Cs, 19:22):

>
> https://www.mediawiki.org/wiki/Manual:Pywikibot/Development/Guidelines#Miscellaneous
> says:
> " Prefer f-strings over string.format(). Modulo operator % for string
> formatting should be avoided."
>
> I tried to rewrite a modulo-formatted regex to f-string, but than
> realized, that in f-strings all curly braces must be doubled, which makes
> regexes very hard to read and easy to misspell.
>
> What is the best practice when you substitute a variable into a regex?
>
> Is there any policy for this? Or should there be? If not, and modulo is
forbidden, I think the best tapproach is to use concatenation in such
situation. Opinions?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/5T4HUQRFKWAOHANQD5LHPC776FIVLAPE/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Cannot push my commit

2023-02-06 Thread Bináris
Kunal Mehta  ezt írta (időpont: 2023. febr. 7., K,
2:03):

> Hi,
>
>
> For pushing over HTTPS, it uses a different password than your login
> one. See .
>

Thank you, Kunal! That causes another error.

   1. I told git remote set-url origin ssh://
   bin...@gerrit.wikimedia.org:29418/pywikibot/core.git. Isn't that for
   pushing on ssh? If not, what is the solution?
   2. I think " failed to probe 'https://gerrit.wikimedia.org/' to detect
   provider" is an independent error. What is our provider?
   3. The generated password for pushing is OK, bit the commit was
   rejected, see below (that needs an extra permission, who is the admin?)
   4. Even if I succed, pushing is not the recommended way, and git review
   -R does not work.
   5. I don't understand in the below message, what does it do with stable,
   it should push to master, sholdn't it?


c:\Pywikibot-dev\core>git push
warning: failed to probe 'https://gerrit.wikimedia.org/' to detect provider
warning: An error occurred while sending the request.
warning: see https://aka.ms/gcm/autodetect for more information.
fatal: An error occurred while sending the request.
fatal: A k├ęrelmet megszak├ştott├ík: Nem siker├╝lt l├ętrehozni az SSL/TLS
biztonságos csatornát.
Username for 'https://gerrit.wikimedia.org': binbot
Password for 'https://bin...@gerrit.wikimedia.org':
warning: failed to probe 'https://gerrit.wikimedia.org/' to detect provider
warning: An error occurred while sending the request.
warning: see https://aka.ms/gcm/autodetect for more information.
Enumerating objects: 40, done.
Counting objects: 100% (40/40), done.
Delta compression using up to 4 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 527 bytes | 7.00 KiB/s, done.
Total 6 (delta 5), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (5/5)
remote: error: branch refs/heads/stable:
remote: Push to refs/for/stable to create a review, or get 'Push' rights to
update the branch.
remote: User: binbot
remote: Contact an administrator to fix the permissions
remote: Processing changes: refs: 1, done
To https://gerrit.wikimedia.org/r/pywikibot/core.git
 ! [remote rejected] stable -> stable (prohibited by Gerrit: not
permitted: update)
error: failed to push some refs to '
https://gerrit.wikimedia.org/r/pywikibot/core.git'
Enumerating objects: 40, done.
Counting objects: 100% (40/40), done.
Delta compression using up to 4 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 527 bytes | 35.00 KiB/s, done.
Total 6 (delta 5), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (5/5)
remote: error: branch refs/heads/stable:
remote: Push to refs/for/stable to create a review, or get 'Push' rights to
update the branch.
remote: User: binbot
remote: Contact an administrator to fix the permissions
remote: Processing changes: refs: 1, done
To ssh://gerrit.wikimedia.org:29418/pywikibot/core.git
 ! [remote rejected] stable -> stable (prohibited by Gerrit: not
permitted: update)
error: failed to push some refs to 'ssh://
gerrit.wikimedia.org:29418/pywikibot/core.git'

c:\Pywikibot-dev\core>
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/NF24FL3HFETF45HNAXNAOANTM5R2XQIP/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Cannot push my commit

2023-02-06 Thread Bináris
One clue. I tried to ssh from git bash window as written on
https://www.mediawiki.org/wiki/Gerrit/Tutorial
For some reasons, it is looking for my SSH key in obscure non-existing
directories. I don't know where comes this idea from. Maybe pageant is
useless?
How can I set the pass to my key?

$ *ssh -p 29418 -v bin...@gerrit.wikimedia.org
*
OpenSSH_9.1p1, OpenSSL 1.1.1s  1 Nov 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to gerrit.wikimedia.org [208.80.154.137] port 29418.
debug1: Connection established.
debug1: identity file /c/Users/\303\211n/.ssh/id_rsa type 0
debug1: identity file /c/Users/\303\211n/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_xmss type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_xmss-cert type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_dsa type -1
debug1: identity file /c/Users/\303\211n/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.1
debug1: Remote protocol version 2.0, remote software version
GerritCodeReview_3.5.4 (APACHE-SSHD-2.8.0)
debug1: compat_banner: no match: GerritCodeReview_3.5.4 (APACHE-SSHD-2.8.0)
debug1: Authenticating to gerrit.wikimedia.org:29418 as 'binbot'
debug1: load_hostkeys: fopen /c/Users/\303\211n/.ssh/known_hosts2: No such
file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or
directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or
directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1...@openssh.com MAC:
 compression: none
debug1: kex: client->server cipher: chacha20-poly1...@openssh.com MAC:
 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-rsa
SHA256:j7HQoQ6fIuEgDHjONjI2CZ+2Iwxqgo2Ur5LbPqBgxOU
debug1: load_hostkeys: fopen /c/Users/\303\211n/.ssh/known_hosts2: No such
file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or
directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or
directory
debug1: Host '[gerrit.wikimedia.org]:29418' is known and matches the RSA
host key.
debug1: Found key in /c/Users/\303\211n/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /c/Users/\303\211n/.ssh/id_rsa RSA
SHA256:DfAqdC9y6xXr96g5JuTbf/Y7BXoojtoi8JHO/XAirvo
debug1: Will attempt key: /c/Users/\303\211n/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/\303\211n/.ssh/id_ecdsa_sk
debug1: Will attempt key: /c/Users/\303\211n/.ssh/id_ed25519
debug1: Will attempt key: /c/Users/\303\211n/.ssh/id_ed25519_sk
debug1: Will attempt key: /c/Users/\303\211n/.ssh/id_xmss
debug1: Will attempt key: /c/Users/\303\211n/.ssh/id_dsa
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<
ecdsa-sha2-nistp256-cert-...@openssh.com,
ecdsa-sha2-nistp384-cert-...@openssh.com,
ecdsa-sha2-nistp521-cert-...@openssh.com,ssh-ed25519-cert-...@openssh.com,
rsa-sha2-512-cert-...@openssh.com,rsa-sha2-256-cert-...@openssh.com
,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,
sk-ecdsa-sha2-nistp...@openssh.com,sk-ssh-ed25...@openssh.com
,rsa-sha2-512,rsa-sha2-256,ssh-rsa>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /c/Users/\303\211n/.ssh/id_rsa RSA
SHA256:DfAqdC9y6xXr96g5JuTbf/Y7BXoojtoi8JHO/XAirvo
debug1: Authentications that can continue: publickey
debug1: Trying private key: /c/Users/\303\211n/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/\303\211n/.ssh/id_ecdsa_sk
debug1: Trying private key: /c/Users/\303\211n/.ssh/id_ed25519
debug1: Trying private key: /c/Users/\303\211n/.ssh/id_ed25519_sk
debug1: Trying private key: /c/Users/\303\211n/.ssh/id_xmss
debug1: Trying private key: /c/Users/\303\211n/.ssh/id_dsa
debug1: No more authentication methods to try.
bin...@gerrit.wikimedia.org: Permission denied (publickey).
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 

[pywikibot] Re: Cannot push my commit

2023-02-06 Thread Bináris
Just for test I tried git push instead of review. It asked for my user name
and password, and I got this (password is correct, I just logged in to
gerrit in browser):

c:\Pywikibot-dev\core>git push
warning: failed to probe 'https://gerrit.wikimedia.org/' to detect provider
warning: An error occurred while sending the request.
warning: see https://aka.ms/gcm/autodetect for more information.
fatal: An error occurred while sending the request.
fatal: A k├ęrelmet megszak├ştott├ík: Nem siker├╝lt l├ętrehozni az SSL/TLS
biztonságos csatornát.
Username for 'https://gerrit.wikimedia.org': binbot
Password for 'https://bin...@gerrit.wikimedia.org':
warning: auto-detection of host provider took too long (>2000ms)
warning: see https://aka.ms/gcm/autodetect for more information.
remote: Unauthorized
fatal: Authentication failed for '
https://gerrit.wikimedia.org/r/pywikibot/core.git/'
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/TLD2YZBVTPS6XNDYKZXDQBW4ZI3SJKQT/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Cannot push my commit

2023-02-06 Thread Bináris
Hi,

I worked really lot to be able to commit, but nothing helps.
I have Windows.
My gerrit user is binbot, the SSH key is set.
git config --global gitreview.remote origin
git config --global gitreview.username binbot
Pageant is running, and the key is loaded. I never used it with git, it
worked previously with SVN.
I installed the latest git.
I committed my change to local repository.

I followed all the steps on https://www.mediawiki.org/wiki/Gerrit/Tutorial
including " #If_git_review_-R_fail"section.
It says to set URL that begins with ssh like this:
git remote set-url origin ssh://
bin...@gerrit.wikimedia.org:29418/pywikibot/core.git
Is that correct?

c:\Pywikibot-dev\core>git status
On branch stable
Your branch is ahead of 'origin/stable' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

Now I get two error messages, sometimes the first and sometimes the second:

c:\Pywikibot-dev\core>git review -R
warning: auto-detection of host provider took too long (>2000ms)
warning: see https://aka.ms/gcm/autodetect for more information.
fatal: Egy feladat végrehajtása megszakadt. (This means one task broke.)
bash: line 1: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://gerrit.wikimedia.org': No such
file or directory

c:\Pywikibot-dev\core>git review -R
warning: failed to probe 'https://gerrit.wikimedia.org/' to detect provider
warning: An error occurred while sending the request.
warning: see https://aka.ms/gcm/autodetect for more information.
fatal: An error occurred while sending the request.
fatal: A kérelmet megszakították: Nem sikerült létrehozni az SSL/TLS
biztonságos csatornát. (This means the request was broken, a safe SSH/TLS
channel could not be established.)
bash: line 1: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://gerrit.wikimedia.org': No such
file or directory

I also read https://aka.ms/gcm/autodetectbut did not help what to do.

Can someone help me understand this mess?
-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/E4MPQB4YVARAKTIUFNYTY5R6RZUDDUZ7/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Gerrit problem – certificate has expired

2023-02-06 Thread Bináris
I wwish we were back on Sourceforge when things were still simple. I hate
this struggle for being able to work anything.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/HEV3ERGMIQT2YHU7K3U26GNZKBVDONM3/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Gerrit problem – certificate has expired

2023-02-06 Thread Bináris
OK, now I have tha latest git, fail again:

c:\Pywikibot-dev>git clone --recursive --branch stable --depth 3
https://gerrit.wikimedia.org/r/pywikibot/core.git
Cloning into 'core'...
remote: Counting objects: 599, done
remote: Finding sources: 100% (599/599)
remote: Getting sizes: 100% (507/507)
remote: Compressing objects: 100% (4997469/4997469)
Receiving objects: 100% (599/599), 1.65 MiB | 1.44 M

Resolving deltas: 100% (120/120), done.
Submodule 'i18n' (https://gerrit.wikimedia.org/r/pywikibot/i18n) registered
for path 'scripts/i18n'
Cloning into 'C:/Pywikibot-dev/core/scripts/i18n'...
remote: Counting objects: 30, done
remote: Finding sources: 100% (87769/87769)
remote: Getting sizes: 100% (1973/1973)
remote: Compressing objects: 100% (738701/738701)
Receiving objects: 100% (87769/87769), 40.09 MiB | 1.87 MiB/s, done.
remote: Total 87769 (delta 68398), reused 87582 (delta 68239)
Resolving deltas: 100% (68398/68398), done.
error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500
fatal: expected 'acknowledgments'
fatal: Fetched in submodule path 'scripts/i18n', but it did not contain
bbf1161a0340097515684d0be835804fa06f0bea. Direct fetching of that commit
fail
ed.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/AEPD5GJX2WGUWL2HIHB3WOZFRJITWERL/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Gerrit problem – certificate has expired

2023-02-06 Thread Bináris
Zoran Dori  ezt írta (időpont: 2023. febr. 6., H,
22:32):

> Correct command for Windows is git update-git-for-windows.
>

No, my install is too old for that, this says that prior to 2.14 I have to
completely uninstall and reinstall, oh ˇ˘#@@{ˇ^°#{
https://phoenixnap.com/kb/how-to-update-git
Thank you, I will try again after reinstalling.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/SQVZCEF34YLCA3XCJTEAYZPQ4F43IIVX/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Gerrit problem – certificate has expired

2023-02-06 Thread Bináris
I found the real command:
git --version
git version 2.8.2.windows.1

A page says that git update should work, but it is also an unknown command.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/GFJFZPRZ67NU5FJMRVVBAB4BN322BT2J/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Gerrit problem – certificate has expired

2023-02-06 Thread Bináris
No, it is not the latest. I dod not thnk this can cause such a strange
message.

Unknown option: -v

Zoran Dori  ezt írta (időpont: 2023. febr. 6., H,
22:10):

> Hello,
> I'm not having this issue on my laptop/server and others. Are you sure
> that you are using the latest version of the git package?
>
> Can you run git -v in your command line and send it here?
>
> Best regards,
> Zoran
>
> пон, 6. феб 2023. у 21:57 Bináris  је написао/ла:
>
>>
>> I try to install Pywikibot with git, following
>> https://www.mediawiki.org/wiki/Manual:Pywikibot/Development and
>> https://www.mediawiki.org/wiki/Gerrit/Tutorial
>> When it comes to git clone, I keep getting this:
>>
>> Cloning into 'core'...
>> fatal: unable to access '
>> https://gerrit.wikimedia.org/r/pywikibot/core.git/': SSL certificate
>> problem: certificate has expired
>>
>> Is it possible? I can't believe. Or is there another problem causing this
>> message?
>> --
>> Bináris
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> Public archives at
>> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/2VLOP6BDR2D5YLYJVOJOKVIEC6ADAN4E/
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/JJPJB4ZPM3RXPBPDSZENSP3HYY62U34X/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/CMA4FF3YGL4IGHTNZYOC2W63XCPVZT4B/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Gerrit problem – certificate has expired

2023-02-06 Thread Bináris
I try to install Pywikibot with git, following
https://www.mediawiki.org/wiki/Manual:Pywikibot/Development and
https://www.mediawiki.org/wiki/Gerrit/Tutorial
When it comes to git clone, I keep getting this:

Cloning into 'core'...
fatal: unable to access 'https://gerrit.wikimedia.org/r/pywikibot/core.git/':
SSL certificate problem: certificate has expired

Is it possible? I can't believe. Or is there another problem causing this
message?
-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/2VLOP6BDR2D5YLYJVOJOKVIEC6ADAN4E/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: How to list logs?

2023-02-05 Thread Bináris
Thank you! The reason is that I have not found any pattern how to do it,
and tried to find something in docs.

However,
https://doc.wikimedia.org/pywikibot/master/api_ref/logentries.html#module-logentries
does not list DeleteEntry, and the search lists only results in tests, not
the production modules. Is it a bug?

JJMC89  ezt írta (időpont: 2023. febr. 6., H,
0:49):

> Is there a reason that you're trying to use LogEntryListGenerator instead
> of the site's logevents method?
>
> >>> import pywikibot
> >>> site = pywikibot.Site()
> >>> gen = site.logevents('delete')
> >>> print(next(gen))
> 
>
>
> On Sun, Feb 5, 2023 at 3:31 PM Bináris  wrote:
>
>> I tried to list delete log entries:
>>
>> from pywikibot.data.api import LogEntryListGenerator
>> gen = LogEntryListGenerator('delete')
>> print(next(gen))
>>
>> I get a wirning and an error:
>> WARNING: c:\Pywikibot\pywikibot\data\api\_generators.py:857: *RuntimeWarning:
>> LogEntryListGenerator invoked without a site*
>>   super().__init__('logevents', **kwargs)
>>
>> Traceback (most recent call last):
>>   File "pwb.py", line 39, in 
>> sys.exit(main())
>>   File "pwb.py", line 35, in main
>> runpy.run_path(str(path), run_name='__main__')
>>   File "C:\Python37\lib\runpy.py", line 263, in run_path
>> pkg_name=pkg_name, script_name=fname)
>>   File "C:\Python37\lib\runpy.py", line 96, in _run_module_code
>> mod_name, mod_spec, pkg_name, script_name)
>>   File "C:\Python37\lib\runpy.py", line 85, in _run_code
>> exec(code, run_globals)
>>   File "pywikibot\scripts\wrapper.py", line 516, in 
>> main()
>>   File "pywikibot\scripts\wrapper.py", line 500, in main
>> if not execute():
>>   File "pywikibot\scripts\wrapper.py", line 487, in execute
>> run_python_file(filename, script_args, module)
>>   File "pywikibot\scripts\wrapper.py", line 148, in run_python_file
>> main_mod.__dict__)
>>   File "scripts\userscripts\reasonstat.py", line 141, in 
>> main()
>>   File "scripts\userscripts\reasonstat.py", line 112, in main
>> print(next(gen))
>>   File "C:\Python37\lib\_collections_abc.py", line 317, in __next__
>> return self.send(None)
>>   File "c:\Pywikibot\pywikibot\tools\collections.py", line 275, in send
>> return next(self._started_gen)
>>   File "c:\Pywikibot\pywikibot\data\api\_generators.py", line 628, in
>> generator
>> yield from self._extract_results(resultdata)
>>   File "c:\Pywikibot\pywikibot\data\api\_generators.py", line 572, in
>> _extract_results
>> result = self.result(item)
>>   File "c:\Pywikibot\pywikibot\data\api\_generators.py", line 864, in
>> result
>> return self.entryFactory.create(pagedata)
>>   File "c:\Pywikibot\pywikibot\logentries.py", line 339, in create
>> return self._creator(logdata)
>>   File "c:\Pywikibot\pywikibot\logentries.py", line 329, in 
>> self._creator = lambda data: logclass(data, self._site)
>>   File "c:\Pywikibot\pywikibot\logentries.py", line 42, in __init__
>> .format(expected_type, self.type()))
>>
>> *pywikibot.exceptions.Error: Wrong log type! Expecting delete, received
>> review instead.CRITICAL: Exiting due to uncaught exception > 'pywikibot.exceptions.Error'>*
>>
>> What's wrong?
>>
>> --
>> Bináris
>> _______
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> Public archives at
>> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4ALA4QMCAYGVI5Y6Z5JQGH3YL3PLDMSM/
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/7I7NNIYG3C67FJGRTGDEZOKRH3P2RKRI/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/SIDFU4YBOOEENQ2KFJJYZKNEPXZMENBM/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] How to list logs?

2023-02-05 Thread Bináris
I tried to list delete log entries:

from pywikibot.data.api import LogEntryListGenerator
gen = LogEntryListGenerator('delete')
print(next(gen))

I get a wirning and an error:
WARNING: c:\Pywikibot\pywikibot\data\api\_generators.py:857: *RuntimeWarning:
LogEntryListGenerator invoked without a site*
  super().__init__('logevents', **kwargs)

Traceback (most recent call last):
  File "pwb.py", line 39, in 
sys.exit(main())
  File "pwb.py", line 35, in main
runpy.run_path(str(path), run_name='__main__')
  File "C:\Python37\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
  File "C:\Python37\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
  File "C:\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "pywikibot\scripts\wrapper.py", line 516, in 
main()
  File "pywikibot\scripts\wrapper.py", line 500, in main
if not execute():
  File "pywikibot\scripts\wrapper.py", line 487, in execute
run_python_file(filename, script_args, module)
  File "pywikibot\scripts\wrapper.py", line 148, in run_python_file
main_mod.__dict__)
  File "scripts\userscripts\reasonstat.py", line 141, in 
main()
  File "scripts\userscripts\reasonstat.py", line 112, in main
print(next(gen))
  File "C:\Python37\lib\_collections_abc.py", line 317, in __next__
return self.send(None)
  File "c:\Pywikibot\pywikibot\tools\collections.py", line 275, in send
return next(self._started_gen)
  File "c:\Pywikibot\pywikibot\data\api\_generators.py", line 628, in
generator
yield from self._extract_results(resultdata)
  File "c:\Pywikibot\pywikibot\data\api\_generators.py", line 572, in
_extract_results
result = self.result(item)
  File "c:\Pywikibot\pywikibot\data\api\_generators.py", line 864, in result
return self.entryFactory.create(pagedata)
  File "c:\Pywikibot\pywikibot\logentries.py", line 339, in create
return self._creator(logdata)
  File "c:\Pywikibot\pywikibot\logentries.py", line 329, in 
self._creator = lambda data: logclass(data, self._site)
  File "c:\Pywikibot\pywikibot\logentries.py", line 42, in __init__
.format(expected_type, self.type()))

*pywikibot.exceptions.Error: Wrong log type! Expecting delete, received
review instead.CRITICAL: Exiting due to uncaught exception *

What's wrong?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4ALA4QMCAYGVI5Y6Z5JQGH3YL3PLDMSM/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: How to ignore all the non-visible stuff?

2023-02-04 Thread Bináris
from pywikibot.textlib import   removeDisabledParts
print(removeDisabledParts(text))

This makes something similar, but just the noinclude tag is not included.
Bot if you follow the source from
https://doc.wikimedia.org/pywikibot/master/api_ref/textlib.html#textlib.removeDisabledParts,
you can adapt it.
Alternatively, you could use re.sub().

Roy Smith  ezt írta (időpont: 2023. febr. 4., Szo, 20:34):

> [[:en:Template:Did you know/Queue/NextPrep]] contains:
>
> > 4 
> > {{documentation|content=This number indicates the next DYK prep set to
> move into the queue.}}
> > 
>
> What I want to get is just the "4".  Is Page.extract() what I'm looking
> for?  Experimentally, it does what I want, but it's not clear if this is
> actually the intended use case.
>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/G5Z3TPTY3QFPZALSCVW7ZVTXJ7ZTZ5BC/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4QLMCKCZX2LLZ5NHZRTDB3HONSYA56R4/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] f strings and regexes

2023-02-02 Thread Bináris
https://www.mediawiki.org/wiki/Manual:Pywikibot/Development/Guidelines#Miscellaneous
says:
" Prefer f-strings over string.format(). Modulo operator % for string
formatting should be avoided."

I tried to rewrite a modulo-formatted regex to f-string, but than realized,
that in f-strings all curly braces must be doubled, which makes regexes
very hard to read and easy to misspell.

What is the best practice when you substitute a variable into a regex?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/MEBKKQUONDOPCKOMW6XM6XHFNPPKNCDB/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: How to exclude HTML comments

2023-01-31 Thread Bináris
OK, I digged into the code, and found removeDisabledParts().

Bináris  ezt írta (időpont: 2023. jan. 30., H, 23:09):

> Given a piece of text, I want to exclude  when
> searching a template. Is there a ready-to-use, nice, canonical method for
> it?
>
> --
> Bináris
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/RB2D3WRZW33EENZZR46L6H4BJQX5BZ7Q/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Templates in archivebot.py

2023-01-30 Thread Bináris
Hi,

In archivebot.py there is a line:
# TODO: handle marked with template
This means resolved and unresolved sections. Unresolved sections are not to
be archived even if they are old enough, resolved could be archived faster.

I coded unresolved for Hungarian Wikipedia (1), and I will do the resolved,
too. But this way we use a separate branch. If we want to do it in general,
we should put the templates somewhere. Templates depend on project, not
language.
There may also be a set of templates to trigger the same behaviour, see
e.g. (1) for variety of templates.
So we want a set of "resolved" and another set of "unresolved" templates
per project.
What is the nice architecture? Where would you put them? Of course, the
easiest way is to hardcode in the script, but I think we don't do such
things nowadays.

[1]
https://hu.wikipedia.org/w/index.php?title=Szerkeszt%C5%91:Atobot/archivebot_hu.py=prev=25774753
[2] https://en.wikipedia.org/wiki/Template:Unresolved
-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/NVBM32L3FMTB4CGHW7RNDW42MJMHOVQA/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] How to exclude HTML comments

2023-01-30 Thread Bináris
Given a piece of text, I want to exclude  when searching
a template. Is there a ready-to-use, nice, canonical method for it?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/2WGT4DOVUHQT6HOLPY7UBE5TFTQAADYR/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Tortoise SVN installs an old version

2023-01-30 Thread Bináris
Hi Merlijn,

Merlijn van Deen (valhallasw)  ezt írta (időpont:
2023. jan. 30., H, 20:24):

>
> However: SVN support on Github is scheduled to be removed in January 2024:
> https://github.blog/2023-01-20-sunsetting-subversion-support/ , so I
> would suggest switching to another distribution method (pip, nightlies,
> git) sooner rather than later.
>
Yes, I will have to use git someday to commit again. I tried pip, but it
installed under Python, and I want it in a separate directory under root,
as I work in it all the time. Is there a way to use pip for installing and
upgrading in C:\Pywikibot? At the end I downloaded zip version, it works.

> I've updated the documentation pages with the correct URL plus a warning
> about the pending deprecation.
>
Thank you!
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4MJEBSAWDONN633NX6ITLXSIBTJN7TRS/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Tortoise SVN installs an old version

2023-01-30 Thread Bináris
I wanted to put a warning on the page, but it does not let me save it for
some silly translation issues. I give it up, somebody will be happy that I
can't edit a simple page after 16 years of being a Wikipedian.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/Y3DARPKTN2VPWFAE5VLBJSHSMZL3GND2/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Tortoise SVN installs an old version

2023-01-30 Thread Bináris
Zoran Dori  ezt írta (időpont: 2023. jan. 30., H,
14:19):

>
> Are you using a GUI extension or are you cloning via the command line?
>

Tortoise SVN GUI.
Thanks.
I will try then download a zip version.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/V4FO4QDD5GIV4LBXWAM7KDOEI3EPX2M3/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: SVN install vs i18n

2023-01-30 Thread Bináris
Solved: the problem was that I had a working 7.7.x copy of Pywikibot, and I
wanted to reinstall it with SVN.
A clean install solved it.

Bináris  ezt írta (időpont: 2023. jan. 30., H, 13:41):

> Hi,
>
> I followed
> https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation/SVN#Download_Pywikibot_with_TortoiseSVN_for_Windows_user
> At the last step I get SVN error:
> C:\Pywikibot\scripts\i18n
> The node 'C:\Pywikibot\scripts\i18n' was not found.
>
> What i the next step?
>
> --
> Bináris
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/QUKZXHX5HKY2KG7TQQAYKXLAC7WWJLUM/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] SVN install vs i18n

2023-01-30 Thread Bináris
Hi,

I followed
https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation/SVN#Download_Pywikibot_with_TortoiseSVN_for_Windows_user
At the last step I get SVN error:
C:\Pywikibot\scripts\i18n
The node 'C:\Pywikibot\scripts\i18n' was not found.

What i the next step?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/VY4JG23GRWI4JN36DFB3CKMHM4KRUTNN/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Pruning category search?

2023-01-20 Thread Bináris
Roy Smith  ezt írta (időpont: 2023. jan. 14., Szo, 19:15):

> Is there a way to recurse through a category, but excluding specific
> sub-cats?  For example, I want to find all the templates in
> [[Category:People and person infobox templates]], except that I don't want
> to recurse into [[Category:Styles infobox templates]].
>

Idea 1: Create the list from the desired cat, then during iteration
explicitly discard those having the string " Category:Styles infobox
template" (not too elegant, and may be errors, e.g. when there is a space
after :)
Idea 2: Create sets of both category, then suntract:
https://www.geeksforgeeks.org/python-set-difference/
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/TQJNRTX75KD77H4N64JDFEA5MYIUUDN2/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Getting started

2022-12-28 Thread Bináris
Hi,
ou can start using Pywikibot without programming knowledge for common tasks
such as disambiguation or simple text replacements.
Have a look at https://m.mediawiki.org/wiki/Manual:Pywikibot, and click on
"existing scripts" to begin.
Scipts usually work with -help parameter to see the parameters.

 ezt írta (időpont: 2022. dec. 28., Sze,
21:34):

> I have recently installed pywikibot and wanted to ask whether a prior
> knowledge of scripting is required to get started with it?
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Use re.fullmatch instead of $ at the end of regex

2022-12-26 Thread Bináris
I got a mail from Gerrit with the above subject.

Just to put my 2 cents: while this change may help the regex to be more
readable, such changes in high-scale may harden the transforming of regexes
between Pywikibot format and AWB format, and we have a Phab ticket about
the cooperation. As we use more Python-specific regexes, the Pywikibot
users and AWB uers may be able to help each other less on bot owners'
noticeboards.

This is not a critics, just a point of view which may worth to consider.
-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Working with wikitables

2022-12-22 Thread Bináris
William Avery  ezt írta (időpont: 2022. dec. 22.,
Cs, 11:12):

> FWIW, I wrote a bot script to sort some tables a while ago.
>
>
> https://bitbucket.org/WilliamAvery/wikipythonics/src/master/draftPickSortBot.py
>

Thank you, I will test it!
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Working with wikitables

2022-12-21 Thread Bináris
I don't find the description of objects and available tags in
documentation, can you help me?
Are there cells, rows, columns, headings?
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Handling import errors

2022-12-21 Thread Bináris
In commons_information.py

try:
import mwparserfromhell
except ImportError as e:
mwparserfromhell = e

try:
import langdetect
except ImportError:
langdetect = None

Later it examines
if isinstance(mwparserfromhell, Exception):
raise mwparserfromhell

Why is it good to delay in such complicated way? Why does not handle the
script the error at once?

I want to invent a script dealing with tables. It could be used directly
with simple arguments and imported in order to use advanced functions. What
is the good way of handling import error? I don't like this mismatch that
mwparserfromhell is either a module or an Exception, is there any advantage
of this solution?
-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Working with wikitables

2022-12-21 Thread Bináris
Do we have anything to exclude tables from page text? I read
mwparserfromhell doc, but did not find.

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Pywikibot documentation

2022-12-21 Thread Bináris
Thank you, I could not follow the details, but anyway, that was a great
work.

Please help me understand the infrastructure.
We have Manual:Pywikibot on mediawiki.org, which is a completely manual
work.
Quite independently, we have https://doc.wikimedia.org/pywikibot/, which
should be partially? completely? automatic. It comes from docstrings of
scripts and methods.
Is that correct?
The syntax in docstrings is strange for me. Where is it described?


 ezt írta (időpont: 2022. dec. 15., Cs, 18:21):

>
> Hi all,
>
> our Pywikibot documentation has been revised (thank you KBach).
>
> Please visit the new documentation style. Comments are very welcome at
> https://phabricator.wikimedia.org/T322212 or by replying this mail.
>
> - https://doc.wikimedia.org/pywikibot/tests/ the new furo theme with
> Sphinx 5.3
> - https://doc.wikimedia.org/pywikibot/master/ the old nature theme with
> Sphinx 5.3
> - https://doc.wikimedia.org/pywikibot/stable/ the old nature theme with
> Sphinx 5.1.1
>
> Best
> xqt
>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Page views

2022-12-18 Thread Bináris
Thanks!
Meanwhile Xqt created https://phabricator.wikimedia.org/T325473.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Page views

2022-12-18 Thread Bináris
Click
https://hu.wikipedia.org/w/index.php?title=Erfurti_latrinabaleset=info
Ctrl F "Megtekintések száma az elmúlt 30 napban"
Click on the number next to it
Gives pop-up diagram


Pywikibot.ico
Description: Binary data
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Error when trying to log in

2022-12-18 Thread Bináris
 ezt írta (időpont: 2022. dec. 18., V, 9:22):

> It is 1.38.4
>

That is not too old, the problem should be elsewhere.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Page views

2022-12-17 Thread Bináris
At left of articles there is a page information link, which shows recent
page views on a diagram.
Can I get these page views numerically by Pywikibot?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Error when trying to log in

2022-12-17 Thread Bináris
What MediaWiki version uses that site?

 ezt írta (időpont: 2022. dec. 17., Szo, 18:11):

> I'm trying to get pywikibot set up for the first time. It's on a Miraheze
> site and I'm getting this error when I try to log in:
>
> ---
> WARNING: Non-JSON response received from server comprehensibleinputwiki:en
> for url
> https://comprehensibleinput.miraheze.org/w/api.php
> The server may be down.
> Status code: 200
>
> The text message is:
>
> MediaWiki API help - Comprehensible Input Wiki
>
> document.documentElement.className="client-js";RLCONF={"wgBreakFrames":true,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"7a406c0d0d1c2121406e444b","wgCSPNonce":false,"wgCanonicalNamespace":"Special","wgCanonicalSpecialPageName":"ApiHelp","wgNamespaceNumber":-1,"wgPageName":"Special:ApiHelp","wgTitle":"ApiHelp","wgCurRevisionId":0,"wgRevisionId":0,"wgArticleId":0,"wgIsArticle":false,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Special:ApiHelp","wgRelevantArticleId":0,"wgIsProbablyEditable":false,"wgRelevantPageIsProbablyEditable":false,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgNoticeProject":"all",
>
> ...
> 
>
> So it seems that it can access the page, but is not parsing it correctly
> for some reason. Anyone know what the issue is?
>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: 2FA

2022-12-17 Thread Bináris
Great, thank you! :-)

 ezt írta (időpont: 2022. dec. 17., Szo, 15:02):

> Hi Bináris,
>
> Pywikibot master (8.0) does support 2FA. Just login with your sysop
> account. You will be asked for the password and after that for the 2FA
> token.
>
> ⚓ T186274 Enable 2FA normal login
> <https://phabricator.wikimedia.org/T186274>
> phabricator.wikimedia.org <https://phabricator.wikimedia.org/T186274>
> [image: favicon.png] <https://phabricator.wikimedia.org/T186274>
> <https://phabricator.wikimedia.org/T186274>
>
>
> https://doc.wikimedia.org/pywikibot/master/api_ref/login.html#login.ClientLoginManager
>
> Best
> xqt
>
>
> Am 17.12.2022 um 11:30 schrieb Bináris :
>
> 
> I wrote a script which requires admin rights. Someone told he couldn't use
> it because Pywikibot does not supoort 2FA login. Is that correct?
>
> --
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: 2FA

2022-12-17 Thread Bináris
Thank you!

Amir Sarabadani  ezt írta (időpont: 2022. dec. 17.,
Szo, 11:43):

> Yes but they could simply set a bot password instead and that's the
> correct way to do it anyway regardless of 2fa or not.
>
> Go to Special:BotPasswords
>
> Bináris  schrieb am Sa., 17. Dez. 2022, 11:31:
>
>> I wrote a script which requires admin rights. Someone told he couldn't
>> use it because Pywikibot does not supoort 2FA login. Is that correct?
>>
>> --
>> Bináris
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] 2FA

2022-12-17 Thread Bináris
I wrote a script which requires admin rights. Someone told he couldn't use
it because Pywikibot does not supoort 2FA login. Is that correct?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: pywikibot is making a mockery of my tests

2022-11-29 Thread Bináris
OK, thank you, that's a correct answer, and means that the question was
valid. :-)
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: pywikibot is making a mockery of my tests

2022-11-29 Thread Bináris
I did not tell anything like this. The question mark indacates that it was
a question. You personally were mislead by this capitalization, and I am
thankful that you discovered this for us, and others don't have to suffer.
I just want to understand things.


Russell Blau  ezt írta (időpont: 2022. nov. 29., K,
17:37):

> Oh yes. Please, please break every single script written by every user,
> just so we can have perfect capitalization style.
>
> --
> *From:* Bináris 
> *Sent:* Tuesday, November 29, 2022 11:32 AM
> *To:* Pywikibot discussion list 
> *Subject:* [pywikibot] Re: pywikibot is making a mockery of my tests
>
>
>
> Roy Smith  ezt írta (időpont: 2022. nov. 29., K, 17:26):
>
>> Ah, I've got this.  The problem is that pywikibot.Site isn't a class,
>> it's a factory function that returns cached instances of APISite.
>>
>
> Should it not have a lower case name in this case?
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: pywikibot is making a mockery of my tests

2022-11-29 Thread Bináris
Roy Smith  ezt írta (időpont: 2022. nov. 29., K, 17:26):

> Ah, I've got this.  The problem is that pywikibot.Site isn't a class, it's
> a factory function that returns cached instances of APISite.
>

Should it not have a lower case name in this case?
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Logins

2022-11-29 Thread Bináris
Thank you!
How does pwb work for you without .py?
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Logins

2022-11-28 Thread Bináris
I made a workaround so that I don't heve to log in all the time. :-)
swap.bat is:
ren other.lwp temp.lwp
ren pywikibot.lwp other.lwp
ren temp.lwp pywikibot.lwp
del temp.lwp

So I have to type swap and everything is fine. But I still don't know if I
have to use both accounts in one script. In compat there was a sysopname in
config, and it automatically switched to that if it was needed.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Logins

2022-11-28 Thread Bináris
I found BinBot only in pywikibot.lwp. Now I have logged in again as Bináris
with the above command. pywikibot.lwp (with ctrl f) contains Bináris, but
does not contain BinBot. For some reason only one user is in it at a time.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Logins

2022-11-28 Thread Bináris
Yes. BinBot is the bot account and Bináris is the admin account. The second
login throws out the previous one. Respectively:

c:\Pywikibot>python pwb.py -user:Bináris login -all
ERROR: wikipedia:* is not a valid site, please remove it from your
user-config
Password for user Bináris on wikipedia:hu (no characters will be shown):
Logging in to wikipedia:hu as Bináris
Logged in on wikipedia:hu as Bináris.

c:\Pywikibot>python pwb.py -user:BinBot login -all
ERROR: wikipedia:* is not a valid site, please remove it from your
user-config
Password for user BinBot on wikipedia:hu (no characters will be shown):
Logging in to wikipedia:hu as BinBot
Logged in on wikipedia:hu as BinBot.

c:\Pywikibot>python pwb.py -nolog -user:Bináris userpageprotect.py
pywikibot.exceptions.UserRightsError: User "None" does not have required
user right "protect"
CRITICAL: Exiting due to uncaught exception 
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Logins

2022-11-28 Thread Bináris
Where are the logins stored? In compat they had an obvious directory. Now I
searched it a lot, but did not find.

Whenever I run login.py, the previous account is thrown out, so I cannot
comfortably use two accounts. Is it on purpose?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Page protection for limited time

2022-11-27 Thread Bináris
Thank you!

Dalba  ezt írta (időpont: 2022. nov. 27., V, 14:49):

> Hi Bináris!
> Time can be passed through the `kwargs` as `expiry` keyword to
> APISite.protect
> <https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.site.html#pywikibot.site._apisite.APISite.protect>
> .
>
>> Expiry of protections can be set via kwargs, see Site.protect() for
>> details.
>>
>
> On Sun, Nov 27, 2022 at 3:55 PM Bináris  wrote:
>
>> Of course I meant protect, not block.
>>
>> Bináris  ezt írta (időpont: 2022. nov. 27., V,
>> 13:23):
>>
>>> Hi,
>>> in
>>> https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.page.html#page.BasePage.protect
>>> I don't see the time. Can we block for infinity only?
>>>
>>> --
>>> Bináris
>>>
>>
>>
>> --
>> Bináris
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Can't log in as admin

2022-11-27 Thread Bináris
Storno, I had to run login.py directly.

But I still have the question: if I edit pages with my regular bot account,
and one of them is protected, what will happen? Can I switch to my sysop
account?

Bináris  ezt írta (időpont: 2022. nov. 27., V, 13:42):

> python pwb.py -nolog -user:Bináris userpageprotect.py
> python pwb.py -nolog -user:"Bináris" userpageprotect.py
>
> Neither asks for my password when the script wants to protect a page. (The
> script is own development.)
> Instead I get:
>
> pywikibot.exceptions.UserRightsError: User "None" does not have required
> user right "protect"
> CRITICAL: Exiting due to uncaught exception  'pywikibot.exceptions.UserRightsError'>
> Do I do soemthing wrong?
>
> I liked the compat solution with my sysop user in user-config much better.
> :-(
> --
> Bináris
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Can't log in as admin

2022-11-27 Thread Bináris
python pwb.py -nolog -user:Bináris userpageprotect.py
python pwb.py -nolog -user:"Bináris" userpageprotect.py

Neither asks for my password when the script wants to protect a page. (The
script is own development.)
Instead I get:

pywikibot.exceptions.UserRightsError: User "None" does not have required
user right "protect"
CRITICAL: Exiting due to uncaught exception 
Do I do soemthing wrong?

I liked the compat solution with my sysop user in user-config much better.
:-(
-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Page protection for limited time

2022-11-27 Thread Bináris
Of course I meant protect, not block.

Bináris  ezt írta (időpont: 2022. nov. 27., V, 13:23):

> Hi,
> in
> https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.page.html#page.BasePage.protect
> I don't see the time. Can we block for infinity only?
>
> --
> Bináris
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Page protection for limited time

2022-11-27 Thread Bináris
Hi,
in
https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.page.html#page.BasePage.protect
I don't see the time. Can we block for infinity only?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Do I need pwb.py?

2022-11-18 Thread Bináris
 ezt írta (időpont: 2022. nov. 17., Cs, 20:56):

> Hi Binaris,
>
>
> Seems the config.log variable isn’t an empty list. Refer my other may to
> figure it out.
>
For some reason, I had
log = ['*']  # type: List[str]
in my user-config. I don't know why, at least I don't remember modifying it
at any time. So I have changed it to
log = []  # type: List[str]
and now the problem seems to have been disappeared. Thank you very much,
that was a great help!

>
> Have you ever cleared the api cache?
>
Do you mean c:\Pywikibot\apicache-py3\? No, but it takes only 450K.

 Did you ever run Pywikibot tests? tests have its own api cache.
No, I didn't.


>
> Maybe there are some you don’t need and space can be freed. For example
> wikitextparser is not necessary if you have mwparserfromhell installed.
>
Uninstalled wikitextparser. :-)
But I don't think any part of Pywikibot would be the secret agent which is
consuming my device. :-)
Thank you again!

-- 
Bináris


Pywikibot.ico
Description: Binary data
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Do I need pwb.py?

2022-11-17 Thread Bináris
To the prevoius:
The snake bites its own tail, we say here.
There are a lot of logging errors because the script could not log the
previous error. But it should not have logged anything, only perform a
task, and write on screen and modify a page on wiki. In MY script nothing
uses the device.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Do I need pwb.py?

2022-11-17 Thread Bináris
 ezt írta (időpont: 2022. nov. 17., Cs, 8:19):

> There is no disadvantage known when using it.
>

Thank you!
But, there is.
I have a special case, because I suffer with a low space storage device. I
know, this is my fault, but anyway, it IS a problem (although I regularly
free up space, something eats it very quickly, and I cannot guess what it
is). I also kwo that Black Friday is coming... But the problem is currently
existing.

So I realized that pwb.py wants to log soemthing even if I use -nolog. It
also wants to cache something or read some cache, not that I wuld have said
to it to do so. And if pwb. py is unhappy with this, it
* writes many kilometers of error messages, that I cannot read, becuase 90%
ran out of screen (I don't think any developer wants to read this in the
life)
* generates additional errors during writing the previous errors, so the
message gets pretty long
* the witing itself last half a minute or a minute (yes, so long!), and
takes my time unless I use ctrl C.
* I cannot find he useful writing on screen, if it exists at all
* the task is often not completed or partially completed, even if it has
nothing to do with the storage device.

I think it does not take seriously the -nolog.

Example 1:
I wrote a script which generates lists in memory, compares with the
existing lists on Wikipedia and uploads if there is a difference.
This script ran 10 minutes before it found the first list to upload. It
wrote all the titles on screen, so I know, it has just created the
appropriate list.
But INSTEAD of saving it to wiki, it began to write this long looped error
message, and did not execute the put command, rather it terminated.
After I freed up soma space, it ran properly.

Example 2:
I run  python pwb.py -version -nolog because I know you would ask for it.
For the first time it generated a mile long error message again, and did
not writ the config which it should have done. Then I freed up some space,
and itt worked. So -nolog is useless if I want to avoid troubles. Here goes
the VERY tail of the first run, and the result of the second run below.

--- Logging error ---
Traceback (most recent call last):
  File "C:\Python37\lib\logging\handlers.py", line 69, in emit
if self.shouldRollover(record):
  File "C:\Python37\lib\logging\handlers.py", line 186, in shouldRollover
self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
OSError: [Errno 28] No space left on device
Call stack:
  File "pwb.py", line 524, in 
main()
  File "pwb.py", line 508, in main
if not execute():
  File "pwb.py", line 489, in execute
run_python_file(filename, script_args, module)
  File "pwb.py", line 152, in run_python_file
main_mod.__dict__)
  File "pywikibot\scripts\version.py", line 106, in 
main()
  File "pywikibot\scripts\version.py", line 102, in main
pywikibot.output('\t{}: {}'.format(lang, username))
  File "c:\Pywikibot\pywikibot\tools\_deprecate.py", line 399, in wrapper
return obj(*__args, **__kw)
  File "c:\Pywikibot\pywikibot\logging.py", line 170, in info
logoutput(msg, *args, **kwargs)
  File "c:\Pywikibot\pywikibot\tools\_deprecate.py", line 399, in wrapper
return obj(*__args, **__kw)
  File "c:\Pywikibot\pywikibot\logging.py", line 152, in logoutput
logger.log(level, msg, extra=context, **kwargs)
Message: '\t*: BinBot'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "C:\Python37\lib\logging\handlers.py", line 69, in emit
if self.shouldRollover(record):
  File "C:\Python37\lib\logging\handlers.py", line 186, in shouldRollover
self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
OSError: [Errno 28] No space left on device
Call stack:
  File "c:\Pywikibot\pywikibot\comms\http.py", line 81, in flush
log('Closing network session.')
  File "c:\Pywikibot\pywikibot\tools\_deprecate.py", line 399, in wrapper
return obj(*__args, **__kw)
  File "c:\Pywikibot\pywikibot\logging.py", line 255, in log
logoutput(msg, *args, level=VERBOSE, **kwargs)
  File "c:\Pywikibot\pywikibot\tools\_deprecate.py", line 399, in wrapper
return obj(*__args, **__kw)
  File "c:\Pywikibot\pywikibot\logging.py", line 152, in logoutput
logger.log(level, msg, extra=context, **kwargs)
Message: 'Closing network session.'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "C:\Python37\lib\logging\handlers.py", line 69, in emit
if self.shouldRollover(record):
  File "C:\Python37\lib\logging\handlers.py", line 186, in shouldRollover
self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
OSError: [Errno 28] No space left on device
Call stack:
  File "c:\Pywikibot\pywikibot\comms\http.py", line 87, in flush
log('Network session closed.')
  File "c:\Pywikibot\pywikibot\tools\_deprecate.py", line 399, in wrapper
return obj(*__args, **__kw)
  File "c:\Pywikibot\pywikibot\logging.py", line 255, in log
logoutput(msg, *args, level=VERBOSE, **kwargs)
  File 

[pywikibot] Do I need pwb.py?

2022-11-16 Thread Bináris
Hi,
I write scripts, mostly for temporary tasks. I understand, that pwb.py
handles arguments and logs and finds my script in /scripts/userscripts.
Most of these scripts don't excpect arguments, the task is wired in. So is
there any advantage of using pwb.py in this case?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: How to analyze block logs?

2022-11-02 Thread Bináris
Roy Smith  ezt írta (időpont: 2022. nov. 2., Sze, 18:19):

> There's a bunch of block reason templates such as {{blocked proxy}},
> {{webhostblock}}, etc.  They don't always get used, but they're good things
> to look for before you fall back to just comment_text like '%proxy%'
>
This works for huwiki, and we have only one.

>
> I don't think you need to check for ipb_expiry != 'infinity'.  People who
> know SQL better than I do would know for sure, but I think the previous
> clause (ipb_expiry < now() + interval 1 month) would always be false in
> that case.
>
Unfortunately not, I tried without that, and a lot of infinities appeared.
So this was a workaround. I think MySQL is very loose with types, and in
your original version expiry date was a string constant. Numbers are before
letters. I modified it to show always one month, thus my comparison uses a
date type, while 'infinity' is still a string, and seems to precede dates.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: How to analyze block logs?

2022-11-02 Thread Bináris
Roy, thank you! This is great!
My version is https://quarry.wmcloud.org/query/68559
Next step is to try to use it with Pywikibot as Xqt said.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] How to analyze block logs?

2022-11-01 Thread Bináris
Hi,

I want to write a script that monitors block logs or the list of active
blocks for a certain reason (open proxy), and warns me if a block expires
soon.
Warning may be written either to a noticeboard or a mailing list, the main
thing is to find them.
Rationale: we give 1 year block for proxies, but after expiration they are
likely to be still open, and need revision.

Do we have a clever tool for this? How would you begin the task?

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: FlaggedPagesGenerator

2022-10-17 Thread Bináris
Thank you!
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] FlaggedPagesGenerator

2022-10-17 Thread Bináris
Hi,

I am new to core.
Is there currently any possibility to work only on flagged pages?
https://en.wikipedia.org/wiki/Wikipedia:Flagged_revisions /
https://de.wikipedia.org/wiki/Hilfe:Gesichtete_Versionen

It would be useful to work only on currently flagged or currently unflagged
versions. For the flagged versions, a command line switch is useful for not
programmers.

Rationale:
When unflagged versions are edited by bots, the diff to check can be messy,
and users are angry with bot owners.
Alhough some changes (i.e. spelling corrections) are necessary, fore
example cosmetic changes could be prohibited by communities on unflagged
pages.

-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: New Pywikibot 7.7 release

2022-10-12 Thread Bináris
On the page https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation
may the warning " The last version of the zip-file is currently (14 July
2022) broken, it contains __metadata__.py instead of version string." be
removed?
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Pywikibot/pagefromfile.py only import 19 pages

2021-06-08 Thread Bináris
This is obviously a server error. Try later.

Phil  ezt írta (időpont: 2021. jún. 8., K, 12:52):

> I'm trying to import 1500 pages and the script keeps running and I see
>
> WARNING: Non-JSON response received from server kaisb:en for url
> https://kaisandbox.jnj.com/api.php
> The server may be down.
> Status code: 200
>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>


-- 
Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Replace multiple template names per page

2021-06-07 Thread Bináris
MarcoAurelio  ezt írta (időpont: 2021. jún. 7., H,
16:18):

> (e.g. just replace the template name leaving brakets
> and parameters untouched i.e. {{template|1=parameter}}).
>

This is the easiest case if only the template names change and there are no
nested templates. That's what replace.py is for.

A fix r'\{\{oldtemplate(\|.*?)\}\}', r'{{newtemplate\1}}' should do the
work.
A less elegant trick, if your problem is, that template.py should be run
several times: put the commands in a batch file / bash script.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


  1   2   >