{"id":19144216,"url":"https://github.com/bgelov/funbox-async-api-count","last_synced_at":"2026-05-15T12:05:56.056Z","repository":{"id":175456695,"uuid":"653928572","full_name":"bgelov/funbox-async-api-count","owner":"bgelov","description":"Python async api","archived":false,"fork":false,"pushed_at":"2023-07-06T20:23:54.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-22T19:31:45.825Z","etag":null,"topics":["async","json","monitoring","python","python-api-client","python-async","python-json"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bgelov.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-06-15T03:35:31.000Z","updated_at":"2024-11-10T02:08:25.000Z","dependencies_parsed_at":"2023-09-12T16:30:44.955Z","dependency_job_id":null,"html_url":"https://github.com/bgelov/funbox-async-api-count","commit_stats":null,"previous_names":["bgelov/funbox-async-api-count"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bgelov/funbox-async-api-count","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgelov%2Ffunbox-async-api-count","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgelov%2Ffunbox-async-api-count/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgelov%2Ffunbox-async-api-count/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgelov%2Ffunbox-async-api-count/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bgelov","download_url":"https://codeload.github.com/bgelov/funbox-async-api-count/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgelov%2Ffunbox-async-api-count/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272619993,"owners_count":24965451,"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-29T02:00:10.610Z","response_time":87,"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":["async","json","monitoring","python","python-api-client","python-async","python-json"],"created_at":"2024-11-09T07:34:10.120Z","updated_at":"2026-05-15T12:05:51.036Z","avatar_url":"https://github.com/bgelov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Задача\n```\nЕсть три сервера \"maria.ru\", \"rose.ru\", \"sina.ru\", которые по GET-запросу отдают свою метрику.\nНапишите на вашем любимом скриптовом языке программирования (Ruby, Perl, PHP, Python, Groovy, . . .)\nпрограмму, которая будет опрашивать три сервера каждую минуту и выводить в консоль эту метрику рядом с названием сервера.\n\nФормат запроса:\nGET http://servername/api/count\n\nФормат ответа:\n{\"count\": 42}\n\nФормат вывода:\n2022-05-20 13:01:00 maria.ru 42\n2022-05-20 13:01:00 rose.ru 43\n2022-05-20 13:01:00 sina.ru 45\n2022-05-20 13:02:00 maria.ru 32\n2022-05-20 13:02:00 rose.ru 33\n2022-05-20 13:02:00 sina.ru 34\n```\n\n## Решение\n\nКод: [main.py](https://github.com/bgelov/funbox-async-api-count/blob/main/main.py)\n\n- Обращения к API происходит каждую минуту в 00 секунд\n- Обращения происходят асинхронно\n\n![pycharm64_ZBFp1rLoGB](https://github.com/bgelov/funbox-async-api-count/assets/5302940/9d7c4b49-6dc9-46dd-98c1-a3d40e5c93e4)\n\n- В случае недоступности хоста выводим в консоль ошибку и значение прочерк\n\n![buidL4lMP5](https://github.com/bgelov/funbox-async-api-count/assets/5302940/091526d1-94d2-4aa3-bfe1-942976135a0b)\n\n## Тестовое API на Powershell Pode\n\n```\nStart-PodeServer {\n\n    # Запускаем сервер на http://localhost:80\n    Add-PodeEndpoint -Address localhost -Port 80 -Protocol Http\n\n    Add-PodeRoute -Method Get -Path '/api/count' -ScriptBlock {\n        # Возвращаем ранодомное число в JSON\n        Write-PodeJsonResponse -Value @{\"count\" = $(Get-Random -Minimum 0 -Maximum 999) }\n    }\n}\n```\n\n## Тестовая отдача JSON на nginx\n\n```\nserver {\n        location ~ ^/api/count {\n           default_type application/json;\n           return 200 '{\"count\": 111}';\n        }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgelov%2Ffunbox-async-api-count","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbgelov%2Ffunbox-async-api-count","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgelov%2Ffunbox-async-api-count/lists"}