{"id":6490,"library":"zulip","title":"Zulip Python API Client","description":"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.","status":"active","version":"0.9.1","language":"python","source_language":"en","source_url":"https://github.com/zulip/python-zulip-api/","tags":["api-client","messaging","chat","bot","collaboration"],"install":[{"cmd":"pip install zulip","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Required for the library to run.","package":"python","version":">=3.9"},{"reason":"HTTP client for making API requests.","package":"requests","version":">=0.12.1"}],"imports":[{"wrong":"import zulip","symbol":"Client","correct":"from zulip import Client"}],"quickstart":{"code":"import os\nimport zulip\n\n# Best practice: configure via ~/.zuliprc or environment variables\n# For quick testing, you can pass credentials directly (less secure for production)\n# Ensure ZULIP_EMAIL, ZULIP_API_KEY, and ZULIP_SITE environment variables are set\n# or a ~/.zuliprc file exists.\n# Example using environment variables:\n\n# Initialize client from environment variables (or ~/.zuliprc)\nclient = zulip.Client(config_file=os.environ.get('ZULIP_CONFIG_FILE', '~/.zuliprc'))\n\n# If using direct credentials for testing (replace with your actual bot/user details)\n# client = zulip.Client(\n#     email=os.environ.get('ZULIP_EMAIL', 'bot-email@example.com'),\n#     api_key=os.environ.get('ZULIP_API_KEY', 'your_api_key'),\n#     site=os.environ.get('ZULIP_SITE', 'https://your-domain.zulipchat.com')\n# )\n\n# Send a stream message\nmessage = {\n    \"type\": \"stream\",\n    \"to\": \"general\",\n    \"topic\": \"API Test\",\n    \"content\": \"Hello from the Zulip Python API!\"\n}\n\ntry:\n    result = client.send_message(message)\n    if result['result'] == 'success':\n        print(\"Message sent successfully!\")\n    else:\n        print(f\"Failed to send message: {result['msg']}\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"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."},"warnings":[{"fix":"Rename your local file/directory to something other than `zulip` to avoid conflicts with the installed `zulip` package.","message":"Naming 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'`.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Some 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).","severity":"breaking","affected_versions":"0.9.x"},{"fix":"Implement error handling logic that relies on the machine-readable `code` field in API responses.","message":"When 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Check for this array in responses and adjust your client code or ensure compatibility with the target Zulip server version.","message":"API 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.","severity":"gotcha","affected_versions":"Zulip Server 7.0 (feature level 167) and later."},{"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.","message":"Configuration 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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'0.9.1':73 'activ':59 'api':3,17,39,87 'api-cli':86 'applic':20 'authent':29 'best':55 'best-docu':54 'bind':12 'bot':91 'broader':83 'chat':90 'client':4,11,57,88 'collabor':92 'complet':52 'consid':49 'continu':77 'conveni':34 'core':45 'current':70 'develop':60,78 'document':56 'enabl':18 'endpoint':40 'featur':63 'format':31 'handl':28 'interact':22 'librari':8,58 'line':80 'maintain':41 'messag':16,89 'method':36 'offer':33 'offici':10 'project':85 'provid':9 'pypi':75 'python':2,7,19 'request':30 'server':26,67 'support':62 'team':46 'various':38 'version':68,71 'wrapper':35 'zulip':1,6,15,25,44,66,84","created_at":"2026-04-15T05:39:34.521916+00:00","updated_at":"2026-04-17T01:22:48.083891+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.9.1","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.zulip.org/","github":"https://github.com/zulip/python-zulip-api","docs":"https://zulip.com/api","changelog":null,"pypi":"https://pypi.org/project/zulip/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["communication"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}