Registry / communication / zulip
library0.9.1pypypi✓ verified 82d ago

The `zulip` Python library provides official client bindings for the Zulip message API, enabling Python applications to interact with a Zulip server. It handles authentication, request formatting, and offers convenient wrapper methods for various API endpoints. Maintained by the Zulip core team, it is considered the most complete and best-documented client library, actively developed to support features up to Zulip server versions. The current version is `0.9.1` on PyPI, with continuous development in line with the broader Zulip project.

pip install zulip
INSTALL
IMPORT
SIG · ZULIP
Z
zulip
communicationpythonv0.9.1
Install
2.5s avg
Import
630ms
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.1 · 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.920 runs
installs and imports cleanly · install 0.0s · import 0.669s · 23.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.5s · import 0.591s · 24MB
22MB installed
● package 22MB
Code
Verified usage

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

Client
from zulip import Client
import zulip

Initializes the Zulip client using either a configuration file (like `~/.zuliprc`) or direct credentials, and then sends a stream message. For production, `~/.zuliprc` or environment variables are recommended for securely managing API keys and other credentials. Direct credentials are shown for quick testing, but should be replaced with environment variables for security.

import os import zulip # Best practice: configure via ~/.zuliprc or environment variables # For quick testing, you can pass credentials directly (less secure for production) # Ensure ZULIP_EMAIL, ZULIP_API_KEY, and ZULIP_SITE environment variables are set # or a ~/.zuliprc file exists. # Example using environment variables: # Initialize client from environment variables (or ~/.zuliprc) client = zulip.Client(config_file=os.environ.get('ZULIP_CONFIG_FILE', '~/.zuliprc')) # If using direct credentials for testing (replace with your actual bot/user details) # client = zulip.Client( # email=os.environ.get('ZULIP_EMAIL', 'bot-email@example.com'), # api_key=os.environ.get('ZULIP_API_KEY', 'your_api_key'), # site=os.environ.get('ZULIP_SITE', 'https://your-domain.zulipchat.com') # ) # Send a stream message message = { "type": "stream", "to": "general", "topic": "API Test", "content": "Hello from the Zulip Python API!" } try: result = client.send_message(message) if result['result'] == 'success': print("Message sent successfully!") else: print(f"Failed to send message: {result['msg']}") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
gotchaNaming a local file or directory 'zulip.py' or 'zulip' in your project can cause a module shadowing issue, leading to `AttributeError: module 'zulip' has no attribute 'Client'`.
fix
Rename your local file/directory to something other than `zulip` to avoid conflicts with the installed `zulip` package.
affects: All versions
breakingSome API queries beyond `send_message` are under active development. While they function, their interfaces or behaviors might change in future versions without major version bumps (as the library is pre-1.0.0).
fix
Consult the official Zulip API documentation and the `python-zulip-api` GitHub repository for the latest status of specific API endpoints. If using actively developed APIs, monitor the project's updates.
affects: 0.9.x
gotchaWhen handling API errors, always check the `response['code']` field for specific error conditions rather than `response['msg']`. The `msg` field is human-readable, internationalized, and its string content can change, making it unreliable for programmatic checks.
fix
Implement error handling logic that relies on the machine-readable `code` field in API responses.
affects: All versions
gotchaAPI success responses might include an `ignored_parameters_unsupported` array. This indicates parameters sent in the request that were not supported by the specific endpoint, potentially signaling a client bug or an attempt to use a new feature on an older Zulip server.
fix
Check for this array in responses and adjust your client code or ensure compatibility with the target Zulip server version.
affects: Zulip Server 7.0 (feature level 167) and later.
gotchaConfiguration for the `zulip.Client` can be provided via command-line options, environment variables (e.g., `ZULIP_API_KEY`, `ZULIP_EMAIL`, `ZULIP_SITE`), or a `~/.zuliprc` file. The precedence order is command-line > environment variables > config file.
fix
Be aware of this precedence when troubleshooting configuration issues. For bots, using a specific `zuliprc` file via `config_file='path/to/zuliprc'` is recommended.
affects: All versions
Upgrade
Version history
0.9.1latest on PyPI · released Sep 30, 2025
Audit
Dependencies
pythonrequiredRequired for the library to run.
requestsrequiredHTTP client for making API requests.
Agent activity
41 hits · last 30 days
node
36
OpenAI (training)
1
Resources