{"id":26953403,"url":"https://github.com/eobattisti/proj-open-weather-api","last_synced_at":"2026-04-11T12:44:40.643Z","repository":{"id":249207476,"uuid":"830682839","full_name":"eoBattisti/proj-open-weather-api","owner":"eoBattisti","description":"Microservice designed to collect data from Open Weather API","archived":false,"fork":false,"pushed_at":"2024-07-20T21:58:28.000Z","size":241,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-21T09:40:04.987Z","etag":null,"topics":["docker","docker-compose","fastapi","python3","rabbitmq","redis"],"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/eoBattisti.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}},"created_at":"2024-07-18T19:02:05.000Z","updated_at":"2024-07-20T21:59:48.000Z","dependencies_parsed_at":"2024-07-19T09:51:25.638Z","dependency_job_id":null,"html_url":"https://github.com/eoBattisti/proj-open-weather-api","commit_stats":null,"previous_names":["eobattisti/proj-open-weather-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoBattisti%2Fproj-open-weather-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoBattisti%2Fproj-open-weather-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoBattisti%2Fproj-open-weather-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoBattisti%2Fproj-open-weather-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eoBattisti","download_url":"https://codeload.github.com/eoBattisti/proj-open-weather-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246921539,"owners_count":20855283,"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":["docker","docker-compose","fastapi","python3","rabbitmq","redis"],"created_at":"2025-04-03T01:29:41.315Z","updated_at":"2026-04-11T12:44:35.604Z","avatar_url":"https://github.com/eoBattisti.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# proj-open-weather-api\nThis project is a microservice designed to collect weather data from Open Weather API. The project was made with\nDocker and Docker Compose to make the environment simple, easy to use and deploy. \n\n\n- [Technologies](#technologies)\n- [Prerequisites](#prerequisites)\n- [Infrastructure](#infrastructure)\n- [How to's](#how-to's)\n    - [How to setup the environment](#how-to-setup-the-environment)\n    - [How to run the application](#how-to-run-the-application)\n    - [How to run the tests](#how-to-run-the-tests)\n- [Specifications](#specifications)\n    - [Containers](#containers)\n    - [API Endpoints](#api-endpoints)\n        - [POST /weather](#post-weather)\n        - [GET /weather](#get-weather)\n\n## Technologies\n- Python3\n- FastAPI\n- RabbitMQ\n- Redis\n\nYou can check the architecture of the project below to see how the techologies are used and communicate with each other.\n\n## Prerequisites\n- Docker\n- Docker Compose\n- To run some scripts you will need to install the `build-essentials` package.\n\n## Infrastructure\n![Architecure](./assets/architecture.png)\n\n\n## How to's\n\n### How to setup the environment\nIn the all `docker-compose` files you will find the `OPEN_WEATHER_API_KEY` environment variable, change it to your API key.\n\n**NOTE:** To run the dev environment and tests the variable must be set.\n\n**NOTE 2:** You can get your API key from [OpenWeather](https://home.openweathermap.org/users/sign_up)\n\n### How to run the application\nYou have to run the application with the following commands:\n1. If you are running for the first time:\n```bash\ndocker compose up --build\n```\nOr:\n```bash\nmake build\n```\n\n2. Running the application:\n```bash\ndocker compose up\n```\nOr:\n```bash\nmake run\n```\n\n### How to run the tests\nYou have to run the tests with the following commands:\n1. Run all the tests:\n```bash\ndocker compose -f docker-compose.ci.yaml up\n```\nOr:\n```bash\nmake test\n```\n2. Run specific test:\n```bash\ndocker compose -f docker-compose.ci.yaml up --exit-code-from api api\ndocker compose -f docker-compose.ci.yaml up --exit-code-from consumer consumer\n```\nOr:\n```bash\nmake test-api\nmake test-consumer\n```\n\n## Specifications\n\n### Containers\nThe project has the following containers and running on the following ports:\n| Container | Image | Port |\n| --- | --- | --- |\n| api | `proj-open-weather-api/api` | 8000 |\n| consumer | `proj-open-weather-api/consumer` | N/A |\n| rabbitmq | rabbitmq | 5672 |\n| redis | redis | 6379 |\n\n### API Endpoints\n#### **POST /weather**\n- **Description:** Gets the user `ref_id` and acts as a RabbitMQ producerto send the `ref_id`, all the 168 cities ids to the consumer to process.\n- **Parameters:** \n    ```json\n    {\n        \"ref_id\": \"int\"\n    }\n    ```\n- **Excpetions:**\n\n    **Status: 400**\n    ```json\n    {\n        \"detail\": \"User ref_id already exists. Please try again with a new ref_id.\"\n    }\n    ```\n    **Status: 500**\n    ```json\n    {\n        \"detail\": \"Unexpected error: \u003cerror message\u003e\"\n    }\n    ```\n- **Returns:**\n    ```json\n    {\n        \"message\": \"Task created\",\n        \"ref_id\": \"int\"\n    }\n    ```\n\n#### **GET /weather**\n- **Description:** With the user `ref_id` returns the precentage of the POST progress (i.e, the number of cities processed) until the current moment.\n- **Parameters:** \n    ```json\n    {\n        \"ref_id\": \"int\"\n    }\n    ```\n- **Excpetions:**\n    **Status: 404**\n    ```json\n    {\n        \"detail\": \"User ref_id not found! Please try again with a valid ref_id.\"\n    }\n    ```\n    **Status: 500**\n    ```json\n    {\n        \"detail\": \"Unexpected error: \u003cerror message\u003e\"\n    }\n    ```\n- **Returns:**\n    ```json\n    {\n        \"id\": \"int\",\n        \"progress\": \"string\"\n    }\n    ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feobattisti%2Fproj-open-weather-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feobattisti%2Fproj-open-weather-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feobattisti%2Fproj-open-weather-api/lists"}