{"id":21571082,"url":"https://github.com/treblle/treblle-flask","last_synced_at":"2025-04-10T14:20:31.833Z","repository":{"id":129657799,"uuid":"608235993","full_name":"Treblle/treblle-flask","owner":"Treblle","description":"The official Treblle SDK for Flask. Seamlessly integrate Treblle to manage communication with your dashboard, send errors, and secure sensitive data.","archived":false,"fork":false,"pushed_at":"2024-12-15T20:08:20.000Z","size":19,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-24T13:01:38.423Z","etag":null,"topics":["api","api-monitoring","api-observability","backend","developer-tool","flask","flask-api","logging","python","rest-api","restful-api","sdk","treblle","treblle-sdk"],"latest_commit_sha":null,"homepage":"https://www.treblle.com/","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/Treblle.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-03-01T15:47:50.000Z","updated_at":"2024-12-20T03:11:31.000Z","dependencies_parsed_at":"2024-12-15T21:19:07.380Z","dependency_job_id":"30ff0e9c-076c-45d0-a8c8-0607e90c8338","html_url":"https://github.com/Treblle/treblle-flask","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Treblle","download_url":"https://codeload.github.com/Treblle/treblle-flask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248233935,"owners_count":21069493,"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":["api","api-monitoring","api-observability","backend","developer-tool","flask","flask-api","logging","python","rest-api","restful-api","sdk","treblle","treblle-sdk"],"created_at":"2024-11-24T11:14:50.370Z","updated_at":"2025-04-10T14:20:31.827Z","avatar_url":"https://github.com/Treblle.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/b268ae9e-7c8a-4ade-95da-b4ac6fce6eea\"/\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n\n# Treblle\n\n\u003ca href=\"https://docs.treblle.com/en/integrations\" target=\"_blank\"\u003eIntegrations\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"http://treblle.com/\" target=\"_blank\"\u003eWebsite\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://docs.treblle.com\" target=\"_blank\"\u003eDocs\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://blog.treblle.com\" target=\"_blank\"\u003eBlog\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://twitter.com/treblleapi\" target=\"_blank\"\u003eTwitter\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://treblle.com/chat\" target=\"_blank\"\u003eDiscord\u003c/a\u003e\n\u003cbr /\u003e\n\n  \u003chr /\u003e\n\u003c/div\u003e\n\nAPI Intelligence Platform. 🚀\n\nTreblle is a lightweight SDK that helps Engineering and Product teams build, ship \u0026 maintain REST-based APIs faster.\n\n## Features\n\n\u003cdiv align=\"center\"\u003e\n  \u003cbr /\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/02afd9f5-ab47-48ff-929a-0f3fcddcca34\"/\u003e\n  \u003cbr /\u003e\n  \u003cbr /\u003e\n\u003c/div\u003e\n\n- [API Monitoring \u0026 Observability](https://www.treblle.com/features/api-monitoring-observability)\n- [Auto-generated API Docs](https://www.treblle.com/features/auto-generated-api-docs)\n- [API analytics](https://www.treblle.com/features/api-analytics)\n- [Treblle API Score](https://www.treblle.com/features/api-quality-score)\n- [API Lifecycle Collaboration](https://www.treblle.com/features/api-lifecycle)\n- [Native Treblle Apps](https://www.treblle.com/features/native-apps)\n\n\n## treblle-flask\n\nTreblle makes it super easy to understand what’s going on with your APIs and the apps that use them.\nJust by adding Treblle to your API out of the box you get:\n\n- Real-time API monitoring and logging\n- Auto-generated API docs with OAS support\n- API analytics\n- Quality scoring\n- One-click testing\n- API management on the go and more...\n\n\n## Requirements\n\n- python 3.7+\n- aiohttp\n\n## Basic Usage\n\nYou can use Treblle with Flask by importing the Treblle class and passing your Flask app to the constructor, \nalong with your Treblle API key and project ID.\n\n```python\nfrom flask import Flask\nfrom treblle_flask import Treblle\n\napp = Flask(__name__)\nTreblle(app, TREBLLE_API_KEY=\"YOUR_API_KEY\", TREBLLE_PROJECT_ID=\"YOUR_PROJECT_ID\")\n\n@app.route('/hello')\ndef hello():\n    return {\"hello\": \"world\"}\n```\n\nAlternatively, set the following environment variables to configure Treblle without passing any arguments to the \nTreblle constructor:\n\n- `TREBLLE_API_KEY`: Your Treblle API key\n- `TREBLLE_PROJECT_ID`: Your Treblle project ID\n\nThat's it! You're all set to start monitoring your API with Treblle.\n\n\n## Advanced Usage\n\nA number of optional configuration options are available to customize the behavior of Treblle extension:\n\n- `hidden_keys`: A list of keys that should be hidden from the request/response payloads in the Treblle dashboard. \n  Treblle will automatically hide any keys that contain the strings in this list, or use a default list with common\n  sensitive keys if this option is not provided.\n- `mask_auth_header`: A boolean flag that determines whether the Authorization header should be masked in the Treblle\n  dashboard. The default value is `True`. Masking the Authorization header will keep the auth type (e.g. Bearer),\n  visible, but will replace the actual secret with asterisks. If you intend to fo fully hide the header including the\n  directive, just include it in the `hidden_keys` argument.\n- `limit_request_body_size`: The maximum size of the request body that Treblle will attempt to capture. If the request\n  body exceeds this size, it will be ignored to prevent excessive memory usage. The default value is 4MiB.\n- `request_transformer`: A request body transformer function. If passed, this function will receive the original \n  request body as a bytestring, and should return a JSON-serializable object that will be sent to Treblle. You can use\n  this function to mask sensitive data in a more customized fashion, remove excess data you don't wish to be logged,\n  or perform any other transformations you require.\n  - **Important:** This function will cause the entire request body to be loaded into memory.\n  - **Important:** Using this function will override the default request body parsing logic - if the request body is a\n    JSON-encoded string, transformer must return a parsed JSON object, not the string itself.\n- `response_transformer`: A response body transformer function. If passed, this function will receive the original \n  response body as a bytestring, and should return a JSON-serializable object that will be sent to Treblle. You can use\n  this function to mask sensitive data in a more customized fashion, remove excess data you don't wish to be logged,\n  or perform any other transformations you require. \n  - **Important:** This function will not trigger for streaming responses.\n  - **Important:** Using this function will override the default request body parsing logic - if the response body is a\n    JSON-encoded string, transformer must return a parsed JSON object, not the string itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreblle%2Ftreblle-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftreblle%2Ftreblle-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreblle%2Ftreblle-flask/lists"}