{"id":42254606,"url":"https://github.com/bandprotocol/membit-python","last_synced_at":"2026-01-27T05:18:35.055Z","repository":{"id":307443229,"uuid":"1025358217","full_name":"bandprotocol/membit-python","owner":"bandprotocol","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-31T08:05:33.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-31T10:27:35.828Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bandprotocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-24T06:20:34.000Z","updated_at":"2025-07-31T08:17:35.000Z","dependencies_parsed_at":"2025-08-04T12:31:47.046Z","dependency_job_id":null,"html_url":"https://github.com/bandprotocol/membit-python","commit_stats":null,"previous_names":["bandprotocol/membit-python"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/bandprotocol/membit-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bandprotocol%2Fmembit-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bandprotocol%2Fmembit-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bandprotocol%2Fmembit-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bandprotocol%2Fmembit-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bandprotocol","download_url":"https://codeload.github.com/bandprotocol/membit-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bandprotocol%2Fmembit-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28803650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T03:44:14.111Z","status":"ssl_error","status_checked_at":"2026-01-27T03:43:33.507Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-27T05:18:34.988Z","updated_at":"2026-01-27T05:18:35.048Z","avatar_url":"https://github.com/bandprotocol.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Membit Python Client\n\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/membit-python)](https://pypi.org/project/membit-python/)\n[![License](https://img.shields.io/github/license/bandprotocol/membit-python)](https://github.com/bandprotocol/membit-python/blob/main/LICENSE)\n\nThe Membit Python client provides powerful social media analytics and monitoring capabilities for your Python applications. Easily integrate trending discussion discovery, cluster analysis, and social post search with a simple and intuitive API.\n\n## Installation\n\n```bash\npip install membit-python\n```\n\nOr with uv:\n\n```bash\nuv add membit-python\n```\n\n## Quick Start\n\n### Basic Usage\n\n```python\nfrom membit import MembitClient\n\n# Initialize the client with API key\nclient = MembitClient(api_key=\"your_api_key_here\")\n\n# Or use environment variable MEMBIT_API_KEY\n# client = MembitClient()\n\n# Search for trending discussion clusters\nclusters = client.cluster_search(\"artificial intelligence\", limit=5)\nprint(clusters)\n```\n\n## Features\n\n### 🔥 Trending Discussion Clusters\n\nFind and analyze trending discussions across social platforms with intelligent clustering.\n\n### 🔍 Deep Cluster Analysis\n\nDive deeper into specific discussions to understand context and participants.\n\n### 📱 Social Post Search\n\nSearch for individual social media posts on specific topics.\n\n### ⚡ Async Support\n\nFull async/await support for high-performance applications.\n\n### 📊 Multiple Response Formats\n\nGet data in JSON format for applications or LLM-optimized text for AI workflows.\n\n## Usage Examples\n\n### Finding Trending Discussion Clusters\n\n```python\nfrom membit import MembitClient\n\n# Initialize client with API key\nclient = MembitClient(api_key=\"your_api_key_here\")\n# Or use environment variable MEMBIT_API_KEY\n# client = MembitClient()\n\n# Search for trending clusters\nclusters = client.cluster_search(\"artificial intelligence\", limit=5)\n\n# clusters is a dict containing trending discussion clusters\nfor cluster in clusters.get(\"clusters\", []):\n    print(f\"Cluster: {cluster['label']}\")\n```\n\n### Getting Detailed Cluster Information\n\n```python\nfrom membit import MembitClient\n\n# Initialize client with API key\nclient = MembitClient(api_key=\"your_api_key_here\")\n\n# First, find clusters\nclusters = client.cluster_search(\"climate change\")\n\n# Get detailed info about the first cluster\nif clusters.get(\"clusters\"):\n    cluster_label = clusters[\"clusters\"][0][\"label\"]\n    cluster_details = client.cluster_info(label=cluster_label, limit=10)\n    print(cluster_details)\n```\n\n### Searching for Individual Posts\n\n```python\nfrom membit import MembitClient\n\n# Initialize client with API key\nclient = MembitClient(api_key=\"your_api_key_here\")\n\n# Search for specific social posts\nposts = client.post_search(\"machine learning breakthrough\", limit=20)\n\n# Access individual social media posts\nfor post in posts.get(\"posts\", []):\n    print(f\"Post: {post}\")\n```\n\n### Using Different Response Formats\n\n```python\nfrom membit import MembitClient\n\n# Initialize client with API key\nclient = MembitClient(api_key=\"your_api_key_here\")\n\n# Get JSON response (default)\njson_response = client.cluster_search(\"space exploration\", output_format=\"json\")\n# Returns: dict with structured data\n\n# Get LLM-optimized text response\nllm_response = client.cluster_search(\"space exploration\", output_format=\"llm\")\n# Returns: str with formatted text optimized for AI processing\n```\n\n## Async Support\n\nFor applications that need high performance or handle multiple concurrent requests:\n\n```python\nimport asyncio\nfrom membit import AsyncMembitClient\n\nasync def analyze_topics():\n    client = AsyncMembitClient(api_key=\"your_api_key_here\")\n\n    # Search for trending clusters asynchronously\n    clusters = await client.cluster_search(\"tech news\", limit=5)\n\n    # Get detailed info for multiple clusters concurrently\n    if clusters.get(\"clusters\"):\n        tasks = [\n            client.cluster_info(label=cluster[\"label\"])\n            for cluster in clusters[\"clusters\"][:3]\n        ]\n        cluster_details = await asyncio.gather(*tasks)\n\n        for details in cluster_details:\n            print(details)\n\n# Run the async function\nasyncio.run(analyze_topics())\n```\n\n## API Reference\n\n### `MembitClient(api_key=None, api_url=None)`\n\nInitialize the Membit client.\n\n**Parameters:**\n\n- `api_key` (str, optional): Your Membit API key. If not provided, uses `MEMBIT_API_KEY` environment variable.\n- `api_url` (str, optional): Custom API URL. Uses default Membit API URL if not provided.\n\n---\n\n### `cluster_search(q, limit=10, output_format=\"json\", timeout=60)`\n\nGet trending discussions across social platforms. Useful for finding topics of interest and understanding live conversations.\n\n**Parameters:**\n\n- `q` (str): Search query string\n- `limit` (int, optional): Maximum number of results to return (default: 10)\n- `output_format` (str, optional): Response format - `\"json\"` or `\"llm\"` (default: `\"json\"`)\n- `timeout` (int, optional): Request timeout in seconds (default: 60, max: 120)\n\n**Returns:**\n\n- `dict`: Trending discussion clusters (when `output_format=\"json\"`)\n- `str`: Formatted text response (when `output_format=\"llm\"`)\n\n---\n\n### `cluster_info(label, limit=10, output_format=\"json\", timeout=60)`\n\nDive deeper into a specific trending discussion cluster. Useful for understanding the context and participants of a particular conversation.\n\n**Parameters:**\n\n- `label` (str): Cluster label obtained from `cluster_search`\n- `limit` (int, optional): Maximum number of results to return (default: 10)\n- `output_format` (str, optional): Response format - `\"json\"` or `\"llm\"` (default: `\"json\"`)\n- `timeout` (int, optional): Request timeout in seconds (default: 60, max: 120)\n\n**Returns:**\n\n- `dict`: Detailed cluster information (when `output_format=\"json\"`)\n- `str`: Formatted text response (when `output_format=\"llm\"`)\n\n---\n\n### `post_search(q, limit=10, output_format=\"json\", timeout=60)`\n\nSearch for raw social posts. Useful when you need to find specific posts (not recommended for finding trending discussions).\n\n**Parameters:**\n\n- `q` (str): Search query string\n- `limit` (int, optional): Maximum number of results to return (default: 10)\n- `output_format` (str, optional): Response format - `\"json\"` or `\"llm\"` (default: `\"json\"`)\n- `timeout` (int, optional): Request timeout in seconds (default: 60, max: 120)\n\n**Returns:**\n\n- `dict`: Raw social posts (when `output_format=\"json\"`)\n- `str`: Formatted text response (when `output_format=\"llm\"`)\n\n## Error Handling\n\nThe client includes comprehensive error handling:\n\n```python\nfrom membit import MembitClient, MissingAPIKeyError\n\ntry:\n    # Initialize client with API key\n    client = MembitClient(api_key=\"your_api_key_here\")\n\n    result = client.cluster_search(\"python programming\")\n\nexcept MissingAPIKeyError:\n    print(\"Please provide a valid API key\")\n\nexcept TimeoutError:\n    print(\"Request timed out\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n```\n\n## Requirements\n\n- **Python:** \u003e=3.10\n- **Dependencies:**\n  - `requests\u003e=2.25.0` (for synchronous client)\n  - `httpx\u003e=0.28.1` (for asynchronous client)\n\n## Examples\n\nComplete working examples are available in the `examples/` directory:\n\n- [`examples/client.py`](examples/client.py) - Synchronous client usage\n- [`examples/async_client.py`](examples/async_client.py) - Asynchronous client usage\n\n### Running Examples\n\n```bash\n# Set your API key\nexport MEMBIT_API_KEY=\"your_api_key_here\"\n\n# Install dependencies\nuv sync\n\n# Run synchronous example\nuv run examples/client.py\n\n# Run asynchronous example\nuv run examples/async_client.py\n```\n\n## Development\n\n### Installing for Development\n\n```bash\ngit clone \u003crepository-url\u003e\ncd membit-python\nuv sync\n```\n\n### Running Tests\n\n```bash\nuv run pytest\n```\n\n## Contributing\n\nWe welcome contributions! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Support\n\nFor support or questions about the Membit Python client, please reach out to our support team.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbandprotocol%2Fmembit-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbandprotocol%2Fmembit-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbandprotocol%2Fmembit-python/lists"}