{"id":24757256,"url":"https://github.com/aulanchik/loan-manager-api","last_synced_at":"2025-08-30T20:08:09.077Z","repository":{"id":303777620,"uuid":"1016623230","full_name":"aulanchik/loan-manager-api","owner":"aulanchik","description":"A simple API built with FastAPI for processing and managing loan applications.","archived":false,"fork":false,"pushed_at":"2025-07-09T11:11:58.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-09T11:35:28.896Z","etag":null,"topics":["country-code","fast-api","python","rate-limiting"],"latest_commit_sha":null,"homepage":"https://loan-manager-api-0fgj.onrender.com","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/aulanchik.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-09T09:30:31.000Z","updated_at":"2025-07-09T11:12:38.000Z","dependencies_parsed_at":"2025-07-09T11:35:30.743Z","dependency_job_id":"66372463-b3a6-4f92-b57b-51abaa7eae59","html_url":"https://github.com/aulanchik/loan-manager-api","commit_stats":null,"previous_names":["aulanchik/loan-manager-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aulanchik/loan-manager-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aulanchik%2Floan-manager-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aulanchik%2Floan-manager-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aulanchik%2Floan-manager-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aulanchik%2Floan-manager-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aulanchik","download_url":"https://codeload.github.com/aulanchik/loan-manager-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aulanchik%2Floan-manager-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272900157,"owners_count":25012033,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["country-code","fast-api","python","rate-limiting"],"created_at":"2025-01-28T14:39:07.917Z","updated_at":"2025-08-30T20:08:09.070Z","avatar_url":"https://github.com/aulanchik.png","language":"Python","readme":"# Loan Manager API\n\nA simple API built with FastAPI for processing and managing loan applications. It features per-country rate limiting, a personal ID blacklist, and endpoints to view submitted applications.\n\n## Features\n*   **Loan Application Submission**: Endpoint to apply for a new loan.\n*   **Application Retrieval**: Endpoints to list all submitted applications or retrieve applications by a specific personal ID.\n*   **Blacklist**: Rejects applications from predefined blacklisted personal IDs.\n*   **Rate Limiting**: Implements a simple in-memory rate limiter that restricts requests to **3 per second from the same country**.\n\nFYI: The country is identified via the client's IP address using the `ip-api.com` service. If the IP geolocation service is unavailable or fails, the system defaults to country code `\"GB\"`.\n\n## Getting Started\n\n### Prerequisites\n*   Python 3.8 or higher\n\n### Installation \u0026 Setup\n\n1.  **Clone the repository:**\n    ```bash\n    git clone https://github.com/aulanchik/loan-manager-api.git\n    cd loan-manager-api\n    ```\n\n2.  **Install dependencies:**\n    The project uses `pyproject.toml` to manage dependencies. Install them using pip:\n    ```bash\n    pip install .\n    ```\n    This will install FastAPI, Uvicorn, and other necessary packages.\n\n### Running the Application\n\nTo run the development server, use Uvicorn:\n```bash\nuvicorn app.main:app --reload\n```\nThe API will be available at `http://127.0.0.1:8000`.\n\n## API Endpoints\n\n### Apply for a Loan\nSubmits a new loan application.\n\n- **URL:** `/apply-loan`\n- **Method:** `POST`\n- **Request Body:**\n  ```json\n  {\n    \"loan_amount\": 1000.0,\n    \"term\": 12,\n    \"name\": \"John\",\n    \"surname\": \"Doe\",\n    \"personal_id\": \"1234567890\"\n  }\n  ```\n- **Success Response (`200 OK`):**\n  ```json\n  {\n    \"status\": \"approved\",\n    \"country\": \"GB\"\n  }\n  ```\n- **Error Responses:**\n  - `400 Bad Request`: If the `personal_id` is on the blacklist.\n  - `429 Too Many Requests`: If the rate limit for the client's country is exceeded.\n\n### List All Loans\nRetrieves a list of all stored loan applications.\n\n- **URL:** `/loans`\n- **Method:** `GET`\n- **Success Response (`200 OK`):**\n  ```json\n  [\n    {\n      \"application\": {\n        \"loan_amount\": 1000.0,\n        \"term\": 12,\n        \"name\": \"John\",\n        \"surname\": \"Doe\",\n        \"personal_id\": \"1234567890\"\n      },\n      \"country\": \"GB\"\n    }\n  ]\n  ```\n\n### List Loans by User\nRetrieves all loan applications associated with a specific personal ID.\n\n- **URL:** `/loans/{personal_id}`\n- **Method:** `GET`\n- **Example URL:** `/loans/1234567890`\n- **Success Response (`200 OK`):**\n  Returns a list of loan applications matching the `personal_id`.\n\n## Running Tests\nThe project uses `pytest` for testing. To run the test suite, execute the following command from the project's root directory:\n\n```bash\npytest\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faulanchik%2Floan-manager-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faulanchik%2Floan-manager-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faulanchik%2Floan-manager-api/lists"}