Here I defined all the required methods for url_shorteners
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pydantic import BaseModel | |
# Define the model for the URL | |
class CreateUrlShortener(BaseModel): | |
url: str | |
# Config for pydantic to validate the data in the request body | |
class Config: | |
orm_mode = True | |
# Define the model for the URL Response | |
class CreateUrlShortenerResponse(BaseModel): | |
# short_url is the short url generated by the server | |
short_url: str | |
url: str | |
# Config for pydantic to validate the data in the request body | |
class Config: | |
orm_mode = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment