How to click custom html option button via api?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to click custom html option button via api?

Shrinivasan T
I am trying to work on https://ta.wikisource.org with python API.

This tamil wikisource has custom html option buttons to mention the edit status.

See a screenshot here.
https://snag.gy/f3aTBn.jpg

How to enable these custom option buttons via API?

Thanks.

--
Regards,
T.Shrinivasan


My Life with GNU/Linux : http://goinggnu.wordpress.com
Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com

Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
http://FreeTamilEbooks.com

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: How to click custom html option button via api?

Shrinivasan T
The html source of the buttons are as below.

 <span id="wpQuality-container"><span class="quality0"><input
tabindex="5" title="Without text" type="radio" value="0"
name="wpQuality"></span><span class="quality2"><input tabindex="6"
title="Problematic" type="radio" value="2"
name="wpQuality"></span><span class="quality1"><input tabindex="7"
title="Not proofread" checked="" type="radio" value="1"
name="wpQuality"></span><span class="quality3"><input tabindex="8"
title="Proofread" type="radio" value="3"
name="wpQuality"></span></span>

Found that they are provided by proofread extension.

The color scheme is as
https://www.mediawiki.org/wiki/Help:Extension:ProofreadPage/Page_quality_system

There is no api available for now.

It has been reported here https://phabricator.wikimedia.org/T133781
for providing api.

Thanks to Reedy and Krenair in #mediawiki channel for providing info
and reporting the issue.

2016-04-27 15:20 GMT+01:00 Shrinivasan T <[hidden email]>:

> I am trying to work on https://ta.wikisource.org with python API.
>
> This tamil wikisource has custom html option buttons to mention the edit status.
>
> See a screenshot here.
> https://snag.gy/f3aTBn.jpg
>
> How to enable these custom option buttons via API?
>
> Thanks.
>
> --
> Regards,
> T.Shrinivasan
>
>
> My Life with GNU/Linux : http://goinggnu.wordpress.com
> Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com
>
> Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
> http://FreeTamilEbooks.com



--
Regards,
T.Shrinivasan


My Life with GNU/Linux : http://goinggnu.wordpress.com
Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com

Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
http://FreeTamilEbooks.com

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: How to click custom html option button via api?

Thomas PT
> There is no api available for now.
No, you could fairly easily do it using the regular edit API.

For example, if I want to edit the proofreading level of https://en.wikisource.org/wiki/Page:Popular_Science_Monthly_Volume_54.djvu/434 on en.wikisource, the easiest way to archive that is to call action=query&prop=revision to get the Page: page content in JSON: https://en.wikisource.org/w/api.php?action=query&prop=revisions&titles=Page%3APopular_Science_Monthly_Volume_54.djvu%2F434&rvprop=content&rvcontentformat=application%2Fjson

Then you could modify the level.level field of the JSON document representing the Page: pages content and set level.user to your user name and publish the modified content using action=edit (you should not forget to set contentformat=application/json because JSON is not the default content format for Page: pages).

Thomas

> Le 27 avr. 2016 à 16:52, Shrinivasan T <[hidden email]> a écrit :
>
> The html source of the buttons are as below.
>
> <span id="wpQuality-container"><span class="quality0"><input
> tabindex="5" title="Without text" type="radio" value="0"
> name="wpQuality"></span><span class="quality2"><input tabindex="6"
> title="Problematic" type="radio" value="2"
> name="wpQuality"></span><span class="quality1"><input tabindex="7"
> title="Not proofread" checked="" type="radio" value="1"
> name="wpQuality"></span><span class="quality3"><input tabindex="8"
> title="Proofread" type="radio" value="3"
> name="wpQuality"></span></span>
>
> Found that they are provided by proofread extension.
>
> The color scheme is as
> https://www.mediawiki.org/wiki/Help:Extension:ProofreadPage/Page_quality_system
>
> There is no api available for now.
>
> It has been reported here https://phabricator.wikimedia.org/T133781
> for providing api.
>
> Thanks to Reedy and Krenair in #mediawiki channel for providing info
> and reporting the issue.
>
> 2016-04-27 15:20 GMT+01:00 Shrinivasan T <[hidden email]>:
>> I am trying to work on https://ta.wikisource.org with python API.
>>
>> This tamil wikisource has custom html option buttons to mention the edit status.
>>
>> See a screenshot here.
>> https://snag.gy/f3aTBn.jpg
>>
>> How to enable these custom option buttons via API?
>>
>> Thanks.
>>
>> --
>> Regards,
>> T.Shrinivasan
>>
>>
>> My Life with GNU/Linux : http://goinggnu.wordpress.com
>> Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com
>>
>> Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
>> http://FreeTamilEbooks.com
>
>
>
> --
> Regards,
> T.Shrinivasan
>
>
> My Life with GNU/Linux : http://goinggnu.wordpress.com
> Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com
>
> Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
> http://FreeTamilEbooks.com
>
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Wikimediaindia-l] How to click custom html option button via api?

John Mark Vandenberg
In reply to this post by Shrinivasan T
Pywikibot has a class ProofreadPage which allows modification of level via
simple attributes and methods.

https://github.com/wikimedia/pywikibot-core/blob/master/pywikibot/proofreadpage.py#L67

If you dont want to use Pywikibot, its code can be helpful and it can be
copied using very unrestrictive MIT license (and the authors would likely
be happy to relicense it to another license if that was useful.

Regards,
John Vandenberg
On 27 Apr 2016 21:21, "Shrinivasan T" <[hidden email]> wrote:

> I am trying to work on https://ta.wikisource.org with python API.
>
> This tamil wikisource has custom html option buttons to mention the edit
> status.
>
> See a screenshot here.
> https://snag.gy/f3aTBn.jpg
>
> How to enable these custom option buttons via API?
>
> Thanks.
>
> --
> Regards,
> T.Shrinivasan
>
>
> My Life with GNU/Linux : http://goinggnu.wordpress.com
> Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com
>
> Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
> http://FreeTamilEbooks.com
>
> _______________________________________________
> Wikimediaindia-l mailing list
> [hidden email]
> To unsubscribe from the list / change mailing preferences visit
> https://lists.wikimedia.org/mailman/listinfo/wikimediaindia-l
>
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: [Wikimediaindia-l] How to click custom html option button via api?

Shrinivasan T
2016-04-27 19:30 GMT+01:00 John Mark Vandenberg <[hidden email]>:

> Pywikibot has a class ProofreadPage which allows modification of level via
> simple attributes and methods.
>
> https://github.com/wikimedia/pywikibot-core/blob/master/pywikibot/proofreadpage.py#L67
>
> If you dont want to use Pywikibot, its code can be helpful and it can be
> copied using very unrestrictive MIT license (and the authors would likely be
> happy to relicense it to another license if that was useful.
>
> Regards,
> John Vandenberg
>

Thanks for pointing pywikibot.
Never used it before.

Now learnt it and used the following snippet, to change the page quality level.


import pywikibot
from pywikibot import proofreadpage

site = pywikibot.Site('ta','wikisource')
page = pywikibot.Page(site, u"Page:"<pagename>)
text = page.text

pa = proofreadpage.ProofreadPage(page)


pa.text = pa.text.replace('level="1"','level="3"')

pa.save(summary="demo")


Thanks again.




--
Regards,
T.Shrinivasan


My Life with GNU/Linux : http://goinggnu.wordpress.com
Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com

Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
http://FreeTamilEbooks.com

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: [Wikimediaindia-l] How to click custom html option button via api?

Shrinivasan T
import pywikibot
from pywikibot import proofreadpage

site = pywikibot.Site('ta','wikisource')
page = pywikibot.Page(site, u"Page:"<pagename>)
text = page.text

pa = proofreadpage.ProofreadPage(page)


pa.text = pa.text.replace('level="1"','level="3"')

pa.save(summary="demo")


===========

When I ran the above code now,

It gives the following error.

Run the following code.

it shows the following error.

ERROR: editpage: unknown failure reason {u'edit': {u'result': u'Failure',
u'notallowed': u'\u0b87\u0ba8\u0bcd\u0ba4
\u0baa\u0b95\u0bcd\u0b95\u0ba4\u0bcd\u0ba4\u0bbf\u0ba9\u0bcd
\u0bae\u0bc6\u0baf\u0bcd\u0baa\u0bcd\u0baa\u0bc1
\u0baa\u0bbe\u0bb0\u0bcd\u0b95\u0bcd\u0b95\u0bc1\u0bae\u0bcd
\u0ba8\u0bbf\u0bb2\u0bc8\u0baf\u0bc8 \u0bae\u0bbe\u0bb1\u0bcd\u0bb1
\u0ba4\u0b99\u0bcd\u0b95\u0bb3\u0bc1\u0b95\u0bcd\u0b95\u0bc1
\u0b89\u0bb0\u0bbf\u0bae\u0bc8 \u0b87\u0bb2\u0bcd\u0bb2\u0bc8'}}
WARNING: Page [[Page:x?r?nxc? mlrx.pdf/100]] not saved


on running on jupyter,

ERROR: editpage: unknown failure reason {'edit': {'result': 'Failure',
'notallowed': 'you
dont have permissions to change the proof read status of this
page'}}


The above error happens for my account and my friend account with sysop
permission.

But we can manually change the proof read page quality status.

What may be the reason?

Help to solve this.

Thanks.


--
Regards,
T.Shrinivasan


My Life with GNU/Linux : http://goinggnu.wordpress.com
Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com

Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
http://FreeTamilEbooks.com
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l