It's not that I'm so smart, it's just that I stay with problems longer. - A. Einstein
Hi Pythonistas, back-to-back with our Planet Python challenge 49 here is our special Easter Challenge #50 where you will use Celery to offload a simplified Easter ecard mailer app.
The app let's your enter a banner URL, a comma separated list of emails and optional message:
_emails_users simulates some processing time by sleeping 1 second - in real life this could be an intentional short pause so as to not hit a server or API too often. For the end users though, the page just appears slow and could result in them navigating away while the emailing is still taking place! Time to add some asynchronous processing so the user can keep navigating the site!
Can you offload the emailing to a Celery task so the user does not have to wait for it to end or to prevent an impatient user from navigating away? Change the Flask app as you want, it's just some bootstrap code to get started ... You could also add an option to the form to send the card at a later date ...
Bonus points if you can display progress of the emailing on the page. Secondly try to deploy it to a cloud service provider and make the emailing work. You could try Heroku + Sendgrid for example.
We are moving the review posts to a featured view on our platform (audience > 1800 users and growing), PR and standby ...
A few more things before we take off:
Do you want to discuss this challenge and share your Pythonic journey with other passionate Pythonistas? Confirm your email on our platform then request access to our Slack via settings.
And of course Happy Easter!
>>> from pybites import Bob, Julian Keep Calm and Code in Python!
Do you want to get 250+ concise and applicable Python tips in an ebook that will cost you less than 10 bucks (future updates included), check it out here.
"The discussions are succinct yet thorough enough to give you a solid grasp of the particular problem. I just wish I would have had this book when I started learning Python." - Daniel H
"Bob and Julian are the masters at aggregating these small snippets of code that can really make certain aspects of coding easier." - Jesse B
"This is now my favourite first Python go-to reference." - Anthony L
"Do you ever go on one of those cooking websites for a recipe and have to scroll for what feels like an eternity to get to the ingredients and the 4 steps the recipe actually takes? This is the opposite of that." - Sergio S