{"id":19605496,"url":"https://github.com/nullswan/flask-api-usage","last_synced_at":"2026-04-17T00:02:17.735Z","repository":{"id":144403515,"uuid":"303825859","full_name":"nullswan/flask-api-usage","owner":"nullswan","description":"Flask addon used to record usage statistics on each request.","archived":false,"fork":false,"pushed_at":"2020-10-16T09:59:41.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-17T08:31:35.325Z","etag":null,"topics":["flask","flask-api","flask-backend","mongoengine"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nullswan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-10-13T20:51:27.000Z","updated_at":"2020-10-16T09:59:43.000Z","dependencies_parsed_at":"2023-11-23T10:47:43.911Z","dependency_job_id":null,"html_url":"https://github.com/nullswan/flask-api-usage","commit_stats":null,"previous_names":["nullswan/flask-api-usage"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nullswan/flask-api-usage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullswan%2Fflask-api-usage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullswan%2Fflask-api-usage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullswan%2Fflask-api-usage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullswan%2Fflask-api-usage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nullswan","download_url":"https://codeload.github.com/nullswan/flask-api-usage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullswan%2Fflask-api-usage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31909235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"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":["flask","flask-api","flask-backend","mongoengine"],"created_at":"2024-11-11T09:43:06.466Z","updated_at":"2026-04-17T00:02:17.715Z","avatar_url":"https://github.com/nullswan.png","language":"Python","readme":"# flask-api-usage\n\n```python\nfrom flask import Flask\nfrom flask_api_usage import Usage\nflask_app = Flask(__name__)\n\ndb = 'mongoDB_db_name'\nmongoURI = 'mongodb://localhost:1234/'\n\nflask_app.config['USAGE_MONGODB_SETTINGS'] = {\n    'db': db,\n    'host': mongoURI,\n    'alias': 'flask-usage'\n}\n\n# === Way 1 ===\n\nusage = Usage()\nUsage.init_app(flask_app)\n\n# === Way 2 ===\n\nUsage(flask_app)\n```\n\n## Addon available document\n```\n{\n    \"_id\" : ObjectId,\n    \"date\" : ISODate,\n    \"exception\" : str,\n    \"method\" : str,\n    \"path\" : str,\n    \"url\" : str,\n    \"status_code\" : int,\n    \"response\" : {\n        \"content_length\" : int,\n        \"mimetype\" : str,\n        \"headers\" : dict,\n        \"body\" : dict\n    },\n    \"client\" : {\n        \"referer\" : str,\n        \"authorization\" : str,\n        \"origin\" : str,\n        \"remote_address\" : str\n        \"user_agent\" : str,\n        \"platform\" : str,\n        \"browser\" : str\n    },\n    \"request\" : {\n        \"elapsed_time\" : float,\n        \"content_length\" : int,\n        \"mimetype\" : str,\n        \"body\" : dict,\n        \"headers\" : dict,\n        \"args\" : dict\n    }\n}\n```\n\n## Exemple document created while fetching configuration before stripe request.\n\n```\n{\n    \"_id\" : ObjectId(\"private\"),\n    \"date\" : ISODate(\"2020-10-10T22:45:35.944Z\"),\n    \"exception\" : \"None\",\n    \"method\" : \"GET\",\n    \"path\" : \"/api/v0/pay/setup\",\n    \"url\" : \"http://localhost:22222/api/v0/pay/setup\",\n    \"status_code\" : 200,\n    \"response\" : {\n        \"content_length\" : 638,\n        \"mimetype\" : \"application/json\",\n        \"headers\" : {\n            \"Content-Type\" : \"application/json\",\n            \"Content-Length\" : \"638\",\n            \"Access-Control-Allow-Origin\" : \"http://localhost:5000\",\n            \"Vary\" : \"Origin\"\n        },\n        \"body\" : {\n            \"publicKey\" : \"private\",\n            \"products\" : [ \n                {\n                    \"name\" : \"private\",\n                    \"id\" : \"private\",\n                    \"image\" : \"private\",\n                    \"metadata\" : {\n                        \"private\" : \"True\"\n                    },\n                    \"description\" : \"private\",\n                    \"price\" : {\n                        \"id\" : \"private\",\n                        \"amount\" : \"private\",\n                        \"currency\" : \"eur\"\n                    },\n                    \"unit\" : \"key\"\n                }\n            ]\n        }\n    },\n    \"client\" : {\n        \"referer\" : \"http://localhost:5000/\",\n        \"authorization\" : null,\n        \"origin\" : \"http://localhost:5000\",\n        \"remote_address\" : \"127.0.0.1\",\n        \"user_agent\" : \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36\",\n        \"platform\" : \"windows\",\n        \"browser\" : \"chrome 85.0.4183.121\"\n    },\n    \"request\" : {\n        \"elapsed_time\" : 0.593111753463745,\n        \"content_length\" : null,\n        \"mimetype\" : \"\",\n        \"body\" : null,\n        \"headers\" : {\n            \"Host\" : \"localhost:22222\",\n            \"Connection\" : \"keep-alive\",\n            \"User-Agent\" : \"Mozilla/5.0 (Windows NT 10.0 Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36\",\n            \"Accept\" : \"*/*\",\n            \"Origin\" : \"http://localhost:5000\",\n            \"Sec-Fetch-Site\" : \"same-site\",\n            \"Sec-Fetch-Mode\" : \"cors\",\n            \"Sec-Fetch-Dest\" : \"empty\",\n            \"Referer\" : \"http://localhost:5000/\",\n            \"Accept-Encoding\" : \"gzip, deflate, br\",\n            \"Accept-Language\" : \"fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7\"\n        },\n        \"args\" : {}\n    }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullswan%2Fflask-api-usage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnullswan%2Fflask-api-usage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullswan%2Fflask-api-usage/lists"}