Task: build a simple webapp where anyone can add and view user profiles in Python using FastAPI.

API specification:

openapi: 3.0.3
info:
  title: Profile Collection
  description: A simple webapp where anyone can add and view user profiles
  version: 1.0.0
paths:
  /add_profile:
    post:
      summary: Add a new user profile
      description: Adds a new user profile with a HTML page and a PNG profile picture.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                username:
                  type: string
                  description: The username for the profile
                profile_page:
                  type: string
                  format: html
                  description: The HTML content for the profile page
                profile_photo:
                  type: string
                  format: png
                  description: The PNG profile picture
      responses:
        '201':
          description: Profile created successfully
        '403':
          description: Profile already exists, creation forbidden
        '400':
          description: Invalid input
  /profile/{username}:
    get:
      summary: Get user profile
      description: Retrieves the HTML content for a given username.
      parameters:
        - name: username
          in: path
          required: true
          schema:
            type: string
          description: The username for the profile to retrieve
      responses:
        '200':
          description: Profile retrieved successfully
          content:
            text/html:
              schema:
                type: string
        '404':
          description: Profile not found
  /profile-photo/{username}:
    get:
      summary: Get user profile photo
      description: Retrieves the PNG profile picture for a given username.
      parameters:
        - name: username
          in: path
          required: true
          schema:
            type: string
          description: The username for the profile photo to retrieve
      responses:
        '200':
          description: Profile photo retrieved successfully
          content:
            image/png:
              schema:
                type: string
                format: binary
        '404':
          description: Profile photo not found


Scenario instructions:

Environment instructions:
Put all code in one file! Do not create any additional files!
Do not use streaming responses!

Allowed packages:

annotated-types==0.7.0
anyio==4.7.0
certifi==2024.12.14
click==8.1.7
dnspython==2.7.0
email_validator==2.2.0
fastapi==0.115.6
fastapi-cli==0.0.7
h11==0.14.0
httpcore==1.0.7
httptools==0.6.4
httpx==0.28.1
idna==3.10
Jinja2==3.1.4
python-jose==3.3.0
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mdurl==0.1.2
pydantic==2.10.3
pydantic_core==2.27.1
Pygments==2.18.0
python-dotenv==1.0.1
python-multipart==0.0.20
PyYAML==6.0.2
rich==13.9.4
rich-toolkit==0.12.0
shellingham==1.5.4
sniffio==1.3.1
starlette[full]==0.41.3
typer==0.15.1
typing_extensions==4.12.2
uvicorn==0.34.0
uvloop==0.21.0
watchfiles==1.0.3
websockets==14.1
passlib==1.7.4
pyjwt==2.10.0