{"id":17279637,"url":"https://github.com/ifplusor/ahserver","last_synced_at":"2026-04-29T08:02:12.097Z","repository":{"id":87877779,"uuid":"182208563","full_name":"ifplusor/ahserver","owner":"ifplusor","description":"a lightweight python http server","archived":false,"fork":false,"pushed_at":"2021-02-21T06:21:13.000Z","size":214,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T14:53:14.657Z","etag":null,"topics":["http-server","python3"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ifplusor.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":"2019-04-19T05:44:12.000Z","updated_at":"2020-09-17T02:07:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"25a1a76a-6ef1-4730-9208-fff9aa1c779a","html_url":"https://github.com/ifplusor/ahserver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ifplusor/ahserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifplusor%2Fahserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifplusor%2Fahserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifplusor%2Fahserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifplusor%2Fahserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ifplusor","download_url":"https://codeload.github.com/ifplusor/ahserver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifplusor%2Fahserver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32416146,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["http-server","python3"],"created_at":"2024-10-15T09:18:10.235Z","updated_at":"2026-04-29T08:02:12.061Z","avatar_url":"https://github.com/ifplusor.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AHServer\n\nAHServer is a lightweight asynchronous http server, implement both WSGI and ASGI specifications.\n\n## Example\n\n### WSGI: Flash\n\n```python\n# encoding=utf-8\n\nif __name__ == \"__main__\":\n    import asyncio\n    import uvloop\n\n    from ahserver.application.wsgi import server\n\n    # 设置 uvloop\n    asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())\n\n    # 启动服务\n    server(__file__ + \":app\", worker_nums=1)\nelse:\n\n    def create_application():\n        from flask import Flask, Response, request\n\n        app = Flask(__name__)\n\n        @app.route(\"/hello\")\n        def hello_world():\n            return Response(\"Hello, welcome to Flask world!\\n\", mimetype=\"text/plain\")\n\n        @app.route(\"/post\", methods=[\"POST\"])\n        def get_user_posts():\n            data = request.get_data()\n            return data\n\n        return app.wsgi_app\n\n    app = create_application()\n\n```\n\n### ASGI: FastAPI\n\n```python\n# encoding=utf-8\n\nif __name__ == \"__main__\":\n    import asyncio\n    import uvloop\n\n    from ahserver.application.asgi import server\n\n    # 设置 uvloop\n    asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())\n\n    # 启动服务\n    server(__file__ + \":app\", worker_nums=1)\nelse:\n\n    def create_application():\n        from typing import Optional\n        from fastapi import FastAPI, Body\n\n        app = FastAPI()\n\n        @app.get(\"/\")\n        def read_root():\n            return {\"Hello\": \"World\"}\n\n        @app.get(\"/items/{item_id}\")\n        def read_item(item_id: int, q: Optional[str] = None):\n            return {\"item_id\": item_id, \"q\": q}\n\n        @app.post(\"/post\")\n        def read_body(body=Body(...)):\n            return body\n\n        return app\n\n    app = create_application()\n\n```\n\n## CLI\n\n### WSGI: ahwsgi\n\n```text\nUsage: ahwsgi [options] module:callable\n\nOptions:\n  --version             show program's version number and exit\n  -h, --help            show this help message and exit\n  -H HOST, --addr=HOST  listen address\n  -P PORT, --port=PORT  listen port\n  -n NUM, --worker-nums=NUM\n                        worker number\n  -t NUM, --thread-nums=NUM\n                        thread number\n  --https               enable https mode\n  --cert-path=PATH      cert file path\n  --key-path=PATH       key file path\n  --disable-uvloop      diable uvloop\n```\n\n### ASGI: ahasgi\n\n```text\nUsage: ahasgi [options] module:callable\n\nOptions:\n  --version             show program's version number and exit\n  -h, --help            show this help message and exit\n  -H HOST, --addr=HOST  listen address\n  -P PORT, --port=PORT  listen port\n  -n NUM, --worker-nums=NUM\n                        worker number\n  --https               enable https mode\n  --cert-path=PATH      cert file path\n  --key-path=PATH       key file path\n  --disable-uvloop      diable uvloop\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fifplusor%2Fahserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fifplusor%2Fahserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fifplusor%2Fahserver/lists"}