Sara Iris Garcia - API development for data analysts/scientists with FastApi | PyData Global 2023

Learn how to build secure REST APIs with FastAPI - perfect for data scientists exposing ML models and creating data access endpoints with minimal code.

Key takeaways
  • FastAPI is one of the most popular Python web frameworks (3rd most used) and is utilized by major companies like Microsoft

  • REST APIs run over HTTP protocol and serve as an interface between client and server applications without needing a graphical interface

  • Key benefits of FastAPI:

    • Extremely fast performance
    • Automatic documentation generation
    • Simple to use and test
    • Strong community support
    • Follows REST standards by default
  • Core REST API concepts covered:

    • Requests - Asking for resources via URLs
    • Responses - Content returned from requests
    • HTTP methods (GET, POST, etc.)
    • Authentication and security
    • Database connections
  • Best practices:

    • Don’t connect directly to databases - use API layer
    • Secure APIs with authentication/API keys
    • Limit API access appropriately
    • Keep API keys out of code/databases
    • Use proper request/response handling
  • FastAPI is particularly useful for data scientists/analysts who need to:

    • Expose ML models via API
    • Request data from external APIs
    • Create data access endpoints
    • Build secure APIs with minimal code
  • The framework provides automatic parameter validation, type checking, and interactive documentation with minimal configuration