{"id":19766234,"url":"https://github.com/akaliutau/python-microservices","last_synced_at":"2026-05-16T07:09:23.025Z","repository":{"id":120056224,"uuid":"338405639","full_name":"akaliutau/python-microservices","owner":"akaliutau","description":"Microservices in Python","archived":false,"fork":false,"pushed_at":"2021-05-03T19:08:31.000Z","size":94,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-11T00:13:31.383Z","etag":null,"topics":["flask","python3","sqlalchemy"],"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/akaliutau.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":"2021-02-12T18:53:50.000Z","updated_at":"2021-05-03T19:08:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"84859263-5ef1-4552-a65e-9a9e7d5299e7","html_url":"https://github.com/akaliutau/python-microservices","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaliutau%2Fpython-microservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaliutau%2Fpython-microservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaliutau%2Fpython-microservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaliutau%2Fpython-microservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akaliutau","download_url":"https://codeload.github.com/akaliutau/python-microservices/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241099620,"owners_count":19909577,"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":["flask","python3","sqlalchemy"],"created_at":"2024-11-12T04:23:28.429Z","updated_at":"2026-05-16T07:09:18.006Z","avatar_url":"https://github.com/akaliutau.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"RESTful Python microservice\n=============================\n\nThis code is an example of RESTful service web app. \n\nIt is a Flask application (https://www.djangoproject.com/) that creates a RESTful backend to store user's posts. In other \nwords it's a nano-twitter application\n\nOverview\n=========\nThe format of a Tweet POJO is as follows:\n\n```\n{\n    id integer\n    username string\n    text string\n    timestamp string($date-time)\n}\n```\n\nAPI has the following contract:\n\n\npublic api:\n\n| Method | Endpoint                   |Secure|      Description                               |\n|--------|----------------------------|------|------------------------------------------------|\n|GET     |  /api/me/tweets/           |  Yes |    List of tweets of the user                  |\n|POST    |  /api/me/tweets/           |  Yes |    The newly created tweet                     |\n|GET     |  /api/tweets/              |  No  |    List of all tweets                          |\n|GET     |  /api/tweets/{id}/         |  No  |    The tweet with ID=id                        |  \n|GET     |  /api/tweets/?search=token |  No  |    Searches all the tweets that contain token  |\n\n\nprivate api:\n\n| Method | Endpoint                   |Secure|      Description                               |\n|--------|----------------------------|------|------------------------------------------------|\n|DELETE  |   /admin/tweets/{id}/      |   No |     Deletes tweet with ID=id                   |\n\nDatabase has the following schema (created through SQLAlchemy https://www.sqlalchemy.org/):\n\n```\nid INTEGER NOT NULL Primary key\nusername VARCHAR(50)\ntext VARCHAR(250)\ntimestamp DATETIME Creation time\n```\n\nBuild and run local service - nanotwitter\n==========================================\n\n\nCreate a virtual environment and install the requirements\n\n```\npython3 -m venv ./venv\nsource ./venv/bin/activate OR .\\venv\\Scripts\\activate\npip install -r requirements.txt\n```\n\nGet the local database ready\n\n```\npython -m nanotwitter.init_db\n```\n\nGenerate the API token:\n```\npython -m nanotwitter.gen_token\nBearer eyJ0eXAiOiJK...  ...YVCnAAo4kLXO8Fg\n```\n\nStart the development server\n\n```\nset FLASK_APP=.\\nanotwitter\\wsgi.py \nset FLASK_ENV=development\n\nflask run\n```\n\nCheck the service at http://127.0.0.1:5000/\n\nBuild and run dockerized microservice - nanotwitter_pg\n=======================================================\n\nNote, there are tiny differences between nanotwitter_pg and nanotwitter_pg - in a way of working with DB layer and in\ndependencies\n\nUse this command to build and spin up containers:\n\n```\ndocker-compose -f docker-compose-pg.yaml up --build\n```\n\nand this one to destroy them:\n\n```\ndocker-compose -f docker-compose-pg.yaml down\n```\nCheck the service at http://127.0.0.1:5000/\n\nTests\n======\n\nRun the unit tests with\n\n```\npytest\n```\n\nDependencies\n=============\n\nThis application uses:\n\n* Flask as a web framework ()\n  \n* Flask RESTplus for creating the web interface, similar to Swagger (https://flask-restplus.readthedocs.io/en/stable)\n\n* SQLAlchemy to handle the database models (https://www.sqlalchemy.org/)\n\n* SQLlite database for local development and U-tests ()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakaliutau%2Fpython-microservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakaliutau%2Fpython-microservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakaliutau%2Fpython-microservices/lists"}