Available online at http://milosz.pythonanywhere.com
- User can add new movie giving movie_title - title will be check for DB presence first.
- Based on the title movie details are fetched from OMDb API (http://www.omdbapi.com/) - movie title is also check for existence there ( if it is not there, will not be added).
- POST request response include omdb_details fetched from the external API.
-
User can fetch all movies currently saved to DB.
-
It is possible to filter the results with following parameters:
- title,
- year,
- genre.
Sorting is available using below parameters:
- sort,
- desc_sort
giving one of values: id, movie_title or year.
Example
/movies/?genre=Adventure&sort=year
- User can add new comment to existing movie giving movie_id and comment_txt.
- Comments are saved to DB.
- User can fetch all comments currently saved to DB.
- User can view all comments for certain movie passing movie_id as a parameter.
Example
/comments/?movie_id=1
- Returns top movies present in the DB with ranking based on number of comments added to the movie in the specified data range. Response include ID of the movie, position in rank and total number of comments (in the specified date range).
- Movies with the same number of comments have the same position in the ranking.
- Require specific data range for which statistic is calculated in format dd.mm.yyyy. In case no data range is selected following default range is applied (15.8.1410, 31.12.9999).
Example
/top/?date_from=8.4.2019&date_to=9.4.2019
Passing above parameters will return all comments in the range [8.4.2019, 9.4.2019).
Used for unit testing POST and GET requests.
Used for calculating a dense ranking for top movies.
Tests for utils functions and all endpoints requests were written using unittest library. Tests invocation from django project main directory:
python tests.py
Note: Start app at 0.0.0.0:8000 before starting tests.
I chose www.pythonanywhere.com instead of www.heroku.com because I already had experience putting apps at this host.