Skype with Python

Create the virtualenv

virtualenv skype_venv -p /usr/bin/python2.7 --system-site-packages

Note that I am specyfying the python2 interpreter, and using the system site packages (the python libraries already installed).

Install the Skype4Py library

You can install it with pip.

source skype_venv/bin/activate
pip install Skype4Py

Note that this library allows us to control Skype client application. It means that you will need to have a skype client installed with which you will interact using python.

Source: https://pypi.python.org/pypi/Skype4Py/

Use the library

Open your skype client and launch a python prompt

>>> import Skype4Py
>>> skype = Skype4Py.Skype()
>>> skype.Attach()

At this point, the Skype client will ask for authorization:

Skype4Py authorisation

And now, you can for example get the list of all your contacts:

>>> print 'Your full name:', skype.CurrentUser.FullName
>>> print 'Your contacts:'
>>> for user in skype.Friends:
        print '    ', user.FullName

To go further:

https://leakforums.net/thread-641974?tid=641974&&tid=641974&&pq=2

https://sinister.ly/Thread-Tutorial-Create-your-own-SkypeBOT

https://media.readthedocs.org/pdf/sevabot-skype-bot/latest/sevabot-skype-bot.pdf

Comments

Comments powered by Disqus