Python: disabling deprecation warning

DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python.

If you get this deprecation warning and you can’t upgrade to a newer Python version, it’s possible to disable this warning:

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)

Using Python Requests 2.2.1 with SNI

Server-Name-Indication, or SNI, is an official extension to SSL where the client tells the server what hostname it is contacting. It allows to host multiple SSL enabled website on one IP. To get SNI working with requests 2.2.1 you would need the following steps.

To install next packages:

If it works for you, that’s great.  But if doesn’t, you might want to make sure:

  • you have pyOpenSSL >= 0.13 (if you install it with apt-get or yum you need to remove that version and to reinstall it with pip)
  • you also have python-devel
  • you have libffi and libffi-devel

Once you have all these packages you should be able to use Requests which is able to talk to SNI enabled servers.

 

 

How to send a message over Jabber from Python

Sending a message over Jabber from Python is a simple task. Let’s install Python Jabber/XMPP implementation called pyxmpp2:

python-pip install pyxmpp2

Now download client example:

wget https://raw.github.com/Jajcus/pyxmpp2/master/examples/send_message_client.py

And run:

python send_message_client.py

After you enter all data a message will be sent.