-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added FastAPI documentation #760
Conversation
Hi and welcome @KamarulAdha! Thank you for contriburing to Your document section is excellent! Clear, consise, well structured. Good job! Could you also please add a mention of your addition in the |
@allcontributors please add @KamarulAdha for documentation |
I've put up a pull request to add @KamarulAdha! 🎉 |
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #760 +/- ##
=======================================
Coverage 92.67% 92.67%
=======================================
Files 27 27
Lines 7275 7275
Branches 1317 1317
=======================================
Hits 6742 6742
Misses 337 337
Partials 196 196 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
You mentioned that I need to add my name in the |
Yes, you can simply add extra commits to this branch, with the changes adressing my review comments, and a new line like this in
|
I've changed the bytesIO and the str(). I tried using aiosmtplib instead of smtplib and there were complications. Not sure if the problem was coming from the smtp server provider or the code itself. But I didn't want to waste any of your time, so I made a PR with only those 2 changes for now. Alongside with the I do think, since I wasn't able to use aiosmtplib, I could make the entire endpoint non-async. That way, everything is more standardized. What do you think? Should I try again with aiosmtplib, or remove async from the endpoint entirely? |
Yes, I agree, a synchronous function would make more sense if You will still be able to modify the code in another PR later on, if you figure out how to use |
It turns out, FastAPI has a alot of trouble with non-async endpoints receiving json objects as input. I managed to remove the async endpoint, but as a result, I had to add two more functions (utility and helper functions). This would allow the endpoint to receive and process the json object. Aside from that, I added try-except in the endpoint just in case anything breaks. And also some explanation for each of the functions so that it is a bit clearer for the reader. Many thanks~! |
OK, I understand. Given it adds a bit of complexity to the example, and the fact that this code is not really synchronous as What do you think? |
I am okay with that. Also, I would like to mention. I tried something new and I removed the sending email functionality. Instead, I made the API to return the file back to the user. So, the user sends data to the API, the API returns back the PDF back. This way, it is more relatable with the other guides. With this, we are making the endpoint async, but we are not sending my email anymore as I had problems with aiosmtp. What do you think? Option 1: Option 2: |
Sounds great! |
…function to file response
Alright, I think I've made the necessary changes. Do let me know if there are any problems with it. Many thanks~! EDIT: I forgot to change the explanation at the top that explains what the code does. Submitting new PR now. |
Merged! Thank you for your contribution @KamarulAdha 👍 |
Your contribution is now online & public: |
Thank you so much for taking the time to teach me on how to contribute on GitHub. This was an exciting experience. Thank you~! Also, thanks for renaming the PR. Looks even more professional now ^^ |
My pleasure 😊 You have also been added to the list of contributors: |
Added documentation on how to use FPDF using FastAPI and send the file via SMTP.
Checklist:
The GitHub pipeline is OK (green),
meaning that both
pylint
(static code analyzer) andblack
(code formatter) are happy with the changes of this PR.A unit test is covering the code added / modified by this PR
This PR is ready to be merged
In case of a new feature, docstrings have been added, with also some documentation in the
docs/
folderA mention of the change is present in
CHANGELOG.md
By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.