I want to write a micro blogging site with html frontend but xmpp backend (Instant messenger type). By this, I mean server should push all the updates to client browser and hence constant http polling is not required. I need your view and help in that.
I found 3 xmpp libraries
1. xmppy
2. sleekxmpp
3. pyxmpp
Should i use any of these or should try from scratch. If from these which one will you suggest.
What should i do?
This slideshow may help. The author uses django and some xmpp items that can tag along with django's authentication. This sounds pretty perfect for you.
The link is to google's cache because the original link wouldn't work for me anymore. Let me know if this is a problem.
try this - https://github.com/hj91/Using-XMPP-to-post-content-on-blog-sms-facebook
xmpp to wp blog poster bot code.
it takes incoming xmpp message and posts them on worpdress blogs. written in python and xmpppy library
Related
I am only told to create a pythonic web service. At the end of the day, I need to offer a HTTPS endpoint which will receive(from a post request), and be able to process/send back json objects from/to another web service.
To be able to receive post requests from other services, what kind of information do I need?
I have seen some examples using httplib2 such as sending HTTP get and post requests when given a website like www.something.com. But in my case, since I do not know the IP address/URL of the data source, should I create a listener waiting for the incoming data? How to achieve this?
I am really new with building python web server and the requirement I am given is really vague. Thank you in advance for helping me break down this problem.
Take a look at the Flask framework, it can do everything you want and then some. I can especially recommend the Quickstart: A Minimal Application and the JSON Support pages.
Enabling the build in debugger will help you a great deal as well.
All services is listening for incoming connections, so you are right about that :-)
Good luck!
I'm using pyramid to build up a web site and would like to find some modules about sending messages between users accounts in my web site. I've heard that rails has some gems for that such like https://github.com/ging/mailboxer or https://github.com/pluginaweek/has_messages .
I would like to find the python one. Can anyone recommend me some python modules?
Thanks!
You're probably best off using an existing protocol like XMPP. For Plone (a Python CMS) for example there's a complete XMPP integration with collective.xmpp.chat providing multi-user chat and Instant Messaging between authenticated users of a Plone site (demo video).
For Pyramid you'll need to do this integration yourself [1], by running a Jabber / XMPP server (such as ejabberd) and using an existing XMPP client library for Python to communicate with it. There are plenty of XMPP libraries for Python, some of them are described in the answers to this question.
Note: Don't be scared if after looking at XMPP it looks way to complex. XMPP and its extension describe a wide variety of features related to Messaging and Presence, chat is just one of them. If you don't need the other features, simply don't implement them in your webapp.
[1] Actually, there is a Pyramid project that seems to do exactly that: seshat, written by #KirkStrauser. I haven't used it myself, but it looks very promising.
No; direct communication between two individuals isn't possible in web applications because they use stateless protocols; the server does not know if the request is coming from the same person or not.
That being said, what chat applications usually do is store the communications within a database between the 2 individuals, and use AJAX to retrieve them.
There are already lots of chat application tutorials and 3rd party chat application packages online; you might want to check them out.
I'm starting a project using the XMPP protocol and haven't done anything with it thus far. I would like some advice/direction in regards to my questions below.
At the present moment, I know Facebook's Chat API says to use PyXMPP and pyFacebook, which is what I will be using initially. However can someone give me an idea as to how to connect Facebook chat with Gtalk; using their example script, located here:: http://developers.facebook.com/docs/chat/
I see that they mention API keys, where exactly do I retrieve the API keys from? Thanks.
You need to register your application at http://developers.facebook.com/apps and get the API keys. Both Gtalk and Facebook chat are built on XMPP protocol. So you can set up an XMPP chat client which will connect to both.
Refer to the book written by Jack Mofitt: http://professionalxmpp.com/
It talks about setting up the chat client. Also the documentation in the Developers forum is bad. Check out this thread from the old forum http://forum.developers.facebook.net/viewtopic.php?id=51892
Yes you can connect using digest MD5, where you need to pass the username and password. Go through the XMPP protocol to get a better understanding on digest MD5.
I've written a Python application that makes web requests using the urllib2 library after which it scrapes the data. I could deploy this as a web application which means all urllib2 requests go through my web-server. This leads to the danger of the server's IP being banned due to the high number of web requests for many users. The other option is to create an desktop application which I don't want to do. Is there any way I could deploy my application so that I can get my web-requests through the client side. One way was to use Jython to create an applet but I've read that Java applets can only make web-requests to the server it is deployed on and the only way to to circumvent this is to create a server side proxy which leads us back to the problem of the server's ip getting banned.
This might sounds sound like and impossible situation and I'll probably end up creating a desktop application but I thought I'd ask if anyone knew of an alternate solution.
Thanks.
You can use a signed Java applet, they can use the Java security mechanism to enable access to any site.
This tutorial explains exactly what you have to do: http://www-personal.umich.edu/~lsiden/tutorials/signed-applet/signed-applet.html
The same might be possible from a Flash applet. Javascript is also restricted to the published site and doesn't allow being signed or security exceptions like this, AFAIK.
You probably can use AJAX requests made from JavaScript that is a part of client-side.
Use server → client communication to give commands and necessary data to make a request
…and use AJAX communication from client to 3rd party server then.
This depends on the form of "scraping" you intend to do:
You might run into problems running an AJAX call to a third-party site. Please see Screen scraping through AJAX and javascript.
An alternative would be to do it server-side, but to cache the results so that you don't hit the third-party server unnecessarily.
Check out diggstripper on google code.
how do I know if a remote user is connected in django?, like gmail chat, or facebook chat... I need that in the templates system. Sorry for my english
If you need just a general idea of who is currently visiting your website, which includes anonymous visitors, use django-tracking app.
If you need a chat application, or need to know exactly who is logged in at any time, this is much more complicated and will require you to know a lot about chat protocols like XMPP and how to use persistent connections with ajax or comet methods. Some starting projects to look at: xmpp-psn and django-xmpp
Also see this web page for a list of non-Django XMPP browser clients: http://xmpp.org/software/clients.shtml
Comet is probably what you want. Look at Orbited, Hurricane or Tornado.