In this article we review last week's Packt free ebook code challenge. We really scratched our own itch building both a notification service and an ebook download manager.
First of all we were a tad disappointed not being able to automate the whole thing. Packt's free-learning linkWe are not the only ones hitting this wall. provies a possible way around it, but we didn't go there.
Update 24/08/2017: there is a fix for this now.
There was still a lot of room to build cool/useful stuff:
Packt Daily Notification Email
We wrote a script to get a daily html email of the free html book, the amount of hh:mm before it expires, and adding Pybonacci's affiliation link (to sponsor Python Spain).
Here is how it looks:
Code is here.
Packt Ebook Download Manager
We also made a script to manage downloaded/purchased Packt ebooks. It uses requests session (detailed here) to login/access/download books. We use BeautifulSoup for html parsing. Here you can see it in action:
$ pythonpackt.pyPACKTDOWNLOADMANAGERLogginginRetrievingbooksSeachforabook(qforexit): dtaNomatches, tryagainSeachforabook(qforexit): data1)LearningDataMiningwithPython [eBook] 2)RDataVisualizationCookbook [eBook] 3)PracticalDataScienceCookbook [eBook] 4)DataAnalysiswithR [eBook] 5)ASP.NETDataPresentationControlsEssentials [eBook] 6)ImplementingSplunk: BigDataReportingandDevelopmentforOperationalIntelligence [eBook] Choosebook(nfornewsearch): 11)https://www.packtpub.com/ebook_download/21201/pdf2)https://www.packtpub.com/ebook_download/21201/epub3)https://www.packtpub.com/ebook_download/21201/mobiChooseurl(ctocancel): 1Downloadinghttps://www.packtpub.com/ebook_download/21201/pdfSavingto/Users/bbelderb/Documents/books/Packt/learning-data-mining-with-python.pdfChoosebook(nfornewsearch): nSeachforabook(qforexit): python1)ExpertPythonProgramming-SecondEdition [eBook] 2)ModernPythonCookbook [eBook] 3)PythonGUIProgrammingCookbook [eBook] 4)WhatYouNeedtoKnowaboutPython [eBook] 5)RaspberryPiCookbookforPythonProgrammers [eBook] 6)LearningPythonApplicationDevelopment [eBook] 7)LearningRoboticsUsingPython [eBook] ... manymore(thanksPackt!) ... Choosebook(nfornewsearch): 11)https://www.packtpub.com/ebook_download/25257/pdf2)https://www.packtpub.com/ebook_download/25257/epub3)https://www.packtpub.com/ebook_download/25257/mobiChooseurl(ctocancel): 3Downloadinghttps://www.packtpub.com/ebook_download/25257/mobiSavingto/Users/bbelderb/Documents/books/Packt/expert-python-programming-second-edition.mobiChoosebook(nfornewsearch): 221)https://www.packtpub.com/ebook_download/20125/pdf2)https://www.packtpub.com/ebook_download/20125/epub3)https://www.packtpub.com/ebook_download/20125/mobiChooseurl(ctocancel): 1Downloadinghttps://www.packtpub.com/ebook_download/20125/pdfSavingto/Users/bbelderb/Documents/books/Packt/functional-python-programming.pdfChoosebook(nfornewsearch): nSeachforabook(qforexit): postgres1)PostgreSQL9AdminCookbook [eBook] 2)LearningPostgreSQL [eBook] Choosebook(nfornewsearch): 21)https://www.packtpub.com/ebook_download/22041/pdf2)https://www.packtpub.com/ebook_download/22041/epub3)https://www.packtpub.com/ebook_download/22041/mobiChooseurl(ctocancel): 1Downloadinghttps://www.packtpub.com/ebook_download/22041/pdfSavingto/Users/bbelderb/Documents/books/Packt/learning-postgresql.pdfChoosebook(nfornewsearch): 11)https://www.packtpub.com/ebook_download/6088/pdf2)https://www.packtpub.com/ebook_download/6088/epub3)https://www.packtpub.com/ebook_download/6088/mobiChooseurl(ctocancel): cChoosebook(nfornewsearch): nSeachforabook(qforexit): science1)PracticalDataScienceCookbook [eBook] Choosebook(nfornewsearch): nSeachforabook(qforexit): machine1)PracticalMachineLearning [eBook] 2)MachineLearningwithR-SecondEdition [eBook] 3)MachineLearningwithSpark [eBook] 4)PythonMachineLearning [eBook] 5)BuildingMachineLearningSystemswithPython [eBook] Choosebook(nfornewsearch): 6Wronginput, pleasetryagainChoosebook(nfornewsearch): fWronginput, pleasetryagainChoosebook(nfornewsearch): 51)https://www.packtpub.com/ebook_download/11703/pdf2)https://www.packtpub.com/ebook_download/11703/epub3)https://www.packtpub.com/ebook_download/11703/mobiChooseurl(ctocancel): 1Downloadinghttps://www.packtpub.com/ebook_download/11703/pdfSavingto/Users/bbelderb/Documents/books/Packt/building-machine-learning-systems-with-python.pdfChoosebook(nfornewsearch): nSeachforabook(qforexit): qBye
And on the file system (some downloads were already there):
Code is here.
Bonus: if you want to do login with Selenium, we covered that in our 100 Days Challenge too.
PacktScraper
We got a nice PR from wonderfulboyx scraping the free ebook site and offering email and tweet notification options, all modular and configurable with configparser. Check it out here.
Great work is coming out of these challenges, we are humbled and stoked creating our PyBites community this way. Thanks for joining.
Remember there is no deadline, you can PR your code anytime. Just remember to isolate (branch) your changes and submit against our Community branch - see our instructions.
Come code with us forking our challenges repo. Have fun!
Keep Calm and Code in Python!
-- Bob and Julian
-
-
-