Title: Error in Downloading converted mp3 file. Everything else works fine. · Issue #39 · kantancoding/microservices-python · GitHub
Open Graph Title: Error in Downloading converted mp3 file. Everything else works fine. · Issue #39 · kantancoding/microservices-python
X Title: Error in Downloading converted mp3 file. Everything else works fine. · Issue #39 · kantancoding/microservices-python
Description: Hi @kantancoding , I followed your Youtube tutorial. I experienced some errors during implementation in my local system. I tried in both Windows and Ubuntu. I got more parts working in Windows. In Ubuntu, I can move forward through MySQL...
Open Graph Description: Hi @kantancoding , I followed your Youtube tutorial. I experienced some errors during implementation in my local system. I tried in both Windows and Ubuntu. I got more parts working in Windows. In ...
X Description: Hi @kantancoding , I followed your Youtube tutorial. I experienced some errors during implementation in my local system. I tried in both Windows and Ubuntu. I got more parts working in Windows. In ...
Opengraph URL: https://github.com/kantancoding/microservices-python/issues/39
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error in Downloading converted mp3 file. Everything else works fine.","articleBody":"Hi @kantancoding ,\r\nI followed your Youtube tutorial. I experienced some errors during implementation in my local system. I tried in both Windows and Ubuntu. I got more parts working in Windows. In Ubuntu, I can move forward through MySQL Error. \r\n\r\nNow my problem is I am not able to download the converted mp3 file. Everything else works fine. The upload part works fine. The Rabbit MQ console page shows the message flow correctly in overview page. But when I try to download the converted file, I got error in gateway pod. The error is:\r\n\r\n```\r\nTraceback (most recent call last): \r\n File \"/usr/local/lib/python3.10/site-packages/flask/app.py\", line 1473, in wsgi_app \r\n\tresponse = self.full_dispatch_request() \r\n File \"/usr/local/lib/python3.10/site-packages/flask/app.py\", line 883, in full_dispatch_request \r\n\treturn self.finalize_request(rv) \r\n File \"/usr/local/lib/python3.10/site-packages/flask/app.py\", line 902, in finalize_request \r\n\tresponse = self.make_response(rv) \r\n File \"/usr/local/lib/python3.10/site-packages/flask/app.py\", line 1174, in make_response \r\n\traise TypeError( \r\nTypeError: The view function for 'download' did not return a valid response. The function either returned None or ended without \r\n10.244.0.35 - - [13/Oct/2024 17:26:52] \"GET /download?fid=670c012c7b8bed687d11e620 HTTP/1.1\" 500 -\r\n```\r\n\r\nThe gateway/server.py file is:\r\n\r\n```\r\nimport os, gridfs, pika, json\r\nfrom flask import Flask, request, send_file\r\nfrom flask_pymongo import PyMongo\r\nfrom auth import validate\r\nfrom auth_svc import access\r\nfrom storage import util\r\nfrom bson.objectid import ObjectId\r\n\r\nserver = Flask(__name__)\r\n\r\nmongo_video = PyMongo(server, uri=\"mongodb://host.minikube.internal:27017/videos\")\r\n\r\nmongo_mp3 = PyMongo(server, uri=\"mongodb://host.minikube.internal:27017/mp3s\")\r\n\r\nfs_videos = gridfs.GridFS(mongo_video.db)\r\nfs_mp3s = gridfs.GridFS(mongo_mp3.db)\r\n\r\nconnection = pika.BlockingConnection(pika.ConnectionParameters(\"rabbitmq\"))\r\nchannel = connection.channel()\r\n\r\n\r\n@server.route(\"/login\", methods=[\"POST\"])\r\ndef login():\r\n token, err = access.login(request)\r\n\r\n if not err:\r\n return token\r\n else:\r\n return err\r\n\r\n\r\n@server.route(\"/upload\", methods=[\"POST\"])\r\ndef upload():\r\n access, err = validate.token(request)\r\n\r\n if err:\r\n return err\r\n\r\n access = json.loads(access)\r\n\r\n if access[\"admin\"]:\r\n if len(request.files) \u003e 1 or len(request.files) \u003c 1:\r\n return \"exactly 1 file required\", 400\r\n\r\n for _, f in request.files.items():\r\n err = util.upload(f, fs_videos, channel, access)\r\n\r\n if err:\r\n return err\r\n\r\n return \"success!\", 200\r\n else:\r\n return \"not authorized\", 401\r\n\r\n\r\n@server.route(\"/download\", methods=[\"GET\"])\r\ndef download():\r\n access, err = validate.token(request)\r\n\r\n if err:\r\n return err\r\n\r\n access = json.loads(access)\r\n\r\n if access[\"admin\"]:\r\n fid_string = request.args.get(\"fid\")\r\n\r\n if not fid_string:\r\n return \"fid is required\", 400\r\n\r\n try:\r\n out = fs_mp3s.get(ObjectId(fid_string))\r\n return send_file(out, download_name=f\"{fid_string}.mp3\")\r\n except Exception as err:\r\n print(err)\r\n return \"internal server error\", 500\r\n\r\n return \"not authorized\", 401\r\n\r\n\r\nif __name__ == \"__main__\":\r\n server.run(host=\"0.0.0.0\", port=8080)\r\n```\r\n\r\nWhat will be the problem ? Can you please explain this and help me to solve the problem?","author":{"url":"https://github.com/vigneshs-dev","@type":"Person","name":"vigneshs-dev"},"datePublished":"2024-10-13T17:38:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/39/microservices-python/issues/39"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b6964826-8343-56b2-db3c-0f30646117de |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9242:2A0D6:E396C7:12F66D7:697321FC |
| html-safe-nonce | c53affdc7231f5b9aabddd3111fe66e3dea3e1be8fb688a272830429cacd01aa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjQyOjJBMEQ2OkUzOTZDNzoxMkY2NkQ3OjY5NzMyMUZDIiwidmlzaXRvcl9pZCI6IjE1MTg1NDA5NTI2MTQxNTA2NTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | de1deb5df047906290de43ea14871a152580cf28764ba8d35a1dc46217200db0 |
| hovercard-subject-tag | issue:2584136322 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/kantancoding/microservices-python/39/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7cfded42e5ff1c3c4e4ed5c87b61f71a8bd96b86d2aa82094364a4da92b00e21/kantancoding/microservices-python/issues/39 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7cfded42e5ff1c3c4e4ed5c87b61f71a8bd96b86d2aa82094364a4da92b00e21/kantancoding/microservices-python/issues/39 |
| og:image:alt | Hi @kantancoding , I followed your Youtube tutorial. I experienced some errors during implementation in my local system. I tried in both Windows and Ubuntu. I got more parts working in Windows. In ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vigneshs-dev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4 |
| turbo-cache-control | no-preview |
| go-import | github.com/kantancoding/microservices-python git https://github.com/kantancoding/microservices-python.git |
| octolytics-dimension-user_id | 78267301 |
| octolytics-dimension-user_login | kantancoding |
| octolytics-dimension-repository_id | 563677660 |
| octolytics-dimension-repository_nwo | kantancoding/microservices-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 563677660 |
| octolytics-dimension-repository_network_root_nwo | kantancoding/microservices-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a5e2b48bd1260476599758f5d253b5d24092ab84 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width