General purpose server framework in Python
Project description
bamboo
Installling
- Python: >= 3.8
$ python -m pip install git+https://github.com/jjj999/bamboo.git
Usage
詳細なドキュメントはこちらを参照してください.以下は簡単な実装例です.
from wsgiref.simple_server import make_server
from bamboo import App, Endpoint
app = App()
@app.route("hello")
class MockEndpoint(Endpoint):
def do_GET(self) -> None:
self.send_body(b"Hello, World!")
if __name__ == "__main__":
server = make_server("", 8000, app)
try:
print("Hosting on port 8000...")
server.serve_forever()
except KeyboardInterrupt:
server.server_close()
print()
実行後,ブラウザで http://localhost:8000/hello にアクセスしてみましょう.
API documentation
Bamboo の API ドキュメントはこちら.
Examples
upsidedown
リクエストされた文字列を逆順に反転させて返すアプリケーションです.
image_traffic
アクセスに対して静的な画像を返すアプリケーションです.
tweets
CLI ベースの簡易的な Twitter のような投稿アプリです.認証機能は実装されていません.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bamboo_core-0.3.0.tar.gz
(30.3 kB
view hashes)
Built Distribution
Close
Hashes for bamboo_core-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 950a5d6dfed288036fda5e0caf47ee3e4e0f83680b38870509a67ffda5098c39 |
|
MD5 | 1fde80c8f1f99239b9097264c67ed7e8 |
|
BLAKE2b-256 | 45c99bcaaebd29ab6976327f210ef238c015ede8375b1bea132e42f283554e4c |