Building RESTful Python Web Services
上QQ阅读APP看书,第一时间看更新

Test your knowledge

  1. If we want to create a simple Player model that we will use to represent and persist players in Django REST framework, we can create:
    1.  A Player class as a subclass of the djangorestframework.models.Model class.
    2.  A Player class as a subclass of the django.db.models.Model class.
    3.  A Player function in the restframeworkmodels.py file.
  2. In the Django REST Framework, serializers are:
    1. Mediators between the model instances and Python primitives.
    2. Mediators between the view functions and Python primitives.
    3. Mediators between the URLs and view functions.
  3. In the Django REST Framework, parsers and renderers:
    1. Handle as mediators between model instances and Python primitives.
    2. Reset the board.
    3. Handle as mediators between Python primitives and HTTP requests and responses.
  4. The urlpatterns list declared in the urls.py file makes it possible to:
    1.  Route URLs to views.
    2.  Route URLs to models.
    3.  Route URLs to Python primitives.
  5. HTTPie is a:
    1. Command-line HTTP server written in Python that makes it easy to create a RESTful Web Server.
    2. Command-line utility that allows us to run queries against an SQLite database.
    3. Command-line HTTP client written in Python that makes it easy to compose and send HTTP requests.