{"id":22191667,"url":"https://github.com/leosimoes/rocketseat-nlw-python-flask-codigodebarras","last_synced_at":"2026-04-30T17:31:56.263Z","repository":{"id":221527318,"uuid":"754638470","full_name":"leosimoes/Rocketseat-NLW-Python-Flask-CodigoDeBarras","owner":"leosimoes","description":"Rocketseat's NLW event project using Python and Flask to generate barcode.","archived":false,"fork":false,"pushed_at":"2024-02-14T20:37:29.000Z","size":381,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T20:43:39.634Z","etag":null,"topics":["barcode","flask","pillow","pytest","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/leosimoes.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-02-08T13:31:59.000Z","updated_at":"2024-02-20T12:55:00.000Z","dependencies_parsed_at":"2024-02-14T21:47:54.599Z","dependency_job_id":null,"html_url":"https://github.com/leosimoes/Rocketseat-NLW-Python-Flask-CodigoDeBarras","commit_stats":null,"previous_names":["leosimoes/rocketseat-nlw-python-flask-codigodebarras"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leosimoes/Rocketseat-NLW-Python-Flask-CodigoDeBarras","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leosimoes%2FRocketseat-NLW-Python-Flask-CodigoDeBarras","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leosimoes%2FRocketseat-NLW-Python-Flask-CodigoDeBarras/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leosimoes%2FRocketseat-NLW-Python-Flask-CodigoDeBarras/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leosimoes%2FRocketseat-NLW-Python-Flask-CodigoDeBarras/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leosimoes","download_url":"https://codeload.github.com/leosimoes/Rocketseat-NLW-Python-Flask-CodigoDeBarras/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leosimoes%2FRocketseat-NLW-Python-Flask-CodigoDeBarras/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32472396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: 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":["barcode","flask","pillow","pytest","python"],"created_at":"2024-12-02T12:17:14.412Z","updated_at":"2026-04-30T17:31:56.245Z","avatar_url":"https://github.com/leosimoes.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rocketseat - NLW - Python - Flask - Barcode\n\nRocketseat's NLW event project using Python and Flask to generate barcode.\n\n\n## Steps\n1. Create Flask project in PyCharm:\n\n![Image-1-PyCharm-InitProject](imgs/Img-1-PyCharm-Init.jpg)\n\n2. Install other dependencies:\n- pillow\n- python-barcode\n- Cerberus\n- pytest\n\n3. Change `app.py`:\n- remove route `/`;\n- add route `POST '/create_tag'` which receives \"product_code\" and creates an image in the program folder;\n\n4. Test route `http://127.0.0.1:5000/create_tag` with Postman passing ```{\"tag path\": \"987-654-321\"}```;\n\n![Img-2-Test-987-654-32](imgs/Img-2-Test-987-654-321.jpg)\n\n5. Create directories:\n- from the project root: `/src`, `/src/controllers`, `/src/drivers`, `/src/errors`, `/src/main`,\n   `/src/main/routes`, `/src/main/server`, `/src/validators`, `/src/views`, `/src/views/http_types`\n- everyone must have a `__init__.py` file\n\n![Img-3-Directories.jpg](imgs/Img-3-Directories.jpg)\n\n6. Extract part of the code from `app.py` to\n- `server.py`: creates app and registers Blueprints\n- `tag_routes.py`: creates a Blueprint for the `POST '/create_tag'` route\n\n7. Extract part of the `create_tag` function code from `tag_routes.py` to the files:\n- `src/drivers/barcode_handler.py` with the BarcodeHandler class;\n- `src/views/tag_creator_view.py` with the TagCreatorView class;\n- `src/controllers/tag_creator_controller.py` with the TagCreatorController class;\n- `src/views/http_types/http_request.py` with the HttpRequest class;\n- `src/views/http_types/http_response.py` with the HttpResponse class.\n\n8. Create a function to display an error after handling it with `try except`:\n- `src/errors/error_handler.py` with `handle_errors` function;\n- function `create_tag` handles exceptions with `try except`.\n\n9. Add custom error and validation:\n- `src/errors/error_types/http_unprocessable_entity.py` with class `HttpUnprocessableEntityError`;\n- `src/validators/tag_creator_validator.py` with the `tag_creator_validator` function.\n\n10. Create tests:\n- test file names must end with `_test.py`;\n- `pytest -s -v` to run all tests in the directory.\n\n![Img-4-Tests.jpg](imgs/Img-4-Tests.jpg)\n\n\n## Certificate\n\n![Img-5-Certificate-NLW-2024-Python](imgs/Img-5-Certificate-NLW-2024-Python.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleosimoes%2Frocketseat-nlw-python-flask-codigodebarras","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleosimoes%2Frocketseat-nlw-python-flask-codigodebarras","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleosimoes%2Frocketseat-nlw-python-flask-codigodebarras/lists"}