A wikibot for a MoinMoin-based wiki? - python

I think about writing a Python bot for a MoinMoin-based wiki, so if anyone is aware about some code sources I can use or re-use, please share a link.
If it were a MediaWiki-based robot, there is a Wikipedia page to take as a start.
The target wiki engine is MoinMoin 1.9.2 .
So far I have found a project based on xml-rpc approach and the editmoin utility.
I'd rather prefer the xml-rpc route, but my first understanding was that it may need applying a patch to the server, what is not an option.
So the second link at the moment looks more promising as a start.
Any hints and suggestions are welcome.
Edit : Should also take a look at wiki-xmlrpc-extensions (an example) .

Related

How to quickly familiarize yourself with the usage of a python third party Library

When learning python, I have a puzzle. Python has rich third-party libraries, but it makes me a novice difficult to use them. For example, when using Matplotlib, I just know what it can do, but specifically, for example, I want to draw a complex diagram, but I can't start with it, because there are many functions, but I don't know where they are, The introduction of the official manual sometimes feels a little abstract. If you go to Google and search a specific function, you may not get the desired result. So how do you quickly start a third-party library
One of the ways to get familiarised quickly with any 3rd party lib (python lib) is to go through getting started / Quickstart section of the documentation (for any library)
If that doesn't help then these two below sites have always helped me get a quick intro and basic hands-on for most of python libs
Real Python (https://realpython.com)
Tutorialspoint (https://www.tutorialspoint.com/index.htm)
Full-stack Python (https://www.fullstackpython.com) is another site I refer to when I have to find a new python library.
These sites pretty much cover almost all the well known python libraries.
And most of the famous libraries documentation sites provide a link to some sort of community on discord / Gitter / some site which would help further.
Example: Numpy
Learn section with Quickstart and other example based tuts
community section with links to several groups

Implementing ACL with flask

I just built a little web application with flask and I want to manage users roles and accessibility to the endpoint according to their role etc and for that, I want to use something like acl (Access Control List) but I can't find anything useful or clear enough to understand.
I found flask-acl but the documentation is so poor, I found flask-simpleacl but I can't put my hands on any useful documentation.
I can't even find tutorials or examples about so can someone suggest a good useful flask extension or library for that or just point me to some documentation, examples or tutorials?
Thanks.
I ended up trying to use flask_principal as someone suggested to me here (but for some reason, they deleted their answer), it's great and helpful especially if you combine it with flask_login. So I hope this helps someone.
The only issue is if you want for example show/hide some content on your HTML pages based on the user's role, then you have to set it manually with session variables which is mostly going back to the start point (unless I'm missing something).
Good luck.

python lib for facebook instagram

I'm using a raspberry b+ to create some files that i would like to post on FB and Instagram (my account or any account).
I have a good industrial computer bckground but not for the "cloud" stuff.
I seen the libs for python to connect to facebook and to instagram.
(facebook-sdk, python-instagram).
I understand the code of the examples etc...
I'm just missing the context of where should I put this code to be able to interact with these "social media" sites.
Could it work just with a UPLOADER.py ?
Or do I need to set up like a webserver ? Do i need the Json.simple/google and so on ?
I understand if it's a dumb question, but I'm a bit lost...
Few "architectural" directions will do :). I'll get to understand the technical parts bymyself...
Thanks in advance!
Cheers,
Mat
You can set them up on "any" OS. Just make sure you have an internet connection. Also note, that those libraries wan't do anything unless you write the code. So you need to create a lightweight wrapper, that would pass credentials and triggers necessary functions, in a certain order. And that's pretty much it.
Could it work just with a UPLOADER.py ?
Not sure what you referring to.
Or do I need to set up like a webserver ?
No. You dont. It's not a requirements for the library.
Do i need the Json.simple/google
Take a look at the file called requirements.txt it provides a set of libraries you need to have in addition to the standart/builtin libs.

zeromq request/response example showing use of a queue in Python?

Can anyone please post a Python example that demonstrates the use of a request/response messaging model that utilizes the zeromq queue?.
I have done a lot of online searching but have not as yet been able to locate such an example. The article here does a great job of explaining the concept of the queue, but unfortunately, does not provide an example.
You will find several examples here http://zguide.zeromq.org/page:all#Chapter-Four-Reliable-Request-Reply
Most of the patterns have a source code example of a client app and a server app in several languages. Even when there is a Python source code example, I find it useful to look at the C source code version to fully understand how it works.
I have made use of the Lazy Pirate pattern http://zguide.zeromq.org/py:lpclient and from memory, I had to change something about the way it loops and retries in order to get it to work reliably for me. It wasn't hard to figure out; I just added a few more print statements to see what was going on.

Are there any examples on python-purple floating around?

I want to learn it but I have no idea where to start. Everything out there suggests reading the libpurple source but I don't think I understand enough c to really get a grasp of it.
There isn't much about it yet... the intro, the howto, and the sources (here browsing them online but of course you can git clone them) are about it. In particular, the tiny example client you can get from here does have some miniscule example of use of purple's facilities (definitely not enough, but maybe it can get you started with the help of some 'dir', 'help' and the like...?)
Not sure how much help this will be but based on information from here, it seems like you just install python-purple and import and call the functions as normal Python functions.
Can't help you with a concrete example as I decided to use something else. However, one of the first things I wanted to do after I cloned the repo was remove the ecore dependency. Here's a patch submitted to the mailing list to do just that: https://garage.maemo.org/pipermail/python-purple-devel/2009-March/000000.html
Incidentally, if you're looking for AIM take a look at twisted.words. For Yahoo, trying getting the source for curphoo or zinc (both are console YMSG clients). For GTalk/Jabber, I've had good experiences with xmpppy.

Categories