{"id":20535063,"url":"https://github.com/jhuntdev/blest-py","last_synced_at":"2026-02-12T15:31:40.455Z","repository":{"id":174512806,"uuid":"652344310","full_name":"jhuntdev/blest-py","owner":"jhuntdev","description":"The Python reference implementation of BLEST (Batch-able, Lightweight, Encrypted State Transfer), an improved communication protocol for web APIs which leverages JSON, supports request batching by default, and provides a modern alternative to REST.","archived":false,"fork":false,"pushed_at":"2024-12-29T17:51:45.000Z","size":39164,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T22:08:36.333Z","etag":null,"topics":["api","blest","client","django","fastapi","flask","python","server"],"latest_commit_sha":null,"homepage":"","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/jhuntdev.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}},"created_at":"2023-06-11T21:06:58.000Z","updated_at":"2024-12-29T17:51:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2b74b66-554c-4c6c-91d0-429758bd5099","html_url":"https://github.com/jhuntdev/blest-py","commit_stats":null,"previous_names":["jhuntdev/blest-py"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jhuntdev/blest-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhuntdev%2Fblest-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhuntdev%2Fblest-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhuntdev%2Fblest-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhuntdev%2Fblest-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhuntdev","download_url":"https://codeload.github.com/jhuntdev/blest-py/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhuntdev%2Fblest-py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29370546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"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":["api","blest","client","django","fastapi","flask","python","server"],"created_at":"2024-11-16T00:29:10.053Z","updated_at":"2026-02-12T15:31:40.437Z","avatar_url":"https://github.com/jhuntdev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BLEST Python\n\nThe Python reference implementation of BLEST (Batch-able, Lightweight, Encrypted State Transfer), an improved communication protocol for web APIs which leverages JSON, supports request batching by default, and provides a modern alternative to REST. It includes examples for Django, FastAPI, and Flask.\n\nTo learn more about BLEST, please visit the website: https://blest.jhunt.dev\n\nFor a front-end implementation in React, please visit https://github.com/jhuntdev/blest-react\n\n## Features\n\n- Built on JSON - Reduce parsing time and overhead\n- Request Batching - Save bandwidth and reduce load times\n- Compact Payloads - Save even more bandwidth\n- Single Endpoint - Reduce complexity and facilitate introspection\n- Fully Encrypted - Improve data privacy\n\n## Installation\n\nInstall BLEST Python from PyPI.\n\n```bash\npython3 -m pip install blest\n```\n\n## Usage\n\n### Router\n\nThe following example uses Flask, but you can find examples with other frameworks [here](examples).\n\n```python\nfrom flask import Flask, make_response, request\nfrom blest import Router\n\n# Instantiate the Router\nrouter = Router({ 'timeout': 1000 })\n\n# Create some middleware (optional)\n@router.before_request\nasync def user_middleware(body, context):\n  context['user'] = {\n    # user info for example\n  }\n  return\n\n# Create a route controller\n@router.route('greet')\nasync def greet_controller(body, context):\n  return {\n    'greeting': f\"Hi, {body['name']}!\"\n  }\n\n# Instantiate a Flask application\napp = Flask(__name__)\n\n# Handle BLEST requests\n@app.post('/')\nasync def index():\n  result, error = await router.handle(request.json, { 'httpHeaders': request.headers })\n  if error:\n    resp = make_response(error, error.status or 500)\n    resp.headers['Content-Type'] = 'application/json'\n  else:\n    resp = make_response(result, 200)\n    resp.headers['Content-Type'] = 'application/json'\n    return resp\n```\n\n### HttpClient\n\n```python\nfrom blest import HttpClient\n\nasync def main():\n  # Create a client\n  client = HttpClient('http://localhost:8080', {\n    'max_batch_size': 25,\n    'buffer_delay': 10,\n    'http_headers': {\n      'Authorization': 'Bearer token'\n    }\n  })\n\n  # Send a request\n  try:\n    result = await client.request('greet', { 'name': 'Steve' })\n    # Do something with the result\n  except Exception as error:\n    # Do something in case of error\n```\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhuntdev%2Fblest-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhuntdev%2Fblest-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhuntdev%2Fblest-py/lists"}