Fork this repository before the work and open a pull request after so we can see you finished. Both assignments must be done in Python 3 with the use of any packages you see fit. When assessing the results, we'll pay special attention to performance of your code, so try to make it optimized.
- Get a list of English words.
- Select 100 random entries that satisfy these conditions:
- They begin with a lowercase letter.
- They only contain letters.
- Search those entries on DuckDuckGo.
- Save the titles of top three results.
Expected outcome: a JSON of the following structure:
{"flower": ["title 1", "title 2", "title 3"], "cow": ["title 1", "title 2", "title 3], ...}
Turn the script you created earlier into a proxy service. It should response to GET
requests at /search/duckduckgo/{search term}
and return JSON arrays of up to three titles of the top results. Queries must be cached, so if a term is looked up twice, first it will be a request to DuckDuckGo and second will be a result from the cache. Write unit tests for your code with the use of unittest
and unittest.mock
modules.
Expected outcome: a publicly availble web service.