{"id":13502357,"url":"https://github.com/flask-api/flask-api","last_synced_at":"2025-05-14T13:05:58.996Z","repository":{"id":14156510,"uuid":"16862339","full_name":"flask-api/flask-api","owner":"flask-api","description":"Browsable web APIs for Flask.","archived":false,"fork":false,"pushed_at":"2025-05-13T06:12:16.000Z","size":1772,"stargazers_count":1455,"open_issues_count":17,"forks_count":189,"subscribers_count":45,"default_branch":"develop","last_synced_at":"2025-05-13T07:25:12.808Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://flask-api.github.io/flask-api/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flask-api.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2014-02-15T12:27:34.000Z","updated_at":"2025-05-12T21:41:57.000Z","dependencies_parsed_at":"2023-12-06T09:31:37.502Z","dependency_job_id":"115bb678-e365-4968-86b6-dfaf1e2ec5de","html_url":"https://github.com/flask-api/flask-api","commit_stats":{"total_commits":207,"total_committers":33,"mean_commits":"6.2727272727272725","dds":0.6135265700483092,"last_synced_commit":"b1d3ccf5ec54a9faf6136af01f626fdff0226a7d"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flask-api%2Fflask-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flask-api%2Fflask-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flask-api%2Fflask-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flask-api%2Fflask-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flask-api","download_url":"https://codeload.github.com/flask-api/flask-api/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254149948,"owners_count":22022851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-07-31T22:02:11.418Z","updated_at":"2025-05-14T13:05:58.973Z","avatar_url":"https://github.com/flask-api.png","language":"Python","readme":"# Flask API\n\nBrowsable web APIs for Flask.\n\n[![Coverage Status](https://img.shields.io/coveralls/flask-api/flask-api.svg)](https://coveralls.io/r/flask-api/flask-api)\n[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/flask-api/flask-api.svg)](https://scrutinizer-ci.com/g/flask-api/flask-api/)\n[![PyPI Version](https://img.shields.io/pypi/v/Flask-API.svg)](https://pypi.org/project/Flask-API/)\n\n**Status**: This project is in maintenance mode. The original author ([Tom Christie](https://twitter.com/_tomchristie)) has shifted his focus to [API Star](https://github.com/encode/apistar). Passing PRs will still be considered for releases by the maintainer ([Jace Browning](https://twitter.com/jacebrowning)).\n\n## Overview\n\nFlask API is a drop-in replacement for Flask that provides an implementation of browsable APIs similar to what [Django REST framework](http://www.django-rest-framework.org) offers. It gives you properly content-negotiated responses and smart request parsing:\n\n![Screenshot](docs/screenshot.png)\n\n## Installation\n\nRequirements:\n\n* Python 3.6+\n* Flask 1.1.+\n\nInstall using `pip`:\n\n```shell\n$ pip install Flask-API\n```\n\nImport and initialize your application:\n\n```python\nfrom flask_api import FlaskAPI\n\napp = FlaskAPI(__name__)\n```\n\n## Responses\n\nReturn any valid response object as normal, or return a `list` or `dict`.\n\n```python\n@app.route('/example/')\ndef example():\n    return {'hello': 'world'}\n```\n\nA renderer for the response data will be selected using content negotiation based on the client 'Accept' header. If you're making the API request from a regular client, this will default to a JSON response. If you're viewing the API in a browser, it'll default to the browsable API HTML.\n\n## Requests\n\nAccess the parsed request data using `request.data`.  This will handle JSON or form data by default.\n\n```python\n@app.route('/example/')\ndef example():\n    return {'request data': request.data}\n```\n\n## Example\n\nThe following example demonstrates a simple API for creating, listing, updating and deleting notes.\n\n```python\nfrom flask import request, url_for\nfrom flask_api import FlaskAPI, status, exceptions\n\napp = FlaskAPI(__name__)\n\n\nnotes = {\n    0: 'do the shopping',\n    1: 'build the codez',\n    2: 'paint the door',\n}\n\ndef note_repr(key):\n    return {\n        'url': request.host_url.rstrip('/') + url_for('notes_detail', key=key),\n        'text': notes[key]\n    }\n\n\n@app.route(\"/\", methods=['GET', 'POST'])\ndef notes_list():\n    \"\"\"\n    List or create notes.\n    \"\"\"\n    if request.method == 'POST':\n        note = str(request.data.get('text', ''))\n        idx = max(notes.keys()) + 1\n        notes[idx] = note\n        return note_repr(idx), status.HTTP_201_CREATED\n\n    # request.method == 'GET'\n    return [note_repr(idx) for idx in sorted(notes.keys())]\n\n\n@app.route(\"/\u003cint:key\u003e/\", methods=['GET', 'PUT', 'DELETE'])\ndef notes_detail(key):\n    \"\"\"\n    Retrieve, update or delete note instances.\n    \"\"\"\n    if request.method == 'PUT':\n        note = str(request.data.get('text', ''))\n        notes[key] = note\n        return note_repr(key)\n\n    elif request.method == 'DELETE':\n        notes.pop(key, None)\n        return '', status.HTTP_204_NO_CONTENT\n\n    # request.method == 'GET'\n    if key not in notes:\n        raise exceptions.NotFound()\n    return note_repr(key)\n\n\nif __name__ == \"__main__\":\n    app.run(debug=True)\n```\n\nNow run the webapp:\n\n```shell\n$ python ./example.py\n * Running on http://127.0.0.1:5000/\n * Restarting with reloader\n```\n\nYou can now open a new tab and interact with the API from the command line:\n\n```shell\n$ curl -X GET http://127.0.0.1:5000/\n[{\"url\": \"http://127.0.0.1:5000/0/\", \"text\": \"do the shopping\"},\n {\"url\": \"http://127.0.0.1:5000/1/\", \"text\": \"build the codez\"},\n {\"url\": \"http://127.0.0.1:5000/2/\", \"text\": \"paint the door\"}]\n\n$ curl -X GET http://127.0.0.1:5000/1/\n{\"url\": \"http://127.0.0.1:5000/1/\", \"text\": \"build the codez\"}\n\n$ curl -X PUT http://127.0.0.1:5000/1/ -d text=\"flask api is teh awesomez\"\n{\"url\": \"http://127.0.0.1:5000/1/\", \"text\": \"flask api is teh awesomez\"}\n```\n\nYou can also work on the API directly in your browser, by opening \u003chttp://127.0.0.1:5000/\u003e.  You can then navigate between notes, and make `GET`, `PUT`, `POST` and `DELETE` API requests.\n","funding_links":[],"categories":["Python","RESTful API","others","Flask Utilities","RESTful API [🔝](#readme)","Web Frameworks \u0026 RESTful API"],"sub_categories":["Drone Frames"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflask-api%2Fflask-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflask-api%2Fflask-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflask-api%2Fflask-api/lists"}