Browse JSON API in a HTML interface.

Overview

Falcon API Browse

This project provides a middleware for Falcon Web Framework that will render the response in an HTML form for documentation purpose. It uses the docstring from the Resource object and all the supported HTTP methods for the resource.

It is inspired by Django Rest Framework's Browsable API and is written using jinja2 templating language.

Installing

This project is currently in early stages of development. Once it is stable enough to be used by other projects, it will be provided via PyPI.

pip install git+https://github.com/maxking/falcon-api-browse

Using

Since this is a middleware for Falcon, you can use it by passing an initialized instance during Falcon App creation.

from falcon import App
from falcon_api_browse import HTMLResponseMiddleware

app = App(middleware=HTMLResponseMiddleware())

Examples

There are some runnable examples in examples/ directory.

LICENSE

This project and contents of this repo are licensed under Apache 2.0 License.

Comments
  • JSON from `resp.media` is not recognized

    JSON from `resp.media` is not recognized

    It seems this only works as expected if JSON is rendered via resp.text; however, the most idiomatic and succinct way of writing a JSON API is by leveraging req.get_media() and resp.media.

    Test case used:

    import falcon
    from falcon_api_browse import HTMLResponseMiddleware
    
    
    class Hello:
        def on_get(self, req, resp):
            resp.media = {'message': 'Hello, World!', 'cool': True}
    
    
    app = falcon.App(middleware=[HTMLResponseMiddleware()])
    app.add_route('/hello', Hello())
    
    enhancement 
    opened by vytas7 4
  • No module named `importlib_resources`

    No module named `importlib_resources`

    It seems that some dependencies are required, but not listed:

      File "/tmp/test.py", line 2, in <module>
        from falcon_api_browse import HTMLResponseMiddleware
      File "/tmp/venv/lib/python3.8/site-packages/falcon_api_browse/__init__.py", line 1, in <module>
        from falcon_api_browse.middleware import HTMLResponseMiddleware
      File "/tmp/venv/lib/python3.8/site-packages/falcon_api_browse/middleware.py", line 1, in <module>
        from falcon_api_browse.views import html_response
      File "/tmp/venv/lib/python3.8/site-packages/falcon_api_browse/views.py", line 4, in <module>
        from importlib_resources import files
    ModuleNotFoundError: No module named 'importlib_resources'
    
    bug 
    opened by vytas7 1
  • Add an explicit dependency on importlib-resources.

    Add an explicit dependency on importlib-resources.

    On newer version of Python, this is a stdlib package, but the API still differs in different version. Adding a dependeny on this makes it usable on all Python version while it handles noop operation on Python versions that have the same API as this package.

    Fixes #4

    opened by maxking 0
  • ASGI support

    ASGI support

    Since HTMLResponseMiddleware doesn't seem to perform any taxing I/O, one could implement ASGI support by simply wrapping the current logic via async def process_response_async(...).

    enhancement 
    opened by vytas7 0
  • Add some CSS to the default template

    Add some CSS to the default template

    The current default template is very vanilla, it could use some styling support with CSS. We could also urlize some of the urls, although it doesn't seem to work with the default urlize function for whatever reason (probably, because URLs are strings with "<url>" enclosing quotes that throws off their regex matcher.

    enhancement help wanted 
    opened by maxking 0
  • Verify the response's content_type before assuming it is JSON

    Verify the response's content_type before assuming it is JSON

    We currently assume that the response is JSON, but it can be anything like HTML, msgpack etc. We should not make this assumption and add some guard to verify the response's content_type.

    enhancement help wanted good first issue 
    opened by maxking 0
Releases(0.1.0)
  • 0.1.0(Mar 14, 2022)

Owner
Abhilash Raj
GNU Mailman lead developer. @python core dev. I have code over at https://gitlab.com/maxking
Abhilash Raj
Keepalive - Discord Bot to keep threads from expiring

keepalive Discord Bot to keep threads from expiring Installation Create a new Di

Francesco Pierfederici 5 Mar 14, 2022
FastAPI Socket.io with first-class documentation using AsyncAPI

fastapi-sio Socket.io FastAPI integration library with first-class documentation using AsyncAPI The usage of the library is very familiar to the exper

Marián Hlaváč 9 Jan 02, 2023
FastAPI application and service structure for a more maintainable codebase

Abstracting FastAPI Services See this article for more information: https://camillovisini.com/article/abstracting-fastapi-services/ Poetry poetry inst

Camillo Visini 309 Jan 04, 2023
A fast and durable Pub/Sub channel over Websockets. FastAPI + WebSockets + PubSub == ⚡ 💪 ❤️

⚡ 🗞️ FastAPI Websocket Pub/Sub A fast and durable Pub/Sub channel over Websockets. The easiest way to create a live publish / subscribe multi-cast ov

8 Dec 06, 2022
Practice-python is a simple Fast api project for dealing with modern rest api technologies.

Practice Python Practice-python is a simple Fast api project for dealing with modern rest api technologies. Deployment with docker Go to the project r

0 Sep 19, 2022
Complete Fundamental to Expert Codes of FastAPI for creating API's

FastAPI FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3 based on standard Python type hints. The key featu

Pranav Anand 1 Nov 28, 2021
FastAPI IPyKernel Sandbox

FastAPI IPyKernel Sandbox This repository is a light-weight FastAPI project that is meant to provide a wrapper around IPyKernel interactions. It is in

Nick Wold 2 Oct 25, 2021
Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application.

Flask-Bcrypt Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application. Due to the recent increased prevelance of

Max Countryman 310 Dec 14, 2022
API written using Fast API to manage events and implement a leaderboard / badge system.

Open Food Facts Events API written using Fast API to manage events and implement a leaderboard / badge system. Installation To run the API locally, ru

Open Food Facts 5 Jan 07, 2023
fastapi-mqtt is extension for MQTT protocol

fastapi-mqtt MQTT is a lightweight publish/subscribe messaging protocol designed for M2M (machine to machine) telemetry in low bandwidth environments.

Sabuhi 144 Dec 28, 2022
SQLAlchemy Admin for Starlette/FastAPI

SQLAlchemy Admin for Starlette/FastAPI SQLAdmin is a flexible Admin interface for SQLAlchemy models. Main features include: SQLAlchemy sync/async engi

Amin Alaee 683 Jan 03, 2023
Flask-vs-FastAPI - Understanding Flask vs FastAPI Web Framework. A comparison of two different RestAPI frameworks.

Flask-vs-FastAPI Understanding Flask vs FastAPI Web Framework. A comparison of two different RestAPI frameworks. IntroductionIn Flask is a popular mic

Mithlesh Navlakhe 1 Jan 01, 2022
Light, Flexible and Extensible ASGI API framework

Starlite Starlite is a light and flexible ASGI API framework. Using Starlette and pydantic as foundations. Check out the Starlite documentation 📚 Cor

1.5k Jan 04, 2023
A dynamic FastAPI router that automatically creates CRUD routes for your models

⚡ Create CRUD routes with lighting speed ⚡ A dynamic FastAPI router that automatically creates CRUD routes for your models

Adam Watkins 950 Jan 08, 2023
REST API with FastAPI and JSON file.

FastAPI RESTAPI with a JSON py 3.10 First, to install all dependencies, in ./src/: python -m pip install -r requirements.txt Second, into the ./src/

Luis Quiñones Requelme 1 Dec 15, 2021
Qwerkey is a social media platform for connecting and learning more about mechanical keyboards built on React and Redux in the frontend and Flask in the backend on top of a PostgreSQL database.

Flask React Project This is the backend for the Flask React project. Getting started Clone this repository (only this branch) git clone https://github

Peter Mai 22 Dec 20, 2022
Keycloak integration for Python FastAPI

FastAPI Keycloak Integration Documentation Introduction Welcome to fastapi-keycloak. This projects goal is to ease the integration of Keycloak (OpenID

Code Specialist 113 Dec 31, 2022
Simple FastAPI Example : Blog API using FastAPI : Beginner Friendly

fastapi_blog FastAPI : Simple Blog API with CRUD operation Steps to run the project: git clone https://github.com/mrAvi07/fastapi_blog.git cd fastapi-

Avinash Alanjkar 1 Oct 08, 2022
Stac-fastapi built on Tile38 and Redis to support caching

stac-fastapi-caching Stac-fastapi built on Tile38 to support caching. This code is built on top of stac-fastapi-elasticsearch 0.1.0 with pyle38, a Pyt

Jonathan Healy 4 Apr 11, 2022
cookiecutter template for web API with python

Python project template for Web API with cookiecutter What's this This provides the project template including minimum test/lint/typechecking package

Hitoshi Manabe 4 Jan 28, 2021