API reference#

All classes listed below are imported into the main skpy namespace, so can be imported without the need to reference submodules (i.e. from skpy import Skype).

Core classes#

class skpy.main.Skype[source]#

The main Skype instance. Provides methods for retrieving various other object types.

user#

Contact information for the connected account.

Type:

SkypeContact

contacts#

Container of contacts for the connected user.

Type:

SkypeContacts

chats#

Container of conversations for the connected user.

Type:

SkypeChats

settings#

Read/write access to server-side account options.

Type:

SkypeSettings

services#

Skype credit and other paid services for the connected account.

Type:

dict

translate#

Connected instance of the translator service.

Type:

SkypeTranslator

conn#

Underlying connection instance.

Type:

SkypeConnection

__init__(user=None, pwd=None, tokenFile=None, connect=True)[source]#

Create a new Skype object and corresponding connection.

If user and pwd are given, they will be passed to SkypeConnection.setUserPwd(). This can be either a Skype username/password pair, or a Microsoft account email address and its associated password.

If a token file path is present, it will be used if valid. On a successful connection, the token file will also be written to.

By default, a connection attempt will be made if any valid form of credentials are supplied. It is also possible to handle authentication manually, by working with the underlying connection object instead.

Parameters:
  • user (str) – Skype username of the connecting account

  • pwd (str) – corresponding Skype account password

  • tokenFile (str) – path to file used for token storage

  • connect (bool) – whether to try and connect straight away

Raises:
  • .SkypeAuthException – if connecting, and the login request is rejected

  • .SkypeApiException – if connecting, and the login form can’t be processed

subscribePresence()[source]#

Subscribe to contact presence events.

getEvents()[source]#

Retrieve a list of events since the last poll. Multiple calls may be needed to retrieve all events.

If no events occur, the API will block for up to 30 seconds, after which an empty list is returned. As soon as an event is received in this time, it is returned immediately.

Returns:

a list of events, possibly empty

Return type:

SkypeEvent list

setPresence(status=Online)[source]#

Set the current user’s presence on the network. Supports Status.Online, Status.Busy or Status.Hidden (shown as Status.Offline to others).

Parameters:

status (.Status) – new availability to display to contacts

setMood(mood)[source]#

Update the activity message for the current user.

Parameters:

mood (str) – new mood message

setAvatar(image)[source]#

Update the profile picture for the current user.

Parameters:

image (file) – a file-like object to read the image from

getUrlMeta(url)[source]#

Retrieve various metadata associated with a URL, as seen by Skype.

Parameters:

url (str) – address to ping for info

Returns:

metadata for the website queried

Return type:

dict

class skpy.main.SkypeEventLoop[source]#

A skeleton class for producing event processing programs. Implementers will most likely want to override the onEvent() method.

autoAck#

Whether to automatically acknowledge all incoming events.

Type:

bool

__init__(user=None, pwd=None, tokenFile=None, autoAck=True, status=None)[source]#

Create a new event loop and the underlying connection.

All arguments up to tokenFile are passed to the SkypeConnection instance.

Parameters:
  • user (str) – Skype username of the connecting account

  • pwd (str) – corresponding Skype account password

  • tokenFile (str) – path to file used for token storage

  • autoAck (bool) – whether to automatically acknowledge all incoming events

  • status (.Status) – availability to display to contacts

cycle()[source]#

Request one batch of events from Skype, calling onEvent() with each event in turn.

Subclasses may override this method to alter loop functionality.

loop()[source]#

Continuously handle any incoming events using cycle().

This method does not return, so for programs with a UI, this will likely need to be run in its own thread.

onEvent(event)[source]#

A stub method that subclasses should implement to react to messages and status changes.

Parameters:

event (SkypeEvent) – an incoming event

class skpy.main.SkypeSettings[source]#

An interface for getting and setting server options for the connected account.

All attributes are read/write, with values fetched on each access, and implicit server writes when changed.

notificationPopups#

Skype for Web (Notifications): show browser notifications on new messages.

Type:

bool

notificationSounds#

Skype for Web (Sounds): play the Skype pop sound on new messages.

Type:

bool

webLinkPreviews#

Skype for Web (Web link previews): replace URLs in messages with rich previews.

Type:

bool

youtubePlayer#

Skype for Web (YouTube player): replace YouTube URLs with an inline player.

Type:

bool

mentionNotifs#

Skype for Web (@mention notifications): trigger notifications when mentioned in a message.

Type:

bool

imagePaste#

Skype for Web (Enable image paste): support sending image files by pasting into a conversation input field.

Type:

bool

shareTyping#

Skype for Web (Typing indicator): send typing notifications to contacts when active in conversations.

Type:

bool

emoteSuggestions#

Skype for Web (Emoticon suggestions): show popup lists of emoticons matching keywords.

Type:

bool

showEmotes#

Skype for Web (Show emoticons): replace text shortcuts (:)) with actual emoticons in conversations.

Type:

bool

animateEmotes#

Skype for Web (Show animated emoticons): use animated version of emoticons.

Type:

bool

largeEmotes#

Skype for Web (Show large emoticons): if only an emoticon in a message, display it larger.

Type:

bool

pinFavourites#

Skype for Web (Pin recent favorites): show favourite and recent contacts at the top of the contact list.

Type:

bool

darkTheme#

Skype for Web (Dark theme): use white text on a dark background.

Type:

bool

autoAddFriends#

Make address book contacts with Skype accounts appear in the contact list.

Type:

bool

callPrivacy#

Who to accept incoming audio calls from.

Type:

Privacy

videoPrivacy#

Who to accept incoming video and screen-share requests from.

Type:

Privacy

Privacy = ('Anyone', 'Contacts', 'Nobody')#

Privacy option values for incoming audio and video calls.

Privacy.Anyone#

Allow from all Skype users.

Privacy.Contacts#

Only allow from Skype users on the connected account’s contact list.

Privacy.Nobody#

Deny from all Skype users.

Type:

SkypeEnum

syncFlags()[source]#

Update the cached list of all enabled flags, and store it in the flags attribute.

class skpy.main.SkypeTranslator[source]#

An interface to Skype’s translation API.

languages#

Known languages supported by the translator.

Type:

dict

__call__(text, toLang, fromLang=None)[source]#

Attempt translation of a string. Supports automatic language detection if fromLang is not specified.

Parameters:
  • text (str) – input text to be translated

  • toLang (str) – country code of output language

  • fromLang (str) – country code of input language

Users and contacts#

class skpy.user.SkypeUser[source]#

A user on Skype – the current one, a contact, or someone else.

Properties differ slightly between the current user and others. Only public properties are available here.

Searches different possible attributes for each property. Also deconstructs a merged first name field.

id#

Username of the user.

Type:

str

name#

Representation of the user’s name.

Type:

Name

location#

Geographical information provided by the user.

Type:

Location

language#

Two-letter language code as specified by the user.

Type:

str

avatar#

URL to retrieve the user’s profile picture.

Type:

str

mood#

Mood message set by the user.

Type:

Mood

chat#

One-to-one conversation with this user.

Type:

SkypeSingleChat

class Name[source]#

The name of a user or contact.

first#

First and middle names of the user.

Type:

str

last#

Surname of the user.

Type:

str

class Location[source]#

The location of a user or contact.

Any number of fields may be filled in, so stringifying will combine them into a comma-separated list.

city#

Town or city where the user is located.

Type:

str

region#

State or region where they are located.

Type:

str

country#

Two-letter country code for their location.

Type:

str

class Mood[source]#

The mood message set by a user or contact.

plain#

Plain text representation of a user’s mood.

Type:

str

rich#

Mood message with original formatting.

Type:

str

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

invite(greeting=None)[source]#

Send the user a contact request.

Parameters:

greeting (str) – custom message to include with the request

block(report=False)[source]#

Block the user from all communication.

Parameters:

report (bool) – whether to report this user to Skype

unblock()[source]#

Unblock a previously blocked user.

class skpy.user.SkypeContact[source]#

A user on Skype that the logged-in account is a contact of. Allows access to contacts-only properties.

phones#

Any phone numbers defined for the user.

Type:

Phone list

birthday#

Date of birth of the user.

Type:

datetime.datetime

authorised#

Whether the user has accepted an invite to become a contact.

Type:

bool

blocked#

Whether the logged-in account has blocked this user.

Type:

bool

favourite#

Whether the contact is marked as a favourite by the logged-in user.

Type:

bool

class Phone[source]#

The phone number of a contact.

Type = ('Home', 'Work', 'Mobile')#

Types of phone number.

Type.Home#

A home phone number.

Type.Work#

An office or work phone number.

Type.Mobile#

A mobile phone number.

Type:

SkypeEnum

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

classmethod fromRaw(skype=None, raw={})[source]#

Create a new instance based on the raw properties of an API response.

This can be overridden to automatically create subclass instances based on the raw content.

Parameters:
  • skype (Skype) – parent Skype instance

  • raw (dict) – raw object, as provided by the API

Returns:

the new class instance

Return type:

SkypeObj

delete()[source]#

Remove the user from your contacts.

class skpy.user.SkypeBotUser[source]#

A server-side bot account. In most cases, they act like a normal user – they can be added as contacts, interacted with in one-to-one conversations, or invited to groups if the bot supports it.

name#

Display name of the bot.

Type:

str

developer#

Display name of the bot’s developer.

Type:

str

trusted#

Whether the bot is official and provided by Skype or Microsoft.

Type:

bool

locales#

Country-language codes supported by the bot.

Type:

str list

rating#

User-provided rating of the bot.

Type:

float

description#

Information about what the bot does.

Type:

str

extra#

Footer info, such as hyperlinks to privacy and terms.

Type:

str

siteUrl#

URL for the bot’s website.

Type:

str

termsUrl#

URL for the bot’s terms of service.

Type:

str

privacyUrl#

URL for the bot’s privacy policy.

Type:

str

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

class skpy.user.SkypeContacts[source]#

A container of contacts, providing caching of user info to reduce API requests.

There are multiple ways to look up users in Skype:

  • Requesting the whole contact list – includes most fields, as well as authorisation status.

  • Requesting a single contact (contact()) – returns all public and contact-private info.

  • Requesting a single user (user()) – only provides public information, but works with any user.

  • Searching the Skype directory (search()) – returns a collection of search results.

When using key lookups, it checks the contact list first, with a user fallback for non-contacts.

Contacts can also be iterated over, where only authorised users are returned in the collection.

groups#

Set of SkypeContactGroup instances, keyed by group name.

Type:

dict

blocked#

Group of users blocked from all communication.

Type:

SkypeContactGroup

sync()[source]#

A stub method that subclasses can implement to retrieve an initial set of objects.

contact(id)[source]#

Retrieve all details for a specific contact, including fields such as birthday and mood.

Parameters:

id (str) – user identifier to lookup

Returns:

resulting contact object

Return type:

SkypeContact

user(id)[source]#

Retrieve public information about a user.

Parameters:

id (str) – user identifier to lookup

Returns:

resulting user object

Return type:

SkypeUser

bots()[source]#

Retrieve a list of all known bots.

Returns:

resulting bot user objects

Return type:

SkypeBotUser list

bot(id)[source]#

Retrieve a single bot.

Parameters:

id (str) – UUID or username of the bot

Returns:

resulting bot user object

Return type:

SkypeBotUser

search(query)[source]#

Search the Skype Directory for a user.

Parameters:

query (str) – name to search for

Returns:

collection of possible results

Return type:

SkypeUser list

requests()[source]#

Retrieve any pending contact requests.

Returns:

collection of requests

Return type:

SkypeRequest list

class skpy.user.SkypeContactGroup[source]#

A user-defined collection of contacts. Currently read-only in the API.

id#

Unique identifier for this group.

Type:

str

name#

Display name as set by the user.

Type:

str

contacts#

Contacts added to this group.

Type:

SkypeContact list

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

class skpy.user.SkypeRequest[source]#

A contact request. Use accept() or reject() to act on it.

user#

User that initiated the request.

Type:

SkypeUser

greeting#

Custom message included with the request.

Type:

str

time#

Time and date when the invite was sent.

Type:

datetime.datetime

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

accept()[source]#

Accept the contact request, and add the user to the contact list.

reject()[source]#

Decline the contact request.

Conversations#

class skpy.chat.SkypeChat[source]#

A conversation within Skype.

id#

Unique identifier of the conversation.

One-to-one chats have identifiers of the form <type>:<username>.

Cloud group chat identifiers are of the form <type>:<identifier>@thread.skype.

Type:

str

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

classmethod fromRaw(skype=None, raw={})[source]#

Create a new instance based on the raw properties of an API response.

This can be overridden to automatically create subclass instances based on the raw content.

Parameters:
  • skype (Skype) – parent Skype instance

  • raw (dict) – raw object, as provided by the API

Returns:

the new class instance

Return type:

SkypeObj

getMsgs()[source]#

Retrieve a batch of messages from the conversation.

This method can be called repeatedly to retrieve older messages.

If new messages arrive in the meantime, they are returned first in the next batch.

Returns:

collection of messages

Return type:

SkypeMsg list

sendRaw(editId=None, **kwargs)[source]#

Send a raw message to the conversation. At a minimum, values for content, messagetype and contenttype should be provided.

The message object returned here will not have a server-provided identifier (needed for acks), as the messages API does not provide it. Note that message edits depend on the client identifier, which is included.

There is no need to include clientmessageid or skypeeditedid – instead, use editId to update an existing message, otherwise a new one will be created with its own client identifier.

Parameters:
  • editId (int) – identifier of an existing message to replace

  • content (str) – plain or HTML body for the message

  • contenttype (str) – format of the message, normally text

  • messagetype (str) – base message type

  • skypeemoteoffset (int) – used with action messages to control where the user’s name ends

  • Has-Mentions (str) – whether the message mentions any other users

  • kwargs (dict) – any additional arguments not listed above

Returns:

copy of the sent message object

Return type:

.SkypeMsg

setTyping(active=True)[source]#

Send a typing presence notification to the conversation. This will typically show the “<name> is typing…” message in others clients.

Note

A user’s event stream will not receive any events for their own typing notifications.

It may be necessary to send this type of message continuously, as each typing presence usually expires after a few seconds. Set active to False to clear a current presence.

Parameters:

active (bool) – whether to show as currently typing

Returns:

copy of the sent message object

Return type:

.SkypeMsg

sendMsg(content, me=False, rich=False, edit=None)[source]#

Send a text message to the conversation.

If me is specified, the message is sent as an action (equivalent to /me <content> in other clients). This is typically displayed as “<name> <content>”, where clicking the name links back to your profile.

Rich text can also be sent, provided it is formatted using Skype’s subset of HTML. Helper methods on the SkypeMsg class can generate the necessary markup.

Parameters:
  • content (str) – main message body

  • me (bool) – whether to send as an action, where the current account’s name prefixes the message

  • rich (bool) – whether to send with rich text formatting

  • edit (int) – client identifier of an existing message to edit

Returns:

copy of the sent message object

Return type:

.SkypeMsg

sendFile(content, name, image=False)[source]#

Upload a file to the conversation. Content should be an ASCII or binary file-like object.

If an image, Skype will generate a thumbnail and link to the full image.

Parameters:
  • content (file) – file-like object to retrieve the attachment’s body

  • name (str) – filename displayed to other clients

  • image (bool) – whether to treat the file as an image

Returns:

copy of the sent message object

Return type:

.SkypeFileMsg

sendContacts(*contacts)[source]#

Share one or more contacts with the conversation.

Parameters:

contacts (SkypeUser list) – users to embed in the message

Returns:

copy of the sent message object

Return type:

.SkypeContactMsg

setConsumption(horizon)[source]#

Update the user’s consumption horizon for this conversation, i.e. where it has been read up to.

To consume up to a given message, call SkypeMsg.read() instead.

Parameters:

horizon (str) – new horizon string, of the form <id>,<timestamp>,<id>

setAlerts(alerts)[source]#

Enable or disable message and event alerts for this conversation.

Parameters:

alerts (bool) – whether to receive notifications

delete()[source]#

Delete the conversation and all message history.

class skpy.chat.SkypeSingleChat[source]#

A one-to-one conversation within Skype.

user#

The other participant in the conversation.

Type:

SkypeUser

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

class skpy.chat.SkypeGroupChat[source]#

A group conversation within Skype. Compared to single chats, groups have a topic and participant list.

topic#

Description of the conversation, shown to all participants.

Type:

str

creator#

User who originally created the conversation.

Type:

SkypeUser

users#

Users currently participating in the conversation.

Type:

SkypeUser list

admins#

Participants with admin privileges.

Type:

SkypeUser list

open#

Whether new participants can join via a public join link.

Type:

bool

history#

Whether message history is provided to new participants.

Type:

bool

picture#

URL to retrieve the conversation picture.

Type:

str

joinUrl#

Public join.skype.com URL for any other users to access the conversation.

Type:

str

active#

Whether the full group chat was retrieved from the server. This may be False if a group conversation still appears in the recent list despite being left or deleted.

Type:

bool

moderated#

Whether the group chat is a Skype Moderated Group.

Type:

bool

classmethod rawToFields(raw={}, active=False)[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

setTopic(topic)[source]#

Update the topic message. An empty string clears the topic.

Parameters:

topic (str) – new conversation topic

setModerated(moderated=True)[source]#

Update the chat type, and make chat moderated.

Parameters:

moderated (bool) – whether to enable moderation restrictions

setOpen(open)[source]#

Enable or disable joining by URL. This does not affect current participants inviting others.

Parameters:

open (bool) – whether to accept new participants via a public join link

setHistory(history)[source]#

Enable or disable conversation history. This only affects messages sent after the change.

If disabled, new participants will not see messages before they arrived.

Parameters:

history (bool) – whether to provide message history to new participants

addMember(id, admin=False)[source]#

Add a user to the conversation, or update their user/admin status.

Parameters:
  • id (str) – user identifier to invite

  • admin (bool) – whether the user will gain admin privileges

removeMember(id)[source]#

Remove a user from the conversation.

Parameters:

id (str) – user identifier to remove

leave()[source]#

Leave the conversation. You will lose any admin rights.

If public joining is disabled, you may need to be re-invited in order to return.

class skpy.chat.SkypeChats[source]#

A container of conversations, providing caching of user info to reduce API requests.

Key lookups allow retrieving conversations by identifier.

recent()[source]#

Retrieve a selection of conversations with the most recent activity, and store them in the cache.

Each conversation is only retrieved once, so subsequent calls will retrieve older conversations.

Returns:

collection of recent conversations keyed by their ID

Return type:

SkypeChat dict

chat(id)[source]#

Get a single conversation by identifier.

Parameters:

id (str) – single or group chat identifier

Returns:

retrieved conversation

Return type:

SkypeChat

create(members=(), admins=(), moderated=False)[source]#

Create a new group chat with the given users.

The current user is automatically added to the conversation as an admin. Any other admin identifiers must also be present in the member list.

Parameters:
  • members (str list) – user identifiers to initially join the conversation

  • admins (str list) – user identifiers to gain admin privileges

  • moderate (bool) – whether to enable moderation restrictions

Returns:

newly created group conversation

Return type:

SkypeGroupChat

static urlToIds(url)[source]#

Resolve a join.skype.com URL and returns various identifiers for the group conversation.

Parameters:

url (str) – public join URL, or identifier from it

Returns:

related conversation’s identifiers – keys: id, long, blob

Return type:

dict

Messages#

class skpy.msg.SkypeMsg[source]#

A message either sent or received in a conversation.

An edit is represented by a follow-up message with the same clientId, which replaces the earlier message.

id#

Identifier of the message provided by the server, usually a timestamp.

Type:

str

type#

Raw message type, as specified by the Skype API.

Type:

str

time#

Original arrival time of the message.

Type:

datetime.datetime

clientId#

Identifier generated by the client, used as a reference for edits.

Type:

str

user#

User that sent the message.

Type:

SkypeUser

chat#

Conversation where this message was received.

Type:

SkypeChat

content#

Raw message content, as received from the API.

Type:

str

html#

Recreated content string based on the field values.

Type:

str

deleted#

Whether the message content was deleted by the sender.

Type:

bool

static bold(s)[source]#

Format text to be bold.

Parameters:

s (str) – string to format

Returns:

formatted string

Return type:

str

static italic(s)[source]#

Format text to be italic.

Parameters:

s (str) – string to format

Returns:

formatted string

Return type:

str

static strike(s)[source]#

Format text to be struck through.

Parameters:

s (str) – string to format

Returns:

formatted string

Return type:

str

static mono(s)[source]#

Format text to be monospaced.

Parameters:

s (str) – string to format

Returns:

formatted string

Return type:

str

static colour(s, colour)[source]#

Format text to be coloured.

Parameters:
  • s (str) – string to format

  • colour (str) – colour to display text in

Returns:

formatted string

Return type:

str

Create a hyperlink. If display is not specified, display the URL.

Note

Anomalous API behaviour: official clients don’t provide the ability to set display text.

Parameters:
  • url (str) – full URL to link to

  • display (str) – custom label for the hyperlink

Returns:

tag to display a hyperlink

Return type:

str

static emote(shortcut)[source]#

Display an emoticon. This accepts any valid shortcut.

Parameters:

shortcut (str) – emoticon shortcut

Returns:

tag to render the emoticon

Return type:

str

static mention(user)[source]#

Mention a user in a message. This may trigger a notification for them even if the conversation is muted.

Parameters:

user (SkypeUser) – user who is to be mentioned

Returns:

tag to display the mention

Return type:

str

mention_all = '<at id="*">all</at>'#

Mention all users of a group chat in a message.

static quote(user, chat, timestamp, content)[source]#

Display a message excerpt as a quote from another user.

Skype for Web doesn’t support native quotes, and instead displays the legacy quote text. Supported desktop clients show a blockquote with the author’s name and timestamp underneath.

Note

Anomalous API behaviour: it is possible to fake the message content of a quote.

Parameters:
  • user (SkypeUser) – user who is to be quoted saying the message

  • chat (SkypeChat) – conversation the quote was originally seen in

  • timestamp (datetime.datetime) – original arrival time of the quoted message

  • content (str) – excerpt of the original message to be quoted

Returns:

tag to display the excerpt as a quote

Return type:

str

static uriObject(content, type, url, thumb=None, title=None, desc=None, **values)[source]#

Generate the markup needed for a URI component in a rich message.

Parameters:
  • content (str) – object-specific content inside the object tag

  • type (str) – URI object type

  • url (str) – URL to content

  • title (str) – name of object

  • desc (str) – additional line of information

  • thumb (str) – URL to thumbnail of content

  • values (dict) – standard value tags of the form <key v="value"/>

Returns:

<URIObject> tag

Return type:

str

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

classmethod fromRaw(skype=None, raw={})[source]#

Create a new instance based on the raw properties of an API response.

This can be overridden to automatically create subclass instances based on the raw content.

Parameters:
  • skype (Skype) – parent Skype instance

  • raw (dict) – raw object, as provided by the API

Returns:

the new class instance

Return type:

SkypeObj

read()[source]#

Mark this message as read by sending an updated consumption horizon.

edit(content, me=False, rich=False)[source]#

Send an edit of this message. Arguments are passed to SkypeChat.sendMsg().

Note

Anomalous API behaviour: messages can be undeleted by editing their content to be non-empty.

Parameters:
  • content (str) – main message body

  • me (bool) – whether to send as an action, where the current account’s name prefixes the message

  • rich (bool) – whether to send with rich text formatting

Returns:

copy of the edited message object

Return type:

.SkypeMsg

delete()[source]#

Delete the message and remove it from the conversation.

Equivalent to calling edit() with an empty content string.

Returns:

copy of the deleted message object

Return type:

.SkypeMsg

class skpy.msg.SkypeTextMsg[source]#

A message containing rich or plain text.

plain#

Message content converted to plain text.

Hyperlinks are replaced with their target, quotes are converted to the legacy format, and all other HTML tags are stripped from the text.

Type:

str

markup#

Message converted to plain text, retaining formatting markup.

Hyperlinks become their target, message edit tags are stripped, and legacy quote text is used.

In addition, the following replacements are made:

Rich text

Plain text

<b>bold</b>

*bold*

<i>italic</i>

_italic_

<s>strikethrough</s>

~strikethrough~

<pre>monospace</pre>

{code}monospace{code}

<at id="8:fred.2">Fred</at>

@fred.2

Type:

str

class skpy.msg.SkypeContactMsg[source]#

A message containing one or more shared contacts.

contacts#

User objects embedded in the message.

Type:

SkypeUser list

contactNames#

Names of the users, as seen by the sender of the message.

Type:

str list

class skpy.msg.SkypeLocationMsg[source]#

A message containing the sender’s location.

latitude#

North-South coordinate of the user’s location.

Type:

float

longitude#

East-West coordinate of the user’s location.

Type:

float

altitude#

Vertical position from sea level.

Type:

int

speed#

Current velocity during the reading.

Type:

int

course#

Current direction during the recording.

Type:

int

address#

Geocoded address provided by the sender.

Type:

str

mapUrl#

Link to map displaying the location.

Type:

str

class skpy.msg.SkypeCardMsg[source]#

A message containing an interactive card.

title#

Heading text at the top of the card.

Type:

str

body#

Main text content in the card.

Type:

str

buttons#

Available actions for this card.

Type:

Button list

class Button[source]#

A clickable button within a card.

type#

Type of action to be performed on click.

Type:

str

title#

Text displayed on the button.

Type:

str

value#

Parameter to the action.

Type:

str

class skpy.msg.SkypeFileMsg[source]#

A message containing a file shared in a conversation.

file#

File object embedded in the message.

Type:

File

urlContent#

URL to retrieve the raw file content.

Type:

str

fileContent#

Raw content of the file.

Type:

bytes

class File[source]#

Details about a file contained within a message.

name#

Original filename from the client.

Type:

str

size#

Number of bytes in the file.

Type:

int

urlFull#

URL to retrieve the original file.

Type:

str

urlThumb#

URL to retrieve a thumbnail or display image for the file.

Type:

str

urlView#

URL for the user to access the file outside of the API.

Type:

str

class skpy.msg.SkypeImageMsg[source]#

A message containing a picture shared in a conversation.

class skpy.msg.SkypeAudioMsg[source]#

A message containing audio shared in a conversation.

class skpy.msg.SkypeVideoMsg[source]#

A message containing a video shared in a conversation.

class skpy.msg.SkypeCallMsg[source]#

A message representing a change in state to a voice or video call inside the conversation.

state#

New state of the call.

Type:

State

users#

User objects embedded in the message.

Type:

SkypeUser list

userNames#

Names of the users, as seen by the initiator of the call.

Type:

str list

State = ('Started', 'Ended', 'Missed')#

Possible call states (either started and incoming, or ended).

State.Started#

New call has just begun.

State.Ended#

Call failed to connect, or all call participants have hung up.

State.Missed#

Missed the call as it ended.

Type:

SkypeEnum

class skpy.msg.SkypePropertyMsg[source]#

A base message type for changes to conversation properties.

class skpy.msg.SkypeTopicPropertyMsg[source]#

A message representing a change in a group conversation’s topic.

topic#

Description of the conversation, shown to all participants.

Type:

str

class skpy.msg.SkypeOpenPropertyMsg[source]#

A message representing a change to joining the conversation by link.

open#

Whether new participants can join via a public join link.

Type:

bool

class skpy.msg.SkypeHistoryPropertyMsg[source]#

A message representing a change to history disclosure.

history#

Whether message history is provided to new participants.

Type:

bool

class skpy.msg.SkypeMemberMsg[source]#

A message representing a change in a group conversation’s participants.

Note that Skype represents these messages as being sent by the conversation, rather than the initiator. Instead, user is set to the initiator, and member to the target.

member#

User being added to or removed from the conversation.

Type:

SkypeUser

class skpy.msg.SkypeAddMemberMsg[source]#

A message representing a user added to a group conversation.

class skpy.msg.SkypeChangeMemberMsg[source]#

A message representing a user’s role being changed within a group conversation.

admin#

Whether the change now makes the user an admin.

Type:

bool

class skpy.msg.SkypeRemoveMemberMsg[source]#

A message representing a user removed from a group conversation.

Events#

class skpy.event.SkypeEvent[source]#

The base Skype event. Pulls out common identifier, time and type parameters.

id#

Unique identifier of the event, usually starting from 1000.

Type:

int

type#

Raw message type, as specified by the Skype API.

Type:

str

time#

Time at which the event occurred.

Type:

datetime.datetime

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

classmethod fromRaw(skype=None, raw={})[source]#

Create a new instance based on the raw properties of an API response.

This can be overridden to automatically create subclass instances based on the raw content.

Parameters:
  • skype (Skype) – parent Skype instance

  • raw (dict) – raw object, as provided by the API

Returns:

the new class instance

Return type:

SkypeObj

ack()[source]#

Acknowledge receipt of an event, if a response is required.

class skpy.event.SkypePresenceEvent[source]#

An event for contacts changing status or presence.

user#

User whose presence changed.

Type:

SkypeUser

online#

Whether the user is now connected.

Type:

bool

status#

Chosen availability status.

Type:

Status

capabilities#

Features currently available from this user, across all endpoints.

Type:

str list

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

class skpy.event.SkypeEndpointEvent[source]#

An event for changes to individual contact endpoints.

user#

User whose endpoint emitted an event.

Type:

SkypeUser

name#

Name of the device connected with this endpoint.

Type:

str

capabilities#

Features available on the device.

Type:

str list

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

class skpy.event.SkypeTypingEvent[source]#

An event for users starting or stopping typing in a conversation.

user#

User whose typing status changed.

Type:

SkypeUser

chat#

Conversation where the user was seen typing.

Type:

SkypeChat

active#

Whether the user has just started typing.

Type:

bool

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

class skpy.event.SkypeMessageEvent[source]#

The base message event, when a message is received in a conversation.

msg#

Message received in the conversation.

Type:

SkypeMsg

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

class skpy.event.SkypeNewMessageEvent[source]#

An event for a new message being received in a conversation.

class skpy.event.SkypeEditMessageEvent[source]#

An event for the update of an existing message in a conversation.

class skpy.event.SkypeCallEvent[source]#

An event for incoming or missed Skype calls.

class skpy.event.SkypeChatUpdateEvent[source]#

An event triggered by various conversation changes or messages.

chat#

Conversation that emitted an update.

Type:

SkypeChat

horizon#

Updated horizon string, in the form <id>,<timestamp>,<id>.

Type:

str

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict

consume()[source]#

Use the consumption horizon to mark the conversation as up-to-date.

class skpy.event.SkypeChatMemberEvent[source]#

An event triggered when someone is added to or removed from a conversation.

users#

List of users affected by the update.

Type:

SkypeUser list

chat#

Conversation where the change occurred.

Type:

SkypeChat

classmethod rawToFields(raw={})[source]#

Convert the raw properties of an API response into class fields. Override to process additional values.

Parameters:

raw (dict) – raw object, as provided by the API

Returns:

a collection of fields, with keys matching attrs

Return type:

dict