{"id":26086833,"url":"https://github.com/liqtags/flask-credit-api-poc","last_synced_at":"2026-04-21T14:33:00.467Z","repository":{"id":214625926,"uuid":"735926912","full_name":"liqtags/flask-credit-api-poc","owner":"liqtags","description":"A Flask User API Key Credit Server POC","archived":false,"fork":false,"pushed_at":"2023-12-29T12:33:10.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T07:18:40.915Z","etag":null,"topics":["api","api-server","flask","python"],"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/liqtags.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,"roadmap":null,"authors":null}},"created_at":"2023-12-26T13:33:40.000Z","updated_at":"2023-12-29T12:33:36.000Z","dependencies_parsed_at":"2023-12-29T13:30:03.923Z","dependency_job_id":"2f6a68a6-1d21-4cd0-9e28-2e73992d4eef","html_url":"https://github.com/liqtags/flask-credit-api-poc","commit_stats":null,"previous_names":["0xlino/flask-credit-api-poc","liqtags/flask-credit-api-poc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/liqtags/flask-credit-api-poc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liqtags%2Fflask-credit-api-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liqtags%2Fflask-credit-api-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liqtags%2Fflask-credit-api-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liqtags%2Fflask-credit-api-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liqtags","download_url":"https://codeload.github.com/liqtags/flask-credit-api-poc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liqtags%2Fflask-credit-api-poc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32095878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["api","api-server","flask","python"],"created_at":"2025-03-09T07:18:30.861Z","updated_at":"2026-04-21T14:33:00.421Z","avatar_url":"https://github.com/liqtags.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask Credit API POC\n\n# Project Documentation\n\n## Overview\nThis project is a Flask-based web service interfacing with Supabase for data storage and management. It features API key verification and credit-based access control for its endpoints.\n\n### Key Features:\n- API key verification from Supabase.\n- Credit system for API usage.\n- User and animal data retrieval based on API key and query parameters.\n\n### Dependencies:\n- Flask\n- Supabase\n- PostgREST\n\n## Setup and Installation\n1. **Install Required Packages**: \n   ```bash\n   pip install Flask supabase postgrest\n   ```\n2. **Configure Environment Variables**:\n   - Set `SUPABASE_URL` and `SUPABASE_KEY` in `consts.py`.\n\n## Usage\n1. **Start the Flask Server**:\n   ```bash\n   python [filename].py\n   ```\n2. **API Endpoints**:\n   - `/v1/animals`: Get animal data based on the name query parameter. Requires API key for access.\n\n### Verifying API Key:\n- The API key is verified against the Supabase 'api_keys' table.\n- Two methods provided: `verify_api_key_from_supabase` and `verify_api_key_from_supabase_with_credits`.\n\n### Handling Credits:\n- Each API call checks and deducts credits associated with the API key.\n- Responses include credit information and relevant data or error messages.\n\n## Error Handling\n- Errors are logged using a custom logger.\n- Exceptions, such as `APIError` from PostgREST, are caught and handled appropriately.\n\n## Testing\n- The `test_platform_functionality` function can be used to test the complete functionality.\n- It is currently commented out and can be activated for development tests.\n\n## Note\n- For production, it's recommended to retrieve the API key from request headers for security purposes.\n\n## Contribution\n- Contributions are welcome. Please follow the standard pull request process for contributions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliqtags%2Fflask-credit-api-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliqtags%2Fflask-credit-api-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliqtags%2Fflask-credit-api-poc/lists"}