[WIP] PCC16 Query Your Favorite API #172

Open
wants to merge 15 commits into
from

Conversation

Projects
None yet
2 participants

mridubhatnagar commented Dec 20, 2017

Tweaked around WordnikAPI to fetch one word of the day. The
random word generated is emailed every day to the recipient's
mail address.

TODO:
Write Unit test cases

ATTENTION: before clicking "Create Pull Request" please submit some meta data, thanks!

Difficulty level (1-10):
7

Estimated time spent (hours):
~10-11 ( to come up with a use case and solution)
Some more time to get a hang of cron job.

Completed (yes/no):
Yes

I stretched my coding skills (if yes what did you learn?):

  1. Coming up with a good use case to query the API.
  2. Sending email notification using Python Script.
  3. (Major Learning) Cron job. So, that it gives me one word daily in inbox.
  4. Learned how to set tokens using environment variables instead of directly adding them in
    script.
  5. yay! I learned little bit about bash script, linux commands as well. :D
  6. SheBang
  7. Utility of cron and anacron.

Challenges

  1. Cron Job.

As of now to implement this. It is assumed that system and wifi are up and running at the time when cron is scheduled. Not a good approach.

So, for systems that are not always up and running. Learnt that there is anacrontab in ubuntu. So, if my cron is scheduled at 4:00 am. But, in case at 4:00 my system was turned off. So, the time I switch on the system 10 mins after that I'll receive the email.

Other feedback (what can we improve?): []

PCC16 Query Your Favorite API
Tweaked around WordlinkAPI to
fetch one word of the day. The
random word generated is emailed
every day to the recipient's mail
address.
16/build_vocabulary.py
+
+
+
+api_key = 'a2a73e7b926c924fad7001ca3111acd55af2ffabf50eb4ae5'
@pybites

pybites Dec 20, 2017

Owner

tuck that away in an env variable

@mridubhatnagar

mridubhatnagar Dec 20, 2017

Thanks for the suggestion. Made changes. :)

+
+
+def parse_response(response):
+ """
@pybites

pybites Dec 20, 2017

Owner

nice docstrings

Owner

pybites commented Dec 20, 2017

nice work

@mridubhatnagar mridubhatnagar changed the title from PCC16 Query Your Favorite API to [WIP] PCC16 Query Your Favorite API Dec 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment