16 July 2012

No more skype4py, SkypeKit is here

App developers looking to leverage the Skype platform had a wonderful solution in Skype4Py, the open source python wrapper library. Skype4Py connected to the current Skype installation on the desktop enabling developers to make bots and applications.

Unfortunately, Skype4Py has not been in active development for quite sometime (the last checkin to the codebase was in 2009). At the time of this writing, Skype4Py was verified to be working on Windows 7, and is bound to work fine on OSX and *NIX but there is no saying how long it will continue to do so.

This leaves us with one alternative to continue developing applications and bots on the Skype platform, SkypeKit. In this post, we'll take a look at how get sign up for the skype developer program and also to download and use the skypekit for making a sample app to demonstrate the functionality.

Introduction:


Skypekit is, as their website says, a collection of software and APIs that allows internet-connected devices or applications to offer Skype voice and video calls. Skypekit is basically a headless Skype client that runs independently and without any user interface. Developer’s can make apps that will plug into Skypekit and make use of the intended text / audio / video functionality.

Getting in

While Skype4Py was free to download and use, Skype4Py will set you back 5$ each for the desktop and the embedded versions. Head to your projects page to join the Skype developer program by paying _US $5_.

There are 4 programs listed there

* Desktop API for Hardware
>This is for just the documentation and reference.
* SkypeKit for Desktop
>Members can read the documentation and also downlod the SDK, runtimes (OSX, *NIX and Windows)and keypairs and forum access.
* Desktop API for Software
>This is for just the documentation and reference.
* SkypeKit for Embedded
>Members can read the documentation and also downlod the SDK, runtimes (Embedded devices, android, iOS, etc.)and keypairs and forum access.

For this post, We will look at the Skype for Desktop program as we'll be concentrating on writing apps / bots using the Python language on OSX.

The SDK


Once you're done signing in, you need to download the SDK. You need to agree to the Skype Terms and conditions before the download starts.

The SDK is a multi-platform SDK that lets you develop apps for skype using C++, Java or Python as your language. The SDK also packs the API documentation _AND_ examples for these three languages.

The SDK downloads as a zipped file. Just fire up a terminal and extract the archive into a folder.

`$ tar -zxvf skypekit-sdk_sdk-4.2.1.97_1379776.tar.gz`

`$ cd skypekit-sdk_sdk-4.2.1.97_1379776`

Hunt through the folders to see what they contain… You will notice that the `bin` folder is virtually empty. It just has a bunch of `netlogger` executables. As of Skypekit SDK version 3.2, the runtime which was previously in the bin folder has been removed.

As mentioned previously, the documentation for each wrapper library is present in the `/interfaces/skype/{cpp_embedded|python|java}/documentation/index.html`.

The tutorial code for each of these wrapper libraries is also present in `/examples/{language}/tutorial` folder.

Moving on...

The Runtime


The Skype Runtime no longer exists in the bin folder. I just was informed this morning by Skype's Development Support team that in the latest release a generic runtime is included in the SDK download so you won't need to generate one anymore.

The Runtime is the headless Skype instance that you use to connect your app with the skype network. This application apes most of the desktop app functionality but since it does not have a User Interface, developers are free to customize the look and feel of their application and interact with runtime using the language specific wrappers provided.

According to Skype, this runtime can be used by anyone in your organization's account.

The Keypairs


The keypairs are the last piece of the puzzle in the Skypekit tool before we head into the code. Each application registered on the skype developer page is bound to a unique key-pair of `Base64-encoded X.509 certificates` that authorize the application to interact with the skype services.

Obtaining a key pair is pretty straight forward:

* Head into your project page and click on the **Distribution key pair** link. Speficy a label and the CAPTCHA text.

* Click on **Request key pair** and save your certificate. You will get a `.pem` file to download and use in your application.

A Sample application


Now that we've done with the setup of our SDK and the skype runtime, lets go look at some of the examples provided…

The pem file


For the sake of simplicity in this sample, the first thing to do is to drop your key (the `.pem` file) into the `/examples/python/tutorial` folder.

Open up `keypair.py` in your favourite editor and change

`keyFileName = '';` to `keyFileName = '.pem';`

Startup the skypekit runtime by heading into the folder where you extracted the runtime.

`$ cd mac-x86-skypekit_4.2.1.870_1793622/bin/mac-x86/`

`$ ./mac-x86-skypekit`

Once the runtime kicks in, you'll see it print some messages like so:

SkypeRuntime Copyright (C) 2003-2012 Skype Technologies S.A.
SkypeRuntime Version: 4.2/mac-x86-skypekit_4.2.1.870_1793622
Proprietary and confidential, do not share this application.

and will continue to wait for programs to connect to it.

Open another terminal instance and head into the `/examples/python/tutorial` folder.

Lets start with a simple login script thats provided.

`$ python login.py `

This is what you're going to be seeing:

****************************************************************************
SkypeKit Python Wrapper Tutorial: Account Login
****************************************************************************
Logging in with
Login sequence: CONNECTING_TO_P2P
Login sequence: CONNECTING_TO_SERVER
Login sequence: LOGGING_IN
Login sequence: INITIALIZING
Login sequence: LOGGED_IN
You should now be able to see this account as online from other Skype instances.
Press ENTER to log out

You will also notice that the runtime has emitted some messages during the same process indicating that there has been communication.

In the same manner, to place a call to another skype user, the example code provided does so:

`$ python call.py `

And there comes to end the post on SkypeKit.

For further documentation and support, head to the forums on the Skype developer page.

The API reference for using python on skypekit is available here.

Have fun making great apps!!!

And thanks to

5 comments:

  1. This is a great improvement for Skype. Thanks for writing an informative and articlate article, Casey.

    ReplyDelete
  2. Awesome article Casey. Very informative. Good job brother!

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. I've coded in C++, python and Java for 7 years now and used many different little programs to help with the development of applications and bots. Skype4Py was one of the first decent piece of software I used but as technology progressed and updates stopped it became outdated. Recently I've purchased this software and for $5 you can't ask for much more. I have already coded 2 bot's for a PC game called puzzle pirates which I'm currently selling for $25 each and selling 6 on average each day! Thanks for the article!

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete