[09:05:26] Sorry for so many questions from me 👀😁 [09:05:27] How can I redirect user requests from my bot in fawiki to the django? [09:05:28] My bot is on toolforge [09:15:20] what django? [09:20:53] I have installed django on venv on the bot account. it is the 2.2.26 version! (re @wmtelegram_bot: what django?) [09:21:28] perhaps use 'pywiki' to read data from wiki into your django app? [09:22:31] Deep_Crawler what is what you are trying to provide? a web service? [09:22:49] I want a method to get wikipedian users ... I have used pywikibot before, but apparently it has no mechanism for such a purpose, so I started using django (re @wmtelegram_bot: perhaps use 'pywiki' to read data from wiki into your django app?) [09:25:53] Yes, I want to use my bot in some js tools which users install (on client side) and for example they request to wikify that wiki article, then my bot receives that request and starts the job. Or the user requests to update categories of a page and pushes a button and that button sends the request to my bot and my bot process it, as the php libraries for wiki are a little weak, I like to use python (re @wmtelegram_bot: I have successfully used wikitextparser and pywikibot recently. Bot now I want to process user requests [09:32:38] I want to use python3, apparently php container cannot run venv of python3 (I tried to exec the venv from php but didn't work), so people suggested me to use python purely and not using php [09:51:55] Deep_Crawler: yep, you'll need a python type webservice for that, so, trying to understand correctly, your issue is trying to get a list of wiki users from python? Or setting up a web endpoint to call your webservice? (or both?) [11:11:45] I want to implement something like this: [11:11:45] https://fa.wikipedia.org/wiki/ویکی%E2%80%8Cپدیا:درخواست_انتقال_رده [11:11:46] and something like this: [11:11:48] https://fa.wikipedia.org/wiki/کاربر:Mojtabakd/scripts/Gadget-dropdown-menus.js (re @wmtelegram_bot: Deep_Crawler: yep, you'll need a python type webservice for that, so, trying to understand correctly, your issue is tryi...) [11:13:13] normal wikipedia users in wikifa will use these tools to use my bot indirectly. [11:13:13] I think in your language I want to set up an endpoint for user in wiki to call my bot from there (re @wmtelegram_bot: Deep_Crawler: yep, you'll need a python type webservice for that, so, trying to understand correctly, your issue is tryi...) [11:24:23] It would be easy for me if I limited myself to python 2, because that way I can use php and from php I can run python files with exec function. But I liked to use python3! [11:24:24] So maybe after all I use python2 temporarily. [11:24:25] But I hoped could find the solution to use python completely. Because this seems a more natural and better way [11:36:04] Deep_Crawler, ok, it seems that you want to confifure your bot to redirect to the toolforge tool (the webservice), the example that you showed (dexbot) uses a link with href="https://dexbot.toolforge.org/d.php" (that is the button-like element at the bottom), instead of that you can link to your tools page (https://.toolforg.org/some/path) [11:37:37] Yes, there is no problem in the client side for me. I don't know how to redirect that request on the bot without php! (re @wmtelegram_bot: Deep_Crawler, ok, it seems that you want to confifure your bot to redirect to the toolforge tool (the webservice), the e...) [11:37:40] Then you need to have in toolforge a python3.* webservice running (python3.9 for example) that handles that call/redirection [11:38:28] If the bot is integrated in the wikimedia UI, that will have to be php or js [11:38:58] (like dexbot page https://fa.wikipedia.org/wiki/%D9%88%DB%8C%DA%A9%DB%8C%E2%80%8C%D9%BE%D8%AF%DB%8C%D8%A7:%D8%AF%D8%B1%D8%AE%D9%88%D8%A7%D8%B3%D8%AA_%D8%A7%D9%86%D8%AA%D9%82%D8%A7%D9%84_%D8%B1%D8%AF%D9%87) [11:39:39] So I'm forced to use php on the bot? Because I couldn't use django to capture the requests (re @wmtelegram_bot: If the bot is integrated in the wikimedia UI, that will have to be php or js) [11:41:14] Deep_Crawler: for the client side yes, that first step has to be php or js I think (I'm not very well versed on wikimedia development), unless you want your user to go directly to the toolforge page instead of seeing things in-wiki (ex. going directly to https://.toolforge.org) [11:41:32] I might be missing something though, do you have anything already setup that I can see? [11:42:22] sorry but the php is server side 😁. (re @wmtelegram_bot: Deep_Crawler: for the client side yes, that first step has to be php or js I think (I'm not very well versed on wikimedi...) [11:42:28] (another example of toolforge redirection from a wikimedia js is https://fa.wikipedia.org/wiki/%DA%A9%D8%A7%D8%B1%D8%A8%D8%B1:Mojtabakd/scripts/Gadget-dropdown-menus.js#L-553) [11:44:30] Deep_Crawler: If you already have that js/php part in wikimedia doing the redirect, then all you need is a webservice in toolforge that answers on the url you redirect to (ex. http://.toolforge.org/dosomething), that can be done 100% in python yep [11:44:52] python3 scripts/updater/manage.py runserver 8001 [11:45:48] I'm trying to run this script on my bot. But this just create a web service with django which listens to localhost, I cannot force it to listen to my public domain of the bot (re @Deep_Crawler: python3 scripts/updater/manage.py runserver 8001) [11:47:42] Deep_Crawler: did you follow https://wikitech.wikimedia.org/wiki/Help:Toolforge/Web/Python#Deploying_a_Django_application ?, to run the webservice you'll have to do something like 'webservice --backend=kubernetes python3.9 start', that will start a kubernetes pod and put it under the domain [11:48:17] (btw. I'm guessing that you are running under a tool in toolforge, is that correct? ex. login.toolforg.org, become ) [11:48:48] Yes, this is my tool: [11:48:49] crawlerbot.toolforge.org (re @wmtelegram_bot: (btw. I'm guessing that you are running under a tool in toolforge, is that correct? ex. login.toolforg.org, become Thanx, I will try it. The documentation in this regard are too tiny and short... (re @wmtelegram_bot: Deep_Crawler: did you follow https://wikitech.wikimedia.org/wiki/Help:Toolforge/Web/Python#Deploying_a_Django_applicatio...) [11:49:54] are you trying to run both a php and a python webservices? [11:50:03] (at the same time, in the same tool account) [11:51:00] I tried it before, the will work if I try to run python2 commands from php. But will not work when using python3. Though I have not tested python2 in that situation (re @wmtelegram_bot: are you trying to run both a php and a python webservices?) [11:51:10] They will work* (re @Deep_Crawler: I tried it before, the will work if I try to run python2 commands from php. But will not work when using python3. Though I have ...) [11:51:59] It becomes trickier using different runtimes at the same time on the same tool account, I would recommend creating another tool account for that instead [11:52:16] taavi sent me this message in this group before: [11:52:16] No, running python using the php container is not supported. Use the python3 web service type instead (https://wikitech.wikimedia.org/wiki/Help:Toolforge/Web/Python) [11:53:03] Lucas sent me this message: [11:53:04] IIRC the PHP container doesn’t have a python3 command (though it does have python2) [11:53:16] yep, I think he meant in a different tool account, or replacing the php webservice (so you only run php, or python3) [11:53:25] So yes, I can use php+pytho2 on my bot [11:54:21] please do not use php+python2, python2 is end-of-life software [11:54:37] what I meant is that you’d probably want to use either php or python3.*, yes [11:54:50] 🙏 (re @lucaswerkmeister: what I meant is that you’d probably want to use either php or python3.*, yes) [11:56:14] So I think trying to run webservice like this is my best chance: [11:56:15] webservice --backend=kubernetes python3.9 start [11:57:39] yep, but you'll have to either replace the php webservice (if that's what's running there), or create a new tool account (ex. crawlbot-api.toolforge.org) and start the python webservice there [11:59:29] Thanks, I will work on it and come back with lots of new questions (I hope that no new questions occurs!) 😄🌸🙏 (re @wmtelegram_bot: yep, but you'll have to either replace the php webservice (if that's what's running there), or create a new tool account...) [12:03:55] Deep_Crawler: don't hesitate! [12:04:11] ✌️ (re @wmtelegram_bot: Deep_Crawler: don't hesitate!) [13:56:24] !log wikidata-query Replace too big flavor t206636 for a one with a smaller disk, t206636v2 (T297454) [13:56:26] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Wikidata-query/SAL [13:56:27] T297454: WCQS gives "502 Bad Gateway Error" - https://phabricator.wikimedia.org/T297454 [18:59:52] !log tools.lexeme-forms deployed d1da801731 (l10n updates) [18:59:55] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools.lexeme-forms/SAL