Has anyone done a python tornado compatible firebase implementation? - python

I did a search but did not come up with any hits for a tornado.websocket implementation of the firebase sdk. Abe Haskin's python-firebasin runs inside a thread. I know its possible to port thinking about it not sure it is trivial, particularly if you try to make the rootdataref dynamic. Was wondering if anyone had been down this path?

Related

Are there any alternatves to using Pyro Event Server (subscribe) - by using Pyro4 or other packages?

I'm updating a code (originally written in python 2.7) to be compatible with both python 2.7 and python 3. The code used the package Pyro(3) which doesn't seem to be compatible with python 3, so I've tried to use Pyro4 instead. Although using Pyro4 has helped solve some of the problems I was having it doesn't seem have the Event Server (subscribe) feature that was in Pyro (unless I'm missing something obvious??).
Has it been renamed to something else in Pyro4, or is there another way that I can use subscriber in Pyro4? If not is there another package that anyone can recommend that can be used instead?
Thanks for your help!!
You're right, Pyro4 doesn't provide an event service as standard part of the library.
Now, the event service in Pyro3 was very basic. It should be easy to rebuilt it yourself on Pyro4, it should be a few dozen lines of code at most. But I suggest to also have a look at the 'messagebus' example that comes with Pyro4 already.
That's all I can say really, because you didn't tell us any specific details about what the requiremens on your communication layer in your application are (other than that it used to use Pyro3)

Using same rendering code for client side and server side

Does Brython has a recommended method for using the same rendering code in the server side?
To do this currently I'm using my own browser module emulating Brython's on the server side for html rendering (https://github.com/yairchu/vote_tool/blob/master/browser.py), but I wonder if there's a better way..
The portion of code you are using is short, elegant, and quite specific -
it will be Python compatible on the server side, as you have noted, and you it won't be easy to find another piece of code for this kind of rendering that is so concise and able
to work on Brython's client side (as it does not yet achieve 100% compatibility with Python).
That said, I think it is more than ok to reuse this code on the server side on your project.
Note that by carefully laying out files in your project directories, it is possible
to have some files to be imported both on server and client side. If done correctly,
this can make a great deal of work simpler.

Python in Grails

I have come up to a brick wall.
I want to have a Python engine in my Grails application so that I can pass it some params and a script and get a result.
I have been looking around and only found one thing, which doesn't seem right by using Jython.
Has anyone done this or had any experience with doing a similar thing who can point me in the right direction.
What about create a rest service for your python script?
Like http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask

Rookie Python-questions

Is it possible to make python run on your homepage? I know, this is a really stupid question but please don't pick on me for my stupidity :)
If it is possible, how? Do you have to upload/install the executing part of Python to you website using FTP? or...?
Edit: Just found out my provider does not support python and that shell access is completely restricted. Problem solved :)
Everything depends on the hosting provider you use for your homepage -- do they offer Python among their services, and, if so, what version, and how do you write server-side scripts to use it (is it CGI-only, or...?) -- if not, or the version / deployment options disappoint, what do they allow in terms of giving you shell access and running long-time processes?
It's impossible for us to judge any of these aspects, because every single one of them depends on your hosting provider, and absolutely none of them depends on Python itself!-)
Yes, you can. I don't know exactly how but I know it is possible. Mabye look into this website:
https://trinket.io/
This website lets you do this. I sent them a message to see how they do it so I will update this to let you know after they respond.
Python is a scripting language, though it is used gracefully for building back end web applications.

Python IRC client: write from scratch or write plugin for existing framework?

For our company I'd like to have a Python based IRC bot which checks whether the websites of our clients are still up and running. More specific: I want to list a number of URL which should be visited every, say, 15 minutes. If it fails, the URL should be checked again after 5 minutes. If retrieving the URL still doesn't result in an HTTP status code 200, it should echo the failing URL in the channel so we can investigate it.
I've written a plugin for Supybot some time ago that basically does some of the above in a crude but effective way. If I want to expand the functionality of the current code to the above 'specs' I need to do some major refactoring; basically it would mean starting from scratch.
Which raises the question: should I write a better plugin for Supybot, matching the new requirements, or go for something else altogether? Should I start from scratch (learning the most, implementing the relevant RFCs myself, spending more time than planned) or is there a suitable framework which handles the basic IRC stuff?
I vote for a completely new plugin for Supybot. Learn more ;)
If you won't do so much, try python irclib. It's a (still maintained) python lib for IRC.
Twisted may also be ok, but it's a little but too much...
To me it sounds like a case of your application wanting to talk IRC, and my gut reaction would be to use Twisted, which has IRC clients. This may or may not be the right solution for you, but at least it's worth investigating.
I finally decided to create use Twisted for my bot. As to the why:
Supybot already has a lot of functionality. And that can be a good thing: just create a simple plugin, hook it up and start using the bot. The downside is that you may not like some of the functionality already provided for. As an example: I didn't like the fact that it responded to everything (Error: "foo" is not a valid command.). I'm sure it can be turned off somehow somewhere, but these kind of small things bothered me.
The Python IRC client library on the other hand felt a little too bare bones. Especially since I needed threading to have the bot check a whether a number of websites are still alive while remaining responsive in the channel.
If the irclib felt like too low level, writing a bot from scratch would certainly be. While I definitely wanted to learn something, I also wanted to focus on the actual functionality of the bot, without being bothered too much by the 'basic' stuff (e.g. I don't necessarily want to write the code to identify the bot, I like to just have some configuration setting to store the nickname and password and handle this for me.)
Twisted has a nice example of a logging bot which can be used as a starting point. Furthermore: in the future it should not be too hard to write a small webserver (using Twisted obviously) to display the output of the bot.
Tip: besides the Twisted documentation you can also take a look at the October 2008 issue of Python Magazine for the article "A Twisted Logging Server" by Doug Farrell.
Thanks to the ones who answered the question. You set me on the right track. :)
Writing a simple IRC bot isn't that hard. I have a template I keep using for my bots, which range from SVN bots to voting-status bots to bots which check connections to certain IPs and change the channel's topic according to the result.
I can share the source if you'd like, though there's nothing like writing your own :)
irc3 is a plugable irc client library based on asyncio and venusian https://irc3.readthedocs.org/

Categories

Resources