Registry / communication / mattermostdriver

mattermostdriver

JSON →
library7.3.2pypypi✓ verified 85d ago

Mattermostdriver is a Python library providing a client for the Mattermost API. It enables developers to interact with Mattermost servers, manage users, channels, posts, and more. The current version is 7.3.2, and it maintains an active release cadence with regular updates and bug fixes.

pip install mattermostdriver
INSTALL
IMPORT
SIG · MATTERMOSTDRIVER
M
mattermostdriver
communicationpythonv7.3.2
Install
2.4s avg
Import
747ms
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v7.3.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.804s · 22.9MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.4s · import 0.690s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Driver
from mattermostdriver import Driver

This quickstart demonstrates how to initialize the `Driver`, log in using username/password (or token if provided via environment variable `MATTERMOST_TOKEN`), retrieve the current user's information, and then log out. Ensure your Mattermost server details and credentials are set as environment variables or passed directly to the Driver constructor.

import os from mattermostdriver import Driver # Configure driver with environment variables or provide directly driver = Driver({ 'url': os.environ.get('MATTERMOST_HOST', 'localhost'), 'login_id': os.environ.get('MATTERMOST_LOGIN_ID', 'user@example.com'), 'password': os.environ.get('MATTERMOST_PASSWORD', 'yourpassword'), 'scheme': os.environ.get('MATTERMOST_SCHEME', 'https'), 'port': int(os.environ.get('MATTERMOST_PORT', 443)), 'verify': os.environ.get('MATTERMOST_VERIFY_SSL', 'true').lower() == 'true', 'token': os.environ.get('MATTERMOST_TOKEN', '') # Optional: for token-based auth }) try: driver.login() current_user = driver.users.get_current_user() print(f"Successfully logged in as: {current_user['username']} (ID: {current_user['id']})") # Example: Get system info # info = driver.system.get_ping() # print(f"Mattermost Server Status: {info}") except Exception as e: print(f"Login failed: {e}") finally: if driver.is_connected(): driver.logout() print("Logged out.")
Debug
Known issues
breakingPython 3.4 support was dropped in version 7.0.0. Projects still on Python 3.4 will need to upgrade their Python version to 3.5 or newer to use mattermostdriver 7.x.x and above.
fix
Upgrade your Python environment to version 3.5 or higher. Alternatively, pin your mattermostdriver dependency to `<7.0.0` if you cannot upgrade Python.
affects: >=7.0.0
gotchaInconsistent authentication behavior and login failures were reported in versions leading up to 7.3.2, specifically in 6.3.0. This could manifest as unexpected login failures or issues with session persistence.
fix
Upgrade to mattermostdriver version 7.3.2 or later to benefit from the fixes related to authentication stability.
affects: 6.3.0 - 7.3.1
gotchaIssues with WebSocket disconnects not functioning correctly were present in versions prior to 7.3.1. This could lead to orphaned or persistent WebSocket connections.
fix
Upgrade to mattermostdriver version 7.3.1 or later to ensure reliable WebSocket disconnection.
affects: <7.3.1
gotchaMajor dependency versions (e.g., `websockets`, `requests`) have been bumped in recent releases (e.g., 7.2.0, 7.3.1). This might introduce dependency conflicts if your project relies on older versions of these libraries for other components.
fix
Carefully manage your project's dependency tree. Consider using `pip install --no-deps` for mattermostdriver and manually installing compatible versions of `requests` and `websockets` if conflicts arise. Using virtual environments for each project is highly recommended.
affects: >=7.2.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'mattermostdriver'
The `mattermostdriver` package is not installed in your current Python environment.
fix
Run `pip install mattermostdriver` to install the library.
Login failed in version 6.3.0
Specific bug in mattermostdriver version 6.3.0 prevented successful user login for some configurations.
fix
Upgrade to `mattermostdriver>=7.3.2` to resolve known login issues. If upgrading is not possible, review your Mattermost server's authentication settings and driver configuration carefully.
websocket._exceptions.WebSocketConnectionClosedException: WebSocket connection is already closed.
Attempting to send or receive data over a WebSocket connection that has already been closed or was never properly established.
fix
Ensure `driver.init_websocket()` and `driver.login()` are successful before attempting WebSocket operations. Check network connectivity and Mattermost server WebSocket settings. Upgrade to `mattermostdriver>=7.3.1` for disconnect fixes.
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
The Mattermost server unexpectedly closed the connection, often due to incorrect server URL/port, invalid SSL certificate, or firewall issues.
fix
Verify that the `url`, `port`, and `scheme` in your `Driver` configuration are correct and reachable. If using `https`, ensure `verify` is set correctly for your server's SSL certificate, or temporarily set `verify: False` for testing (not recommended for production).
Upgrade
Version history
7.3.2latest on PyPI · released Jan 21, 2022
Audit
Dependencies
requestsrequiredUsed for HTTP API communication.
websocketsrequiredUsed for WebSocket real-time communication.
Agent activity
24 hits · last 30 days
node
21
OpenAI (training)
1
Resources
mattermostdriver — pip install mattermostdriver · libregistry