项目作者: v-girish

项目描述 :
Practice flask web app
高级语言: Python
项目地址: git://github.com/v-girish/mmasters.git
创建时间: 2020-06-13T12:41:57Z
项目社区:https://github.com/v-girish/mmasters

开源协议:

下载


mmasters

Practice flask web app

Problem statement

“MMasters” is a movie inventory company and they wish to introduce new features in their system.

MMasters is an “API first” company providing a lot of APIs around movie snapshots. They would like to introduce few features in the system -
They wish to pull movie snapshots from OMDB (http://www.omdbapi.com/) and store in our system.
They would also like to allow anyone to retrieve these movie snapshots.

As mentioned, they are an “API first” company and they now expect to build two APIs -

  1. - one that gets all the movie snapshots from our system
  2. - is an OPEN API
  3. - one that creates movie snapshots in our system by fetching the information from omdb
  4. - is a protected API
  5. - every request should contain a header "x-api-key" with "d2ViLWFwcGxpY2F0aW9uLWluLWZsYXNr" as the value
  6. - *allow our people to pass mutiple movie titles to be fetched from OMDB

They expect proper REST status in the system:

  • 500 for INTERNAL_SERVER_ERROR
  • 200 for OK
  • 201 for CREATED
  • 401 for UNAUTHORIZED

…and so on

Movie snapshot includes -

  • title
  • release year
  • release date
  • director
  • and ratings which is a collection

Summarizing -

As a part of the system

  • build APIs,
  • ensure security,
  • fetch from OMDB,
  • store in the system,
  • get all movie snapshots from the system
  • and needless to say, ensure that the system is properly tested

Installing dependencies

```shell script
brew install pipenv
cd
pipenv install
pipenv shell #(to activate virtualenv)

  1. ### Running Migrations
  2. ```shell script
  3. export FLASK_APP='run_app.py'
  4. flask db upgrade

Running the Application

```shell script
export API_KEY=’
export OMDB_API_KEY=’
export FLASK_APP=’run_app.py’
flask run

  1. ### Running the Tests
  2. ```shell script
  3. python -m pytest tests/