Python library for interacting with MSNP servers
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
kooper fae791e786 add docstrings notice
Signed-off-by: kooper <ds.kooper@outlook.com>
2026-08-28 22:59:11 +00:00
pymsdk Nuke pycache 2026-07-05 21:48:57 +01:00
tests Add files via upload (partial) 2026-07-05 21:43:29 +01:00
LICENSE Add files via upload (partial) 2026-07-05 21:43:29 +01:00
pyproject.toml Update pyproject.toml 2026-07-05 22:06:03 +01:00
README.md add docstrings notice 2026-08-28 22:59:11 +00:00

Note

Regarding docstrings - you may notice that they look very odd.

The original codebase did not have any docstrings or comments, and (in my haste) I used AI to generate docstrings, with mixed results.

I plan on actually tidying up the docstrings at a later point. Apologies for any inconveniences.

pymsdk - Python MSNP SDK

PyMSDK is a Python implementation of Microsoft's MSNP, the protocol used by MSN Messenger and Windows Live Messenger.

This repository ports the Rust-based MSNP11 SDK into Python while preserving protocol behavior, module structure, and command flow as closely as possible.

Scope

  • Notification Server connection and login flow
  • Switchboard session creation and participant messaging
  • Contact and group management commands
  • Presence, display name, and personal message updates
  • P2P framing for display picture and file-transfer workflows
  • HTTP-based passport token retrieval and config request parsing

Requirements

This library requires at least Python 3.10 and is compatible with any platform that supports it.

  • Users running Windows Vista and Windows 7 must install Python 3.10 from https://github.com/adang1345/PythonVista due to the PSF officially dropping support from 3.9 onwards.
  • Users running Windows XP might be able to use patched versions of Python from https://kooper.online/files/xp/python3 (untested, not recommended) due to the PSF officially dropping support from 3.5 onwards.
  • Users running Mac OS X Mountain Lion, Lion, Snow Leopard, and Intel-based Leopard (needs verification) can install Python 3.10 from MacPorts due to the PSF officially dropping support from 3.8 onwards:
    sudo port install python310
    

AI Disclaimer

During the development of this library, I made sparing use of AI tools in order to help convert the original Rust code into Python. I have not only handwritten almost all of the code, but also reviewed the AI-generated code to make sure that it is correct and functions properly.

Additionally, AI was used to write docstrings for functions and classes, of which I have also reviewed to make sure that it is accurate.

I have tried my best to make sure that the code is correct and works fine, however there is still a chance that there are bugs and issues. If so, please file an issue and I will try to fix it as soon as I can.

Todo

  • Docstrings for NS and SB commands are written however they are essentially just " command" and need to be expanded
  • Detailed docstrings for NS and SB events are missing and need to be written

Sample usage

import asyncio
from pymsdk import Client, Event, MsnpStatus, PersonalMessage

async def main() -> None:
	client = await Client.new("127.0.0.1", 1863)

	async def on_event(event: Event) -> None:
		print(event.kind, event.data)

	client.add_event_handler_closure(on_event)

	result = await client.login(
		email="testing@example.com",
		password="123456",
		nexus_url="http://localhost:3000/rdr/pprdr.asp",
		client_name="pymsdk",
		version="0.1.0",
	)

	if result.kind == "REDIRECTED_TO":
		await client.disconnect()
		client = await Client.new(result.data["server"], result.data["port"])
		client.add_event_handler_closure(on_event)
		await client.login(
			email="testing@example.com",
			password="123456",
			nexus_url="http://localhost:3000/rdr/pprdr.asp",
			client_name="pymsdk",
			version="0.1.0",
		)

	await client.set_presence(MsnpStatus.ONLINE)
	await client.set_personal_message(PersonalMessage(psm="hello", current_media=""))

if __name__ == "__main__":
	asyncio.run(main())

Installation

To install the library for normal use, run the following command in the root directory:

python -m pip install .

Once installed, you can import the library in your Python code:

from pymsdk import Client, Event, MsnpStatus, PersonalMessage

Tests

Tests are written according to the pytest framework. To run the tests, execute the following command in the root directory:

python -m pytest

Credits

  • campos02 - Creator of the original SDK.

Licensing

This project inherits the MIT license from the original MSNP11 SDK. See LICENSE for details.