Skip to main content

An unofficial Python library for interacting with the Skype HTTP API.

Here be dragons

The upstream APIs used here are undocumented and are liable to change, which may cause parts of this library to fall apart in obvious or non-obvious ways. You have been warned.

Requirements

Getting started

The documentation gives some examples in more detail, as well as a full API specification, but here are the basics to get you started:

from skpy import Skype
sk = Skype(username, password) # connect to Skype

sk.user # you
sk.contacts # your contacts
sk.chats # your conversations

ch = sk.chats.create(["joe.4", "daisy.5"]) # new group conversation
ch = sk.contacts["joe.4"].chat # 1-to-1 conversation

ch.sendMsg(content) # plain-text message
ch.sendFile(open("song.mp3", "rb"), "song.mp3") # file upload
ch.sendContact(sk.contacts["daisy.5"]) # contact sharing

ch.getMsgs() # retrieve recent messages

Rate limits and sessions

If you make too many authentication attempts, the Skype API may temporarily rate limit you, or require a captcha to continue. For the latter, you will need to complete this in a browser with a matching IP address.

To avoid this, you should reuse the Skype token where possible. A token only appears to last 24 hours (web.skype.com forces re-authentication after that time), though you can check the expiry with sk.tokenExpiry. Pass a filename as the third argument to the Skype() constructor to read and write session information to that file.

Event processing

Make your class a subclass of SkypeEventLoop, then override the onEvent(event) method to handle incoming messages and other events:

from skpy import SkypeEventLoop, SkypeNewMessageEvent
class SkypePing(SkypeEventLoop):
    def __init__(self):
        super(SkypePing, self).__init__(username, password)
    def onEvent(self, event):
        if isinstance(event, SkypeNewMessageEvent) \
          and not event.msg.userId == self.userId \
          and "ping" in event.msg.content:
            event.msg.chat.sendMsg("Pong!")

Create an instance and call its loop() method to start processing events. For programs with a frontend (e.g. a custom client), you’ll likely want to put the event loop in its own thread.

Tests and documentation

Unit tests can be found in the test folder – client test cases are designed to test the library’s behaviour and parsing of mocked API responses, whereas server cases connect to the live Skype API.

The SkPy docs repo holds, in addition to docs for this library, a collection of unofficial documentation for the Skype HTTP APIs at large.

Release files for SkPy 0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SkPy 0.11
File Size Uploaded
skpy-0.11.tar.gz 53.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SkPy 0.11
File Interpreter ABI Platform
SkPy-0.11-py3-none-any.whl Python 3 none any Details

Total release size: 102.7 kB

Release files / skpy-0.11.tar.gz

Download URL skpy-0.11.tar.gz
Size 53.4 kB
Tags Source
SHA-256 checksum
How to use checksums
37071b159827c36585ec170ecaac233c221f4dcd06851f12c1fd20579f02769e
BLAKE2b-256 checksum
How to use checksums
56927629810108c9cfedeb8587f566bdb7ac9a78fcf0c1a63334232a231c50db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.4

Release files / SkPy-0.11-py3-none-any.whl

Download URL SkPy-0.11-py3-none-any.whl
Size 49.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26f71581b328e6e72e47f8f3b76b0ea2165a7e5543a56b86f065f42cab948191
BLAKE2b-256 checksum
How to use checksums
d409d3f87de1dd8808300d059427ea8ceec3013678fc3bbf1c51cd075b704c19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.11 This release

2 release files

0.10.6

1 release file

0.10.5

1 release file

0.10.4

1 release file

0.10.3

1 release file

0.10.2

1 release file

0.10.1

1 release file

0.10

1 release file

0.9.1

1 release file

0.9

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5.1

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page